Difference between revisions of "User:Pnoecker/Undead USB Install/undead2live"

From Funtoo
Jump to navigation Jump to search
m (update eltorito img construction instructions.)
(note partuuid survives dd procedures)
(11 intermediate revisions by the same user not shown)
Line 1: Line 1:
https://help.ubuntu.com/community/LiveCDCustomization#Assembling_the_file_system
https://help.ubuntu.com/community/LiveCDCustomization#Assembling_the_file_system


make an undead usb from a stage 3 containing networkmanager, xfce4, x11-xorg, fchroot, slim, with auto login root terminals.  setup slim to boot root so the entire undead key does not have a password.  tidy up the undead key delete the stage3 tarball, delete the sources directory.  insert auto as root's file system in /etc/fstab so it will load in both ext2 & squashfs modes.
make an undead usb from a stage 3 containing networkmanager, xfce4, x11-xorg, fchroot, slim, with auto login root terminals.  setup slim to boot root so the entire undead key does not have a password.  tidy up the undead key delete the stage3 tarball, delete the sources directory.  insert auto as root's file system in /etc/fstab so it will load in both ext2 & squashfs modes. partuuid survives the dd procedure so label by that.  patch and rebuild your initramfs to support loading squashfs and rebuild your initramfs.  change the sources version number to reflect your installation.
 
{{console|body=
###i## sed '/MODULES_FS/ s/\"$/ squashfs\"/' -i /usr/share/genkernel/arch/$(arch)/modules_load
###i## genkernel initramfs --clean --disklabel --ramdisk-modules --fullname=debian-sources-x86_64-5.10.28_p1
}}
 
symlink /tmp to /run so x11 can write a lock file under the read only squashfs filesystem.
 
{{console|body=
###i## ln -sf /run /tmp
}}
 
on your host funtoo system emerge tools for cd mastering:


{{console|body=
{{console|body=
Line 40: Line 53:
}}
}}


grub bios mode boot image is located at
update boot entries so grub boots squashfs:
*/boot/grub/i386-pc/boot.img
{{console|body=
{{console|body=
###i## cp /boot/grub/i386-pc/boot.img /boot/boot.img
###i## ego boot update
###i## grub-mkconfig -o /boot/grub/grub.cfg
}}
}}


we have to make the efi image:
generate mbr/bios eltorito boot image:
 
{{console|body=
{{console|body=
###i## grub-mkimage-p /boot -o tmp_core.img -O i386-pc biosdisk iso9660 multiboot normal ls cat help
###i## grub-mkimage -p /boot -o tmp_core.img -O i386-pc biosdisk iso9660 multiboot normal ls cat help
###i## cat /usr/lib/grub/i386-pc/cdboot.img tmp_core.img > /boot/eltorito.img
###i## cat /usr/lib/grub/i386-pc/cdboot.img tmp_core.img > /boot/grubiso.img
}}
}}
generate uefi eltorito alternate boot image:
[https://wiki.osdev.org/UEFI#Creating_disk_images alternate boot image osdev guide]
https://github.com/syzdek/efibootiso
xorriso requires the uefi disk image to be either 1.2Mb, 1.4Mb, or 2.8Mb.


exit chroot
exit chroot
{{console|body=
{{console|body=
###i## exit
###i## exit
###i## cd /mnt/funtoo
}}
}}


generate iso image, and make it hybrid mode so it can be read from both cd/dvd, and usb key.
generate iso image, and make it hybrid mode so it can be read from both cd/dvd, and usb key.
{{console|body=
{{console|body=
###i## xorrisofs -D -r -V "funtoo" -cache-inodes -J -l -b boot/boot.img -c boot/boot.cat -boot-load-size 4 -boot-info-table -eltorito-alt-boot -e 'boot/eltorito.img' -no-emul-boot -o ../custom.iso .
###i## xorrisofs -D -r -V "funtoo" -cache-inodes -J -l -b boot/grubiso.img -c boot/boot.cat -boot-load-size 4 -boot-info-table -eltorito-alt-boot -e boot/uefi.img -no-emul-boot -o ../custom.iso .
###i## isohybrid --uefi ../custom.iso
###i## isohybrid --uefi ../custom.iso
}}
}}
or use grubs framework to generate the ISO image.  note that grub's mkrescue does not support uefi mode yet.
{{console|body=
###i## grub-mkrescue -o ../output.iso .
}}
https://unix.stackexchange.com/questions/283846/why-can-my-custom-build-iso-not-boot-in-efi

Revision as of 19:39, May 10, 2021

https://help.ubuntu.com/community/LiveCDCustomization#Assembling_the_file_system

make an undead usb from a stage 3 containing networkmanager, xfce4, x11-xorg, fchroot, slim, with auto login root terminals. setup slim to boot root so the entire undead key does not have a password. tidy up the undead key delete the stage3 tarball, delete the sources directory. insert auto as root's file system in /etc/fstab so it will load in both ext2 & squashfs modes. partuuid survives the dd procedure so label by that. patch and rebuild your initramfs to support loading squashfs and rebuild your initramfs. change the sources version number to reflect your installation.

root # sed '/MODULES_FS/ s/\"$/ squashfs\"/' -i /usr/share/genkernel/arch/$(arch)/modules_load
root # genkernel initramfs --clean --disklabel --ramdisk-modules --fullname=debian-sources-x86_64-5.10.28_p1

symlink /tmp to /run so x11 can write a lock file under the read only squashfs filesystem.

root # ln -sf /run /tmp

on your host funtoo system emerge tools for cd mastering:

root # emerge cdrtools squashfs-tools isomaster libisoburn

mount your undead usb key, but not dev sys or any of the other stuff because were going to package it with squashfs.

root # mount /dev/funtoo2 /mnt/funtoo
root # mount /dev/funtoo1 /mnt/funtoo/boot

edit /mnt/funtoo/etc/fstab file system's from ext4 & vfat to auto so we can have it auto load squashfs.

root # mksquashfs /mnt/funtoo /mnt/filesystem.squashfs

using isomaster you can insert /mnt/filesystem.squashfs into an xubuntu live cd. virtualbox will boot it, real hardware will not. it probably needs eltorito.img or isolinux.bin setup to chainload grub or whatever. the idea is were inserting our chroot into another live cd's chroot location.

xubuntu has a casper/ directory in the iso that contains a file called filesystem.squashfs, delete their chroot, insert ours. write iso. cheat to win has drawbacks, they're using overlayfs so they're overlaying files on the filesystem somewhere so another choice of live cd to modify is probably a good idea.

maybe we can get our grub loading the squashed image with a command like this.

root # dd if=/mnt/filesystem.squashfs of=/dev/funtoo2
root # mount /dev/funtoo2 /mnt/funtoo
root # mount /dev/funtoo1 /mnt/funtoo/boot

chroot into the squashfs image to manipulate grub on the read write fat partition.

root # env -i HOME=/root TERM=$TERM $(which chroot) /mnt/funtoo bash -l

update boot entries so grub boots squashfs:

root # ego boot update
root # grub-mkconfig -o /boot/grub/grub.cfg

generate mbr/bios eltorito boot image:

root # grub-mkimage -p /boot -o tmp_core.img -O i386-pc biosdisk iso9660 multiboot normal ls cat help
root # cat /usr/lib/grub/i386-pc/cdboot.img tmp_core.img > /boot/grubiso.img

generate uefi eltorito alternate boot image: alternate boot image osdev guide https://github.com/syzdek/efibootiso

xorriso requires the uefi disk image to be either 1.2Mb, 1.4Mb, or 2.8Mb.

exit chroot

root # exit
root # cd /mnt/funtoo

generate iso image, and make it hybrid mode so it can be read from both cd/dvd, and usb key.

root # xorrisofs -D -r -V "funtoo" -cache-inodes -J -l -b boot/grubiso.img -c boot/boot.cat -boot-load-size 4 -boot-info-table -eltorito-alt-boot -e boot/uefi.img -no-emul-boot -o ../custom.iso .
root # isohybrid --uefi ../custom.iso

or use grubs framework to generate the ISO image. note that grub's mkrescue does not support uefi mode yet.

root # grub-mkrescue -o ../output.iso .

https://unix.stackexchange.com/questions/283846/why-can-my-custom-build-iso-not-boot-in-efi