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~~
- ~~host repo for patched systemd packages~~
- ~~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
- get wifi fully working
- host prebuilt images
- write detailed documentation
### Long Term Goals:
- get zram to work
- eliminate binwalk dependency
- get audio to work
## 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.
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.

View File

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

View File

@ -15,7 +15,7 @@ print_help() {
}
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
if ! command -v $command &> /dev/null; then
echo $command
@ -89,9 +89,9 @@ patch_initramfs $initramfs_dir
echo "creating disk image"
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
#rootfs partition is 10% larger than its contents
#rootfs partition is 20% larger than its contents
create_image $output_path 20 $rootfs_part_size
echo "creating loop device for the image"
@ -110,4 +110,5 @@ populate_partitions $image_loop $initramfs_dir $rootfs_dir
echo "cleaning up loop devices"
losetup -d $shim_loop
losetup -d $image_loop
losetup -d $image_loop
echo "done"

View File

@ -66,7 +66,7 @@ partition_disk() {
#write changes
echo w
) | fdisk $image_path
) | fdisk $image_path > /dev/null
}
safe_mount() {
@ -112,7 +112,7 @@ populate_partitions() {
#write rootfs to image
local rootfs_mount=/tmp/new_rootfs
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
}
@ -123,7 +123,8 @@ create_image() {
#stateful + kernel + bootloader + rootfs
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
}

View File

@ -0,0 +1 @@
iwlmvm