build script fixes

This commit is contained in:
ading2210 2023-10-20 20:51:56 +00:00
parent 34c3321ffe
commit bff62cdc23
5 changed files with 26 additions and 9 deletions

View File

@ -12,12 +12,26 @@ This is a set of scripts for patching a Chrome OS RMA shim to serve as a bootloa
- ~~autostart X11~~ - ~~autostart X11~~
- ~~host repo for patched systemd packages~~ - ~~host repo for patched systemd packages~~
- ~~use debootstrap to install debian~~ - ~~use debootstrap to install debian~~
- prompt user for hostname and account when creating the rootfs - ~~prompt user for hostname and account when creating the rootfs~~
- auto load iwlmvm - auto load iwlmvm
- get wifi fully working
- host prebuilt images - host prebuilt images
- write detailed documentation - write detailed documentation
### Long Term Goals:
- get zram to work
- eliminate binwalk dependency
- get audio to work
## Usage: ## Usage:
### Prerequisites:
- A seperate Linux PC for the build process (preferably something Debian-based)
- A USB that is at least 8GB in size
- At least 20GB of free disk space
- An x86-based Chromebook
### Instructions:
1. Grab a Chrome OS RMA Shim from somewhere. Most of them have already been leaked and aren't too difficult to find. 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 Chrome OS [recovery image](https://chromiumdash.appspot.com/serving-builds?deviceCategory=ChromeOS) for your board. 2. Download a Chrome OS [recovery image](https://chromiumdash.appspot.com/serving-builds?deviceCategory=ChromeOS) for your board.
3. Clone this repository and cd into it. 3. Clone this repository and cd into it.

View File

@ -127,7 +127,7 @@ boot_target() {
mkdir -p /newroot/bootloader mkdir -p /newroot/bootloader
pivot_root /newroot /newroot/bootloader pivot_root /newroot /newroot/bootloader
local tty="/dev/pts/0" local tty="/dev/pts/0"
exec /sbin/init 5 < "$tty" >> "$tty" 2>&1 exec /sbin/init < "$tty" >> "$tty" 2>&1
} }
main() { main() {

View File

@ -15,7 +15,7 @@ print_help() {
} }
check_deps() { check_deps() {
local needed_commands="cpio binwalk pcregrep realpath cgpt mkfs.ext4 mkfs.ext2 fdisk" local needed_commands="cpio binwalk pcregrep realpath cgpt mkfs.ext4 mkfs.ext2 fdisk rsync"
for command in $needed_commands; do for command in $needed_commands; do
if ! command -v $command &> /dev/null; then if ! command -v $command &> /dev/null; then
echo $command echo $command
@ -89,9 +89,9 @@ patch_initramfs $initramfs_dir
echo "creating disk image" echo "creating disk image"
rootfs_size=$(du -sm $rootfs_dir | cut -f 1) rootfs_size=$(du -sm $rootfs_dir | cut -f 1)
rootfs_part_size=$(($rootfs_size * 11 / 10 + 50)) rootfs_part_size=$(($rootfs_size * 11 / 10))
#create a 20mb bootloader partition #create a 20mb bootloader partition
#rootfs partition is 10% larger than its contents #rootfs partition is 20% larger than its contents
create_image $output_path 20 $rootfs_part_size create_image $output_path 20 $rootfs_part_size
echo "creating loop device for the image" echo "creating loop device for the image"
@ -111,3 +111,4 @@ populate_partitions $image_loop $initramfs_dir $rootfs_dir
echo "cleaning up loop devices" echo "cleaning up loop devices"
losetup -d $shim_loop losetup -d $shim_loop
losetup -d $image_loop losetup -d $image_loop
echo "done"

View File

@ -66,7 +66,7 @@ partition_disk() {
#write changes #write changes
echo w echo w
) | fdisk $image_path ) | fdisk $image_path > /dev/null
} }
safe_mount() { safe_mount() {
@ -112,7 +112,7 @@ populate_partitions() {
#write rootfs to image #write rootfs to image
local rootfs_mount=/tmp/new_rootfs local rootfs_mount=/tmp/new_rootfs
safe_mount "${image_loop}p4" $rootfs_mount safe_mount "${image_loop}p4" $rootfs_mount
cp -r $rootfs_dir/* $rootfs_mount rsync --archive --human-readable --hard-links --info=progress2 --sparse $rootfs_dir/ $rootfs_mount/
umount $rootfs_mount umount $rootfs_mount
} }
@ -123,7 +123,8 @@ create_image() {
#stateful + kernel + bootloader + rootfs #stateful + kernel + bootloader + rootfs
local total_size=$((1 + 32 + $bootloader_size + $rootfs_size)) local total_size=$((1 + 32 + $bootloader_size + $rootfs_size))
dd if=/dev/zero of=$image_path bs=1M oflag=sync count=$total_size status=progress rm -rf "${image_path}"
fallocate -l "${total_size}M" "${image_path}"
partition_disk $image_path $bootloader_size partition_disk $image_path $bootloader_size
} }

View File

@ -0,0 +1 @@
iwlmvm