Skip to content

Add install flag to generate separate boot and system images

Daniele Debernardi requested to merge feature/1049-split-install into master

Overview

Add the --split flag to the pmbootstrap install command which will create the boot and system partitions directly in separate images:

  • device-xxx-yyy-boot.img
  • device-xxx-yyy-system.img

With the pmbootstrap export you will get symlinks for the split files

Usage example (cli output)

$ yes | pmbootstrap -y install --no-fde --split
[23:28:56] *** (1/5) PREPARE NATIVE CHROOT ***
[23:28:57] *** (2/5) CREATE DEVICE ROOTFS ("samsung-i9070") ***
[23:29:02] (rootfs_samsung-i9070) install
[23:29:06] (rootfs_samsung-i9070) write /etc/os-release
[23:29:06] NOTE: Skipped initramfs generation (-s)!
[23:29:06]  *** SET LOGIN PASSWORD FOR: 'user' ***
New password: Retype new password: passwd: password updated successfully
[23:29:06] NOTE: No valid keymap specified for device
[23:29:09] *** (3/5) PREPARE INSTALL BLOCKDEVICE ***
[23:29:11] (native) create samsung-i9070-boot.img (27M)
[23:29:11] (native) create samsung-i9070-system.img (470M)
[23:29:11] (native) mount /dev/install-boot (samsung-i9070-boot.img)
[23:29:11] (native) mount /dev/install-system (samsung-i9070-system.img)
[23:29:11] (native) format /dev/install-system
[23:29:11] (native) mount /dev/install-system to /mnt/install
[23:29:11] (native) format /dev/install-boot (boot, ext2), mount to /mnt/install/boot
[23:29:12] *** (4/5) FILL INSTALL BLOCKDEVICE ***
[23:29:12] (native) copy rootfs_samsung-i9070 to /mnt/install/
[23:29:15] *** (5/5) FLASHING TO DEVICE ***
[23:29:15] Run the following to flash your installation to the target device:
[23:29:15] * pmbootstrap flasher flash_kernel
[23:29:15]   Flashes the kernel + initramfs to your device:
[23:29:15]   /home/drebrez/.local/var/pmbootstrap/chroot_rootfs_samsung-i9070/boot
[23:29:15] * If the above steps do not work, you can also create symlinks to the generated files with 'pmbootstrap export' and flash outside of pmbootstrap.
[23:29:15] Done

Changes

  • get_subpartitions_size now returns the boot and the system partition sizes, not the full size
  • create_and_mount_image works like before when no --split is specified, otherwise it will create 2 image files and bind them to /dev/install-boot and /dev/install-system
  • install_system_image when --split is specified:
    • skip the creation of the partition table
    • skip mounting the subpartitions
    • skip the conversion to sparse image
    • skip the system flash information
  • symlinks also create links to the boot and system image files

Tested

  • Creation of the full rootfs image (with and without fde)
  • Creation of the splitted boot and system image files (with and without fde)
  • Export the symlinks
  • Mount the boot and system image files and verify content
  • Flash on device and verify

Close #1049 (closed)


[x] Merge on GitHub (see https://postmarketos.org/merge)

Merge request reports