|
From: | GuoMinskey |
Subject: | question about adding a field into linux boot header |
Date: | Thu, 24 Mar 2011 08:12:02 +0000 |
I want to use setup_data fields of linux boot header, but grub doesn't support it. So, I cone latest grub repo (1.99) and modify grub code as follows: 1. in include/grub/i386/linux.h, struct linux_kernel_header { @@ -130,6 +144,8 @@ grub_uint16_t pad1; /* Unused */ grub_uint32_t cmd_line_ptr; /* Points to the kernel command line */ grub_uint32_t initrd_addr_max; /* Highest address for initrd */ + grub_uint32_t pad2[8]; + grub_uint64_t new_field; <-------------- aligned to the offset : 0x250 as linux } __attribute__ ((packed)); 2. grub-core/loader/i386/linux.c I add a command by following "initrd", but simply as follows: static grub_err_t grub_cmd_test(cmd, argc, argv[]) { grub_printf("entering my test command\n"); ... //ensure kernel is loaded struct linux_kernel_header *lh = (struct linux_kernel_header *) real_mode_mem; lh->new_field = 0x34FFFFFF; } when I boot GRUB with my command, GRUB panic in relocator. I print the kernel header, seems the header is there ( I mean real_mode_mem). If I removed the line "lh->new_field = 0x34FFFFFF", GRUB can work. Did I miss something if I want pass this field into linux kernel ? thanks, -minskey |
[Prev in Thread] | Current Thread | [Next in Thread] |