skiffos / SkiffOS

Any Linux distribution, anywhere.
https://skiffos.com
MIT License
702 stars 52 forks source link

jetson/tx2: boot to squashfs with mutable overlayfs #133

Closed paralin closed 3 years ago

paralin commented 3 years ago

The old boot process is available by setting TX2_MUTABLE_ROOTFS when using the flashusb script.

Previously, the tx2 booted to a mutable ext2 APP partition. Now, the tx2 will use the APP partition as persist, with /boot containing the usual Skiff boot-up files - squashfs and Image.

A custom C tool skiff-init-squashfs is added, which is executed by the kernel as the init process with APP (persist) mounted to / as root. The init process will mount the squashfs to /skiff, persist to /skiff/mnt/persist, and an overlayfs over /skiff. Then, it chroots into /skiff and runs systemd.

Signed-off-by: Christian Stewart christian@paral.in

paralin commented 3 years ago

Only issue that remains before merge is persist-resize - it can't resize with this because / is permanently mounted (/dev/mmcblk0p1) so there's no way to unmount it to complete the resizing.

One way to possibly do this is have the skiff-init binary check for a pre-startup script located in the target FS, if it exists, then it should run the script (with the target PATH available) to resize the partition before continuing. An unfortunate issue is that we need to unmount /skiff and the squashfs before this is possible.

paralin commented 3 years ago

Note: the partition is the correct size, it's just the ext4 disk that needs to be bigger - fdisk -l /dev/mmcblk0p1

Therefore it should be enough to just provide a static copy of resize2fs along with skiff-init and run it unconditionally just before mounting things.

paralin commented 3 years ago

Implemented the following: