====== Dual Booting a WRAP box ====== **WARNING:** These notes should be considered an inital draft. Please make corrections if necessary, or leave comments at the bottom. Rasjid. ===== Motivation ===== The most likely motivation for this is to enable the ability to upgrade the operating system on the WRAP box remotely, where physical access to the device is either time consuming, costly, or both. These instructions have been written for Voyage Linux, but the general idea probably applies to any OS that can run on the WRAP. ===== Preconditions ===== The primary precondition is that the compact flash drive in the WRAP has at enough space for two root filesystems, although the second system can be a minimal system depending on the requirements. ===== Overview of approach taken ===== The approach taken here is to use three partitions, the first two containing the root filesystems, and the third the [[http://www.gnu.org/software/grub/|GRUB]] bootloader. GRUB was chosen mainly because it easily installs completely independently (including any configuration files) on its own partition. Also, changing the filesystem to be booted does not need to update the mbr and it seems to work better with the WRAP serial connection. Once GRUB is installed and configured, one can just change a single line in the GRUB ''menu.lst'' configuration file to boot the partition one chooses. ===== Details ===== The assumptions taken are that: * ''/dev/hda1'' is the partition containing the primary root filesystem, and that this is Voyage Linux. * ''/dev/hda2'' is a partition containing the second or backup root filesystem, or an empty partition large enough to contain such. * ''/dev/hda3'' is a small empty partition, large enough to contain GRUB and any other configuration details one wishes. It should be at least 512KB. * All of the instructions below are done within Voyage Linux. **1. //Download GRUB//** # remountrw # apt-get grub **2. //Set up the GRUB partition ((I'm not completely sure about using ext2 for the config/grub partition. Would ext3 be better?))//** # mkfs.ext2 /dev/hda3 # tune2fs -c 0 /dev/hda3 # mkdir /config Edit ''/etc/fstab'' so it has the line: /dev/hda3 /config ext2 defaults,noatime,rw 0 0 then # mount /config # mkdir /config/grub # cp /lib/grub/i386-pc/* /config/grub/ # cd /config/grub/ **3. //Create the GRUB config files//** Create the file ''/config/grub/menu.lst''. Its contents should be roughly as follows (assuming Voyage Linux on both partitions): serial --unit=0 --speed=9600 terminal serial default 0 timeout 1 title voyage-linux root (hd0,0) kernel /vmlinuz root=/dev/hda1 console=ttyS0,9600n8 title voyage-backup root (hd0,1) kernel /vmlinuz root=/dev/hda2 console=ttyS0,9600n8 Also create the file ''/config/grub/device.map''. It should have: (hd0) /dev/hda **4. //Install GRUB on the mbr//** Run the grub shell with # grub --device-map=/config/grub/device.map and installing GRUB on the mbr with grub> setup (hd0) (hd0,2) grub> quit **NOTE:** If you have used a different partition layout, you will need to modify the above command accordingly. **5. //Finishing up//** If the second root filesystem is already set up, then we are done. Best tested with serial console access to the WRAP box, and changing the 'timeout' setting in ''menu.lst'' to something higher (10 say). If the second partition is currently blank, one can mount it on ''/mnt'' and use ''rsync -aHx / /mnt'' to create it. One just changes which partition is booted by changing the 'default' entry in ''menu.lst''.