diff --git a/README.md b/README.md index 74a57bd..27fab17 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ This is a set of scripts for patching a Chrome OS RMA shim to serve as a bootloa - ~~host repo for patched systemd packages~~ - ~~use debootstrap to install debian~~ - ~~prompt user for hostname and account when creating the rootfs~~ -- auto load iwlmvm +- ~~auto load iwlmvm~~ - get wifi fully working - host prebuilt images - write detailed documentation @@ -26,7 +26,7 @@ This is a set of scripts for patching a Chrome OS RMA shim to serve as a bootloa ## Usage: ### Prerequisites: -- A seperate Linux PC for the build process (preferably something Debian-based) +- A separate 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 @@ -35,7 +35,7 @@ This is a set of scripts for patching a Chrome OS RMA shim to serve as a bootloa 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. -4. Run `mkdir -P data/rootfs` to make a directory for the rootfs. +4. Run `mkdir -p data/rootfs` to make a directory for the rootfs. 5. Run `sudo ./build_rootfs.sh data/rootfs bookworm` to build the base rootfs. 6. Run `sudo ./patch_rootfs.sh path_to_shim path_to_reco data/rootfs` to patch the base rootfs and add any needed drivers. 7. Run `sudo ./build.sh image.bin path_to_shim data/rootfs` to generate a disk image at `image.bin`. diff --git a/build.sh b/build.sh old mode 100755 new mode 100644 diff --git a/build_image.sh b/build_image.sh old mode 100755 new mode 100644 index a5c32aa..9ff6fd0 --- a/build_image.sh +++ b/build_image.sh @@ -127,13 +127,4 @@ create_image() { fallocate -l "${total_size}M" "${image_path}" partition_disk $image_path $bootloader_size -} - -#for testing only -if [ $0 == "./build_image.sh" ]; then - create_image ./test.bin 20 200 - image_loop=$(create_loop ./test.bin) - create_partitions $image_loop /tmp/shim_kernel/kernel.bin - populate_partitions $image_loop ./tmp/shim_initramfs ./lib - losetup -d $image_loop -fi \ No newline at end of file +} \ No newline at end of file diff --git a/build_rootfs.sh b/build_rootfs.sh old mode 100755 new mode 100644 index 4cc631f..49ee94c --- a/build_rootfs.sh +++ b/build_rootfs.sh @@ -43,7 +43,18 @@ release_name="${2}" debootstrap $release_name $rootfs_dir http://deb.debian.org/debian/ cp -r rootfs/* $rootfs_dir + +chroot_mounts="proc sys dev run" +for mountpoint in $chroot_mounts; do + mount --make-rslave --rbind "/${mountpoint}" "${rootfs_dir}/$mountpoint" +done + chroot_command="DEBUG=${DEBUG} release_name=${release_name} /opt/setup_rootfs.sh" chroot $rootfs_dir /bin/bash -c "${chroot_command}" +chroot_mounts="proc sys dev run" +for mountpoint in $chroot_mounts; do + umount "${rootfs_dir}/$mountpoint" +done + echo "rootfs has been created" \ No newline at end of file diff --git a/patch_initramfs.sh b/patch_initramfs.sh old mode 100755 new mode 100644 diff --git a/patch_rootfs.sh b/patch_rootfs.sh old mode 100755 new mode 100644 index 4531521..28e3f76 --- a/patch_rootfs.sh +++ b/patch_rootfs.sh @@ -43,7 +43,7 @@ copy_firmware() { download_firmware $firmware_path fi - cp -r --remove-destination "${firmware_path}/"* "${target_rootfs}/lib/modules/" + cp -r --remove-destination "${firmware_path}/"* "${target_rootfs}/lib/firmware/" } download_firmware() { diff --git a/rootfs/opt/setup_rootfs.sh b/rootfs/opt/setup_rootfs.sh old mode 100755 new mode 100644 index 1b6820e..0f0b981 --- a/rootfs/opt/setup_rootfs.sh +++ b/rootfs/opt/setup_rootfs.sh @@ -28,10 +28,26 @@ apt-get upgrade -y #install desktop apt-get install -y xfce4 xfce4-goodies network-manager blueman firefox-esr sudo +#set up hostname and username +read -p "Enter the hostname for the system: " hostname +echo "${hostname}" > /etc/hostname +tee -a /etc/hosts << END +127.0.0.1 localhost +127.0.1.1 ${hostname} + +# The following lines are desirable for IPv6 capable hosts +::1 localhost ip6-localhost ip6-loopback +ff02::1 ip6-allnodes +ff02::2 ip6-allrouters +END + echo "Enter a root password:" passwd root read -p "Enter the username for the user account: " username useradd -m -s /bin/bash -G sudo $username echo "Enter the password for ${username}:" -passwd $username \ No newline at end of file +passwd $username + +#clean apt caches +apt-get clean \ No newline at end of file