bootboot: Check for the right architecture when bruteforcing kernel (see #124)
diff --git a/stage23/protos/bootboot/initrd.c b/stage23/protos/bootboot/initrd.c
index 387c7de0..efef3387 100644
--- a/stage23/protos/bootboot/initrd.c
+++ b/stage23/protos/bootboot/initrd.c
@@ -8,7 +8,8 @@
struct initrd_file bruteforce_kernel(struct initrd_file file) {
for (size_t i = 0; i < file.size; i++) {
- if (memcmp(file.data + i, "\177ELF", 4) == 0) {
+ if (memcmp(file.data + i, "\177ELF", 4) == 0
+ && file.data[i + 18] == 62 && file.data[i + 19] == 0 /* ehdr->e_machine == EM_X86_64 */) {
printv("bootboot: using bruteforced kernel at initrd offset %X\n", file.data + i);
return (struct initrd_file){
.size = file.size - i,
