Comment 2 for bug 263944

Revision history for this message
Bartosz Kosiorek (gang65) wrote :

1. Summary
During the last step of installation of Ubuntu, grub will be installed. Before run grub commands to install grub, the device name must be convert from OS syntax to grub’s syntax. Such as “/dev/sda1” will be translated into “(hd0, 0)”. But SD memory card’s name style, “/dev/mmcblkxpy” (x: device number, y: partition number), doesn’t support in current grub install shell script. The grub installation will fail when install Ubuntu into SD memory card. In order to complete the installation, we must modify the grub install shell script to support SD memory card.

2.1 Modified Files
/usr/share/grub-installer/grub-installer
/usr/sbin/grub-install

2.2 For Device Mapping
According to the grub’s syntax, the OS device name will be split into disk part and partition part. Such as “/dev/mmcblk0p1” will be translated into “(hd0, 0)”.
To complete this, I add some code in grub-installer and grub-install to recognize /dev/mmcblkxpy and add some command in grub-installer to generate the device mapping file “device.map”.

2.3 For initrd Update
I add commands to update the initrd at the end of the grub-installer.

2.4 Notice

1. All the modification in source code has been added comment with my name “tonyxu”.
2. I have used “touch” and “echo” commands to generate the device mapping file “device.map”. It’s better to generate it by /usr/sbin/grub. But “grub” is a binary file; I have no idea how to generate the file in it.
3. To boot from SD memory card, the driver modules needed by the card (mmc_core, mmc_block, sdhci) must be loaded at the boot time. So I add commands to update the initrd at the end of the grub-installer. Maybe the initrd should be updated before grub installation.