Felix Singer has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/56983 )
Change subject: [WIP] util/liveiso: Add documentation about persistent storage ......................................................................
[WIP] util/liveiso: Add documentation about persistent storage
Change-Id: If298049c16712a5fdf99a8b953402cf5a0d265e9 Signed-off-by: Felix Singer felixsinger@posteo.net --- M util/liveiso/description.md 1 file changed, 67 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/83/56983/1
diff --git a/util/liveiso/description.md b/util/liveiso/description.md index 3af9879..b63f476 100644 --- a/util/liveiso/description.md +++ b/util/liveiso/description.md @@ -4,3 +4,70 @@ ## What is this?
NixOS configuration files for testing purposes and for working on firmware. + + +## Does it have persistent storage? + +No, not by default, but you can add one yourself. Use at your own risk! + +Follow these steps: + +* Build one of the configurations using `build-console.sh` or `build-graphical.sh`. You can find the resulting ISO image in `result/iso/`. +* Partition your USB drive. + * Using MS-DOS partition table + ``` + parted -s /dev/sdx mklabel msdos + parted -s /dev/sdx mkpart primary 1MB 100MB # EFI boot partition + bootloader configs + kernel/initrd + parted -s /dev/sdx mkpart logical 100MB 1.1GB # Partition for storing squashfs container + parted -s /dev/sdx mkpart logical 1.1GB 4GB # Partition for persistent storage + parted -s /dev/sdx set 1 boot on # Make legacy bootloader able to recognize this partition + parted -s /dev/sdx name 1 cbboot + parted -s /dev/sdx name 2 cbrootfs + parted -s /dev/sdx name 3 cbpersistent + ``` + + * Using GPT partition table + ``` + parted -s /dev/sdx mklabel gpt + parted -s /dev/sdx mkpart primary 1MB 2MB # Boot partition for legacy boot loaders + parted -s /dev/sdx mkpart primary 2MB 100MB # EFI boot partition + bootloader configs + kernel/initrd + parted -s /dev/sdx mkpart logical 100MB 1.1GB # Partition for storing squashfs container + parted -s /dev/sdx mkpart logical 1.1GB 4GB # Partition for persistent storage + parted -s /dev/sdx set 1 bios_grub on # Make legacy bootloader able to recognize this partition + parted -s /dev/sdx set 2 boot on # Make EFI bootloader able to recognize this partition + parted -s /dev/sdx name 2 cbboot + parted -s /dev/sdx name 3 cbrootfs + parted -s /dev/sdx name 4 cbpersistent + ``` + +* Format partitions +``` +mkfs.vfat -F32 /dev/disk/by-partlabel/cbboot # EFI needs a FAT filesystem +mkfs.ext4 -L cbrootfs /dev/disk/by-partlabel/cbrootfs # Use a filesystem, which is supported by initrd (e.g. ext4) +mkfs.ext4 -L cbpersistent /dev/disk/by-partlabel/cbpersistent # Format partition for persistent storage +``` + +* Copy contents over from ISO image + * Create mountpoints + ``` + mkdir -p /mnt/{cbboot,cbrootfs,iso} + ``` + + * Mount everything + ``` + mount /dev/disk/by-partlabel/cbboot /mnt/cbboot + mount /dev/disk/by-partlabel/cbrootfs /mnt/cbrootfs + mount /path/to/iso /mnt/iso + ``` + + * Copy over files + ``` + cp -r /mnt/iso/{.boot.cat,EFI,boot,isolinux} /mnt/cbboot + cp -r /mnt/iso/{nix-store.squashfs,version.txt} /mnt/cbrootfs + ``` + + * Unmount gracefully + ``` + sync + umount /mnt/{cbboot,cbrootfs,iso} + ```