detect size of rootfs

This commit is contained in:
ading2210 2023-10-06 10:29:10 -07:00
parent 057b7a86ad
commit e3736b8aee
2 changed files with 16 additions and 4 deletions

View File

@ -5,6 +5,14 @@ This is a set of scripts for patching a Chrome OS RMA shim to serve as a bootloa
## Current Development Roadmap:
- ~~build the image automatically~~
- ~~boot to a shell~~
- switch_root into an actual rootfs
- start X11 in the actual rootfs
- ui improvements in the bootloader
- ~~switch_root into an actual rootfs~~
- ~~start X11 in the actual rootfs~~
- ~~ui improvements in the bootloader~~
- load all needed drivers
- autostart X11
## Usage:
1. Grab a Chrome OS RMA Shim from somewhere. Most of them have already been leaked and aren't too difficult to find.
2. Download a Devuan live ISO. Run it inside a VM and install it to a disk image. Mount the disk image in the host.
3. Run `sudo DEBUG=1 ./build.sh`. The `rootfs_dir` argument should point to where you mounted the rootfs in part 2.
4. Flash the generated image to a USB drive or SD card.

View File

@ -88,7 +88,11 @@ echo "patching initramfs"
patch_initramfs $initramfs_dir
echo "creating disk image"
create_image $output_path 20 1200
rootfs_size=$(du -sm $rootfs_dir | cut -f 1)
rootfs_part_size=$(($rootfs_size * 11 / 10 + 10))
#create a 20mb bootloader partition
#rootfs partition is 10% larger than its contents
create_image $output_path 20 $rootfs_part_size
echo "creating loop device for the image"
image_loop=$(create_loop ${output_path})