**This is an old revision of the document!**
Table of Contents
Multiboot usb key with 32 and 64bits debian installers and debian live
Preparing the usb key
- Create a partition table and make a fat32 partition that uses the whole usb key space.
cfdisk /dev/sdb mkfs.vfat /dev/sdb1
- Install grub on the usb key
mount /dev/sdb1 /media/usb0 grub-install –no-floppy –root-directory=/media/usb0 /dev/sdb
- Create a grub.cfg file in /media/usb0/boot/grub/ with the following contents:
menuentry “debian-installer-i386” { linux /boot/vmlinuzi386 vga=788 – quiet initrd /boot/initrdi386.gz }
menuentry “debian-installer-i386 expert” { linux /boot/vmlinuzi386 priority=low vga=788 – initrd /boot/initrdi386.gz }
menuentry “debian-installer-amd64” { linux /boot/vmlinuzamd64 vga=788 – quiet initrd /boot/initrdamd64.gz }
menuentry “debian-installer-amd64 expert” { linux /boot/vmlinuzamd64 priority=low vga=788 – initrd /boot/initrdamd64.gz }
menuentry “live amd64” { linux /boot/liveamd64/vmlinuz boot=live live-media-path=/boot/liveamd64 persistent-path=/persistent/amd64/ live-config persistent initrd /boot/liveamd64/initrd.img }
menuentry “live i386” { linux /boot/livei386/vmlinuz boot=live live-media-path=/boot/livei386 persistent-path=/persistent/i386/ live-config persistent initrd /boot/livei386/initrd.img }
Debian installer
- Get the hd-usb debian installer vmlinuz and initrd.gz files from the web. Rename them to vmlinuz$arch and initrd$arch.gz, where $arch is the computer architecture (i386, amd64). Copy them to /media/usb0/boot.
- Get the corresponding netinstall iso files for the installed architectures and copy them to /media/usb0
Debian live
- Create some necessary directories:
mkdir /media/usb0/persistent mkdir /media/usb0/persistent/amd64 mkdir /media/usb0/persistent/i386 mkdir /media/usb0/boot/liveamd64 mkdir /media/usb0/boot/livei386
Generate the debian live image
- Install live-helper package
- Create live image (do this from a 64bit machine):
mkdir /tmp/d-l mkdir /tmp/d-l/amd64 cd /tmp/d-l/amd64 sudo lh clean –binary sudo lh config -b usb-hdd -a amd64 -d sid sudo lh build
- When the build is finished edit the file chroot/sbin/live-snapshot
- Replace the line:
SNAPCOW=$(echo “${SNAPRESYNCSTRING}” | sed -e 's|^/root([^:.]).$|'“${DEFSNAP_COW}”'\1|')
- With:
SNAPCOW=$(echo “${SNAPRESYNCSTRING}” | sed -e 's|^/cow([^:.]).$|'“${DEFSNAP_COW}”'\1|')
- Regenerate the live image:
sudo lh clean –binary sudo lh binary
- Loop mount the generated live image, copy the important parts to the usb key, and extract the initrd contents:
mount -o loop,offset=512 binary.img /mnt cd /mnt/live cp * /media/usb0/boot/liveamd64 mkdir /tmp/initrdamd64 cp /mnt/live/initrd.img /tmp/initrdamd64/initrd.img.gz cd /tmp/initrdamd64 gunzip initrd.img.gz cpio -ivmd -F initrd.img rm initrd.img - Edit the file scripts/live
- Replace line:
${snaptype}SNAP=“/cow${snapmount#$rootmnt}”:${snapdev}:${snapfile}“
>> /etc/live.conf # for resync on reboot/halt
- With:
${snaptype}SNAP=”/cow${snapmount#$rootmnt}“:${snapdev}:${snapfile}”
>> ${rootmnt}/etc/live.conf # for resync on reboot/halt
- And replace line:
snapdata=$(findfiles “${PERSISTENTPATH}${snaplabel}.squashfs ${PERSISTENTPATH}${snaplabel}.cpio.gz ${PERSISTENTPATH}${snaplabel}.ext2 ${PERSISTENTPATH}${snaplabel}.ext3 ${PERSISTENTPATH}${snaplabel}.ext4 ${PERSISTENTPATH}${snap_label}.jffs2”)
- With:
snapdata=$(findfiles “${PERSISTENTPATH}/${snaplabel}.squashfs ${PERSISTENTPATH}/${snaplabel}.cpio.gz ${PERSISTENTPATH}/${snaplabel}.ext2 ${PERSISTENTPATH}/${snaplabel}.ext3 ${PERSISTENTPATH}/${snaplabel}.ext4 ${PERSISTENTPATH}/${snap_label}.jffs2”)
- Recreate initrd.img file, and copy it to the usb key:
find .| cpio -o -H newc | gzip -9 > ../initrd.img cp ../initrd.img /media/usb0/boot/live_amd64
- Repeat the whole procedure for the 32bits case, just use i386 where amd64 is.
