From dbbfddf6a811908aca66269c630c12d8a126f476 Mon Sep 17 00:00:00 2001 From: FreeArtMan Date: Wed, 20 Jan 2016 20:31:08 +0000 Subject: Add multiboot USB post --- md/writeup.md | 1 + md/writeup/multiboot_usb_drive.md | 163 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 164 insertions(+) create mode 100644 md/writeup/multiboot_usb_drive.md diff --git a/md/writeup.md b/md/writeup.md index 6960029..0743d93 100644 --- a/md/writeup.md +++ b/md/writeup.md @@ -8,6 +8,7 @@ [Using GDB](writeup/using_gdb.md) [QEMU usage](writeup/qemu_usage.md) +[Multiboot USB drive](writeup/multiboot_usb_drive.md) ### Projects diff --git a/md/writeup/multiboot_usb_drive.md b/md/writeup/multiboot_usb_drive.md new file mode 100644 index 0000000..3e8a117 --- /dev/null +++ b/md/writeup/multiboot_usb_drive.md @@ -0,0 +1,163 @@ +# Multiboot USB drive + +Purpose of this is to use one USB driver to test many distros. When you have +many distro ISO's it takes some time to _dd_ them on USB driver and if you +whant to try many different then it will take time to _dd_ them everytime +when you try new. If there is possible just copy many ISO's on USB driver and +run any you need it will save you some time. + +## Lets install bootloader + +Using _fdisk_ to delete/create new partitions on USB drive + +``` +mkfs.vfat /dev/sdb1 +``` + +mount drivet to current pc + +``` +mount /dev/sdb1 /mnt/flash0 +``` + +create dire where will be grub files and grub menu config file + +``` +mkdir /mnt/flash0/boot +``` + +install grub, but you can install also 64bit grub if there is need + +``` +grub-install --target=i386-pc --recheck --boot-directory=/mnt/flash0/boot /dev/sdb +``` + +check with id have usb drive + +``` +blkid /dev/sdb1 +/dev/sdb1: UUID="D49E-18CC" TYPE="vfat" PARTUUID="5f55bd3d-01" +``` + +### Mounting ISO's + +Some manuals have outdatet filesystem layouts and there is need to investigate +current layout by hand. And you need to mount ISO files. + +``` +mount -o loop /home/fam/downloads/iso/ubuntu-14.04.3-desktop-i386.iso /mnt/flash0 +``` + +next is to check bootloader config how they are starting image, there you +can find extra options that need to be passed or just with image is used +to start ISO + +## Boot menu + +Here is result what you have at the end some Ubuntu isos, OpenWRT image and +your own compiled kernel + +__boot/grub/grub.cfg__ + +``` +# Begin /boot/grub/grub.cfg +set default=1 +set timeout=5 + +probe -u $root --set=rootuuid +set imgdevpath="/dev/disk/by-uuid/$rootuuid" + +menuentry "GNU/Linux, vmlinux" { + linux /vmlinux root=/dev/disk/by-uuid/54F9-27A2 ro +} + + +menuentry "Ng-Linux, bzImage" { + linux /bzImage root=/dev/disk/by-uuid/54F9-27A2 ro + initrd /test.cpio.gz +} + +menuentry "OpenWRT, bzImage" { + linux /openwrt-x86-generic-ramfs.bzImage root=/dev/sdb1 ro + initrd /openwrt-x86-generic-rootfs.cpio.gz +} + +menuentry "DSL, bzImage" { + set isofile='/boot/iso/dsl-4.4.10.iso' + loopback loop $isofile + linux (loop)/boot/isolinux/linux24 ramdisk_size=100000 init=/etc/init2 lang=us vga=normal atapicd nosound noscsi nousb nopcmcia nofirewire noagp nomce nodhcp xmodule=vesa + initrd (loop)/boot/isolinux/minirt24.gz knoppix base norestore legacy +} + +menuentry "Austrumi, bzImage" { + set isofile='/boot/iso/austrumi-3.2.6.iso' + loopback loop $isofile + linux (loop)/austrumi/bzImage + initrd (loop)/austrumi/initrd.gz dolivecd text +} + +menuentry '[loopback]archlinux-2015.12.01-dual.iso-mnth' { + set isofile='/boot/iso/archlinux-2015.12.01-dual.iso' + loopback loop $isofile + linux (loop)/arch/boot/x86_64/vmlinuz img_dev=$imgdevpath img_loop=$isofile + initrd (loop)/arch/boot/x86_64/archiso.img +} + +menuentry '[loopback]ubuntu-14.04.3-desktop-amd64' { + set isofile='/boot/iso/ubuntu-14.04.3-desktop-i386.iso' + loopback loop $isofile + linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=$isofile locale=en_US.UTF-8 + initrd (loop)/casper/initrd.lz +} + +menuentry '[loopback]ubuntu-12.04.5-alternate-i386' { + set isofile='/boot/iso/ubuntu-12.04.5-alternate-i386.iso' + loopback loop $isofile + linux (loop)/install/vmlinuz boot=/dev/sda1 iso-scan/filename=$isofile locale=en_US.UTF-8 + initrd (loop)/install/initrd.gz +} + +menuentry "[loopback]tails-i386-1.8.1.iso" { + set isofile='/boot/iso/tails-i386-1.8.1.iso' + loopback loop $isofile + linux (loop)/live/vmlinuz2 boot=live config findiso=${isofile} live-media=removable apparmor=1 security=apparmor nopersistent noprompt timezone=Etc/UTC block.events_dfl_poll_msecs=1000 noautologin module=Tails + initrd (loop)/live/initrd2.img +} + +``` + +# Tested + +## Devices + +?Some images could be not loadable becouse not enought RAM? + +Tested to work on _Asus EEE PC 701_ [6]. And bigger desktop PC (12G RAM). + +| Distro | Asus | PC | +|---|---|---| +| my own kernel + initrd | + | + | +| OpenWRT | + | - _?no kbd drivers_ | +| DSL | - | - | +| Austrumi | - | - | +| archlinux 2015.12.01 | ? | + | +| Ubuntu 14.04.3 | + | + | +| Ubuntu 12.04.5 | + | + | +| Tails | ? | + | + +```text ++ - works fine +- - doesnt work +? - to long to wait, not enought ram? +``` + +# Links + +1. https://wiki.archlinux.org/index.php/Multiboot_USB_drive +2. https://www.kernel.org/doc/Documentation/kernel-parameters.txt +3. https://liquidat.wordpress.com/2007/10/15/short-tip-get-uuid-of-hard-disks/ +4. http://www.linuxfromscratch.org/lfs/view/stable/chapter08/grub.html +5. http://www.redips.net/linux/create-fat32-usb-drive/ +6. https://en.wikipedia.org/wiki/Asus_Eee_PC + + -- cgit v1.2.3