This allows us to load almost anything we want. For me it is mainly Live CDs. See my menus in the appendix at the end. All items list boot and are usable.
Hopefully you find this useful. It is not pretty and there may be easier ways to do it but this method has worked for me on 2 separate thumbdrives and an sd card.
How-To:
This how-to will install ChromiumOS to a thumbdrive, replace the bootloader with Grub2 (to boot Linux ISOs) and then install Grub4Dos to a separate partition (to boot DOS/Windows based ISOs).
I used Arch Linux to create this tutorial but original research and first thumbdrive was created on PMagic 6.4 Live cd. Your mileage may vary if attempted on a different Linux OS.
1. Warnings and notes.
Always be sure which /dev/sdx refers to your thumbdrive. DD and installing grub2 to the wrong drive can destroy your data and leave your system unbootable. You have been warned!
Once you install ChromiumOS do not open the thumbdrive with any other partition editor but gdisk. Parted and gparted would ruin the file structure on me if i made any changes with them. Again YMMV.
In gdisk if you don't see a value beside the prompt in the codes below it means the default was accepted.
2. Tool required:
1 USB Thumbdrive of at least 4GB
Chromium OS Vanilla by Hexxeh release 0.14.805.2011_07_31_1705-r54807a91
DD <standard in most distros>
gdisk <installed with the gptfdisk package>
mkfs.vfat <installed with the dosfstools package>
grub2-bios 1:1.99-3 <this is the Arch Linux Package the one in Pmagic also worked with the commands below>
grub4dos 0.4.4 <download the files from sourceforge and extract the files to a directory>
3. Erase disk
dd if=/dev/zero of=/dev/sdb
replace sdb with the value for your thumbdrive.
4. Write image to disk
dd if=ChromeOS-Vanilla-0.14.805.2011_07_31_1705-r54807a91.img of=/dev/sdb bs=4096
5. Using gdisk
gdisk /dev/sdb
Extend disk to take utilize full disk.
go to extra functionality (experts only)
Command (? for help): x
relocate backup data structures to the end of the disk
Expert command (? for help): e Relocating backup data structures to the end of the disk
create new partition in remaining space
Expert command (? for help): m Command (? for help): n Partition number (13-128, default 13): First sector (34-4005889, default = 16452) or {+-}size{KMGTP}: Last sector (16452-20479, default = 20479) or {+-}size{KMGTP}: Current type is 'Linux filesystem' Hex code or GUID (L to show codes, Enter = 8300): 0700 Changed type of partition to 'Microsoft basic data'
Write the change to disk.
Command (? for help): w Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING PARTITIONS!! Do you want to proceed? (Y/N): Y OK; writing new GUID partition table (GPT). The operation has completed successfully
6. Make vfat file system in new partition
mkfs.vfat /dev/sdb13 mkfs.vfat 3.0.11 (24 Dec 2010)
7. Install grub2
Grub2 does not like installing without a bios_grub flag on a partition but in trial anytime I set the flag nothing would boot so we will force the installation and let grub2 complain.
Mount root directory we want to use for grub2.
I use the boot directory that was created by Chromium on my thumbdrive
On my installation it is sdb12
To find out if yours is the same run
gdisk -l /dev/sdb Password: GPT fdisk (gdisk) version 0.7.2 Partition table scan: MBR: protective BSD: not present APM: not present GPT: present Found valid GPT with protective MBR; using GPT. Disk /dev/sdb: 15644672 sectors, 7.5 GiB Logical sector size: 512 bytes Disk identifier (GUID): F07CBA0D-1738-3C42-9B1B-92D7A2E76277 Partition table holds up to 128 entries First usable sector is 34, last usable sector is 15644638 Partitions will be aligned on 1-sector boundaries Total free space is 4058 sectors (2.0 MiB) Number Start (sector) End (sector) Size Code Name 1 1810432 3907583 1024.0 MiB 0700 STATE 2 20480 53247 16.0 MiB 7F00 KERN-A 3 53248 1810431 858.0 MiB 7F01 ROOT-A 4 3973120 4005887 16.0 MiB 7F00 KERN-B 5 4005888 4005888 512 bytes 7F01 ROOT-B 6 16448 16448 512 bytes 7F00 KERN-C 7 16449 16449 512 bytes 7F01 ROOT-C 8 3907584 3940351 16.0 MiB 0700 OEM 9 16450 16450 512 bytes 7F02 reserved 10 16451 16451 512 bytes 7F02 reserved 11 64 16447 8.0 MiB FFFF RWFW 12 3940352 3973119 16.0 MiB EF00 EFI-SYSTEM 13 4005889 15644638 5.5 GiB 0700 Microsoft basic data
and look for the EFI-SYSTEM name.
12 3940352 3973119 16.0 MiB EF00 EFI-SYSTEM
mount /dev/sdb12 /mnt/cards/
Install grub2
grub-install --no-floppy --root-directory=/mnt/cards/ --force /dev/sdb12 /sbin/grub-setup: warn: Attempting to install GRUB to a partitionless disk or to a partition. This is a BAD idea.. /sbin/grub-setup: warn: Embedding is not possible. GRUB can only be installed in this setup by using blocklists. However, blocklists are UNRELIABLE and their use is discouraged.. Installation finished. No error reported.
Create a grub.cfg
I am going to assume you have a working grub.cfg somewhere so feel free to reuse it. If you don't my full one is below. I have a lot of crap in my mine so unfortuantly i'm not a 100% sure what is required and what is not but here is the important entry to boot Chromium
menuentry "Chromium OS" { linux (hd0,3)/boot/vmlinuz quiet console=tty2 init=/sbin/init boot=local rootwait ro noresume noswap loglevel=1 noinitrd root=/dev/sdb3 i915.modeset=1 cros_efi }
be sure to save the grub.cfg to the boot/grub/ directory on your thumbdrive. The directory will be in your file tree where you mounted your thumbdrive above.
Unmount the boot directory
umount /mnt/cards/
8. Create a hybrid MBR so we can load grub4dos
gdisk /dev/sdb
go to recovery and transformation options (experts only)
Command (? for help): r
choose make hybrid MBR
Recovery/transformation command (? for help): h WARNING! Hybrid MBRs are flaky and dangerous! If you decide not to use one, just hit the Enter key at the below prompt and your MBR partition table will be untouched. Type from one to three GPT partition numbers, separated by spaces, to be added to the hybrid MBR, in sequence:13 Place EFI GPT (0xEE) partition first in MBR (good for GRUB)? (Y/N): y Creating entry for GPT partition #13 (MBR partition #2) Enter an MBR hex code (default 07): 0c Set the bootable flag? (Y/N): n Unused partition space(s) found. Use one to protect more partitions? (Y/N): y Note: Default is 0xEE, but this may confuse Mac OS X. Enter an MBR hex code (default EE): 0a Recovery/transformation command (? for help): w Warning! Mismatched GPT and MBR partition! MBR partition 4, of type 0x0A, has no corresponding GPT partition! You may continue, but this condition might cause data loss in the future! Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING PARTITIONS!! Do you want to proceed? (Y/N): y OK; writing new GUID partition table (GPT). The operation has completed successfully
9. Install grub4dos
Mount the partition you created with gdisk the first time around
mount /dev/sdb13 /mnt/cards/[code] make a boot/grub directory [code]mkdir -p /mnt/cards/boot/grub[/code] copy files from your grub4dos that you downloaded and extracted earlier [code]cp grub.exe grldr /mnt/cards/boot/grub/[/code] create a menu.lst and place it in with the grub.exe and grldr files on your thumbdrive again mine is listed below. and finally add the entry for grub4dos to your grub.cfg [code]umount /mnt/cards/
mount /dev/sdb12 /mnt/cards/
add this entry to your grub.cfg
menuentry 'Other Live CDs'{ set root='(hd0,1)' linux (hd0,gpt13)/boot/grub/grub.exe }
umount /mnt/cards/
and finally reboot to your new thumbdrive.
10.Appendix
grub.cfg
### BEGIN /etc/grub.d/00_header ### insmod part_gpt insmod part_msdos insmod fat if [ -s $prefix/grubenv ]; then load_env fi set default="0" if [ "${prev_saved_entry}" ]; then set saved_entry="${prev_saved_entry}" save_env saved_entry set prev_saved_entry= save_env prev_saved_entry set boot_once=true fi function savedefault { if [ -z "${boot_once}" ]; then saved_entry="${chosen}" save_env saved_entry fi } function load_video { insmod vbe insmod vga insmod video_bochs insmod video_cirrus } set menu_color_normal=green/black set menu_color_highlight=black/green insmod part_msdos insmod ext2 set root='(hd0,msdos1)' search --no-floppy --fs-uuid --set=root 908d3c4a-4884-44b1-b153-96a10dbfb2b2 if loadfont /grub/unicode.pf2 ; then set gfxmode=1024x600x32 load_video insmod gfxterm insmod part_msdos insmod ext2 set root='(hd1,msdos1)' search --no-floppy --fs-uuid --set=root 908d3c4a-4884-44b1-b153-96a10dbfb2b2 set locale_dir=($root)/grub/locale set lang=en_US insmod gettext fi terminal_input console terminal_output gfxterm set timeout=5 ### END /etc/grub.d/00_header ### ### BEGIN /etc/grub.d/20_linux_xen ### ### END /etc/grub.d/20_linux_xen ### ### BEGIN /etc/grub.d/20_memtest86+ ### ### END /etc/grub.d/20_memtest86+ ### ### BEGIN /etc/grub.d/30_os-prober ### ### END /etc/grub.d/30_os-prober ### ### BEGIN /etc/grub.d/40_custom ### # This file provides an easy way to add custom menu entries. Simply type the # menu entries you want to add after this comment. Be careful not to change # the 'exec tail' line above. menuentry 'Arch Linux, BFS Kernel' --class archlinux --class gnu-linux --class gnu --class os { load_video set gfxpayload=keep insmod gzio insmod part_msdos insmod ext2 set root='(hd1,msdos1)' search --no-floppy --fs-uuid --set=root 908d3c4a-4884-44b1-b153-96a10dbfb2b2 echo 'Loading Linux vmlinuz26-bfs ...' linux /vmlinuz26-bfs root=/dev/mapper/vgroup-root cryptdevice=/dev/sda2:vgroup ro quiet echo 'Loading initial ramdisk ...' initrd /kernel26-bfs.img } menuentry 'Arch Linux, Stock Kernel' --class archlinux --class gnu-linux --class gnu --class os { load_video set gfxpayload=keep insmod gzio insmod part_msdos insmod ext2 set root='(hd1,msdos1)' search --no-floppy --fs-uuid --set=root 908d3c4a-4884-44b1-b153-96a10dbfb2b2 echo 'Loading Linux vmlinuz26 ...' linux /vmlinuz26 root=/dev/mapper/vgroup-root cryptdevice=/dev/sda2:vgroup ro quiet echo 'Loading initial ramdisk ...' initrd /kernel26-fallback.img } menuentry "Chromium OS" { linux (hd0,3)/boot/vmlinuz quiet console=tty2 init=/sbin/init boot=local rootwait ro noresume noswap loglevel=1 noinitrd root=/dev/sdb3 i915.modeset=1 cros_efi } menuentry 'Parted Magic 6.4'{ set root='(hd0,gpt13)' loopback loop (hd0,gpt13)/pmagic-6.4.iso linux (loop)/pmagic/bzImage edd=off load_ramdisk=1 prompt_ramdisk=0 rw loglevel=9 vga=normal livemedia noeject max_loop=256 vmalloc=256MiB initrd (loop)/pmagic/initramfs } menuentry 'Backtrack 5'{ set root='(hd0,gpt13)' loopback loop (hd0,gpt13)/BT5-GNOME-32.iso linux (loop)/casper/vmlinuz file=/cdrom/preseed/custom.seed boot=casper initrd=(hd0,gpt13)/boot/initrdBT.gz iso-scan/filename=/BT5-GNOME-32.iso noeject noprompt splash -- initrd (hd0,gpt13)/boot/initrdBT.gz } menuentry 'Other Live CDs'{ set root='(hd0,1)' linux (hd0,gpt13)/boot/grub/grub.exe --config-file=/boot/grub/menu.lst } ### END /etc/grub.d/40_custom ### ### BEGIN /etc/grub.d/41_custom ### if [ -f $prefix/custom.cfg ]; then source $prefix/custom.cfg; fi ### END /etc/grub.d/41_custom ###
my Backtrack has a respun initrd. If you'd like the script to rework yours just ask.
menu.lst
color green/black black/green green/black green/black timeout 30 default /default title Ultimate Boot CD 5.03 find --set-root /ubcd503.iso map (hd0,1)/ubcd503.iso (hd32) map --hook chainloader (hd32) title Kolibrios find --set-root /kolibri.iso map (hd0,1)/kolibri.iso (0xff) || map --mem (hd0,0)/kolibri.iso map --hook chainloader (0xff) title OphCrack XP 2.3.1 (XP Password Cracker) find --set-root /ophcrack-xp-livecd-2.3.1.iso map /ophcrack-xp-livecd-2.3.1.iso (0xff) map --hook root (0xff) kernel /boot/bzImage rw root=/dev/null vga=normal lang=C kmap=uk screen=1024x768x16 autologin initrd /boot/rootfs.gz title OphCrack Vista 2.3.1 (Vista Password Cracker) find --set-root /ophcrack-vista-livecd-2.3.1.iso map /ophcrack-vista-livecd-2.3.1.iso (0xff) map --hook root (0xff) kernel /boot/bzImage rw root=/dev/null vga=normal lang=C kmap=uk screen=1024x768x16 autologin initrd /boot/rootfs.gz title Win7PE Plain map (hd0,1)/win7PE_SEV4Disk1.ISO (hd32) chainloader (hd0,1)+1 map --hook chainloader (hd32) boot title Win7PE Tools map (hd0,1)/win7PE_SEV4Disk2.ISO (hd32) chainloader (hd0,1)+1 map --hook chainloader (hd32) boot title Kon-Boot v1.1 map --mem (hd0,1)/konFloppy.img (fd0) map --hook chainloader (fd0)+1 map (hd1) (hd0) map --hook rootnoverify (fd0) title Reboot reboot title Halt halt title Command-line commandline
11.Reference
This site and the ones list below were invaluable in figuring this out
http://www.rodsbooks...isk/hybrid.html
http://www.win.tue.n...on_types-1.html