2015年5月16日星期六

Strip and Grub in BLFS 7.7

After LFS packaged are built successfully, LFS suggests us to run “strip --strip-debug” to save space (in the section 6.72). If you check the grub modules in /usr/lib/grub/i386-pc:


And then if you run the command “strip --strip-unneeded” (in the section “Notes on Building Software” of BLFS 7.7), the file size of the grub modules become smaller:


However, if you use this version to install grub in a new disk, you will find the grub cannot load the configuration file (/boot/grub/grub.cfg) and also cannot detect any disk:


The option “--strip-unneeded” will remove the static symbols so the caller (grub) will not find the static function or variable from the stripped libraries. And actually those grub modules contain lots of static variables and functions. That’s why grub cannot detect any disk because it cannot call the static "detect disk" function.


Therefore, if you re-build the grub with the grub source package and then reinstall the grub (I.e. the version without “strip --strip-unneeded”), grub will work properly.

沒有留言: