I want to use setup_data fields of linux boot header,  but grub doesn'tsupport 
it. So,  I cone latest grub repo (1.99) and modify grub code asfollows:

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 kernelheader, 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 
                                          
_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to