diff --git a/README.md b/README.md index 829aaf4..1bd88e2 100644 --- a/README.md +++ b/README.md @@ -38,17 +38,17 @@ Note that rootfs partitions have to be named `shimboot_rootfs:` for th Driver support depends on the device you are using shimboot on. The `patch_rootfs.sh` script attempts to copy all the firmware and drivers from the shim and recovery image into the rootfs, so expect most things to work on other boards. ARM Chromebooks are not supported at the moment. ### Device Compatibility Table: -| Board Name | X11 | Wi-Fi | Speakers | Backlight | Touchscreen | 3D Accel | Bluetooth | Webcam | -|----------------------------------------------------|-------------------|-------|----------|-----------|-------------|----------|-----------|----------| -| [**dedede**](https://chrome100.dev/board/dedede) | yes | yes | no | yes | yes | yes | yes | yes | -| [**octopus**](https://chrome100.dev/board/octopus) | yes | yes | yes | yes | yes | yes | yes | yes | -| [**nissa**](https://chrome100.dev/board/nissa) | yes | yes | no | yes | yes | yes | yes | yes | -| [**reks**](https://chrome100.dev/board/reks) | no [1] | yes | untested | untested | untested | no | untested | untested | -| [**kefka**](https://chrome100.dev/board/kefka) | no [1] | yes | yes | yes | untested | no | untested | untested | -| [**zork**](https://chrome100.dev/board/zork) | yes | yes | no | untested | yes | yes | yes | yes | -| [**grunt**](https://chrome100.dev/board/grunt) | yes | yes | no | yes | yes | yes | yes | yes | -| [**jacuzzi**](https://chrome100.dev/board/jacuzzi) | yes | yes | no | yes | untested | no | no | yes | -| [**corsola**](https://chrome100.dev/board/corsola) | yes | yes | untested | untested | untested | untested | untested | untested | +| Board Name | X11 | Wifi | Speakers | Backlight | Touchscreen | 3D Accel | Bluetooth | Webcam | +|------------------------------------------------ |-------------------|------|----------|-----------|-------------|----------|-----------|----------| +| [`dedede`](https://chrome100.dev/board/dedede) | yes | yes | no | yes | yes | yes | yes | yes | +| [`octopus`](https://chrome100.dev/board/octopus) | yes | yes | yes | yes | yes | yes | yes | yes | +| [`nissa`](https://chrome100.dev/board/nissa) | yes | yes | no | yes | yes | yes | yes | yes | +| [`reks`](https://chrome100.dev/board/reks) | no[1] | yes | untested | untested | untested | no | untested | untested | +| [`kefka`](https://chrome100.dev/board/kefka) | no[1] | yes | yes | yes | untested | no | untested | untested | +| [`zork`](https://chrome100.dev/board/zork) | yes | yes | no | untested | yes | yes | yes | yes | +| [`grunt`](https://chrome100.dev/board/grunt) | yes | yes | no | yes | yes | yes | yes | yes | +| [`jacuzzi`](https://chrome100.dev/board/jacuzzi) | yes | yes | no | yes | untested | no | no | yes | +| [`corsola`](https://chrome100.dev/board/corsola) | yes | yes | untested | untested | untested | untested | untested | untested | 1. The kernel is too old. @@ -85,10 +85,12 @@ PRs and contributions are welcome to help implement these features. ### Build Instructions: 1. Find the board name of your Chromebook. You can search for the model name on [chrome100.dev](https://chrome100.dev/). -1. Clone this repository and cd into it. -2. Run `sudo ./build_complete.sh ` to download the required data and build the disk image. If you have an ARM-based Chromebook, pass `arch=arm64` in as an option. +2. Clone this repository and cd into it. +3. Run `sudo ./build_complete.sh ` to download the required data and build the disk image. -Alternatively, you can run each of the steps manually: +Note: If you are building for an ARM Chromebook, you need the `qemu-user-static` and `binfmt-support` packages. + +#### Alternatively, you can run each of the steps manually: 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. Unzip the shim and the recovery image if you have not done so already. @@ -113,10 +115,11 @@ Alternatively, you can run each of the steps manually: #### I want to use a different Linux distribution. How can I do that? Using any Linux distro is possible, provided that you apply the [proper patches](https://github.com/ading2210/chromeos-systemd) to systemd and recompile it. Most distros have some sort of bootstrapping tool that allows you to install it to a directory on your host PC. Then, you can just pass that rootfs directory into `patch_rootfs.sh` and `build.sh`. -Debian Sid (the rolling release version of Debian) is also supported if you just want newer packages, and you can install it by passing an argument to `build_rootfs.sh`: +Debian Sid (the rolling release version of Debian) is also supported if you just want newer packages, and you can install it by passing an argument to `build_complete.sh`: ```bash -sudo ./build_rootfs.sh data/rootfs unstable +sudo ./build_complete.sh dedede release=unstable ``` + #### How can I install a desktop environment other than XFCE? You can pass the `desktop` argument to the `build_complete.sh` script, like this: ```bash @@ -138,7 +141,7 @@ sudo resize2fs /dev/mmcblk1p4 #### GPU acceleration isn't working, how can I fix this? If your kernel version is too old, the standard Mesa drivers will fail to load. Instead, you must download and install the `mesa-amber` drivers. Run the following commands: -``` +```bash sudo apt install libglx-amber0 libegl-amber0 echo "MESA_LOADER_DRIVER_OVERRIDE=i965" | sudo tee -a /etc/environment ``` diff --git a/build.sh b/build.sh index 053544f..d1f7ab3 100755 --- a/build.sh +++ b/build.sh @@ -14,7 +14,7 @@ print_help() { } assert_root -assert_deps "cpio binwalk pcregrep realpath cgpt mkfs.ext4 mkfs.ext2 fdisk rsync lz4" +assert_deps "cpio binwalk pcregrep realpath cgpt mkfs.ext4 mkfs.ext2 fdisk lz4" assert_args "$3" parse_args "$@" diff --git a/build_complete.sh b/build_complete.sh index a3df095..5349ca3 100755 --- a/build_complete.sh +++ b/build_complete.sh @@ -13,6 +13,7 @@ print_help() { echo " gnome, xfce, kde, lxde, gnome-flashback, cinnamon, mate, lxqt" echo " data_dir - The working directory for the scripts. This defaults to ./data" echo " arch - The CPU architecture to build the shimboot image for. Set this to 'arm64' if you have an ARM Chromebook." + echo " release - Set this to either 'bookworm' or 'unstable' to build for Debian stable/unstable." } assert_root @@ -28,6 +29,7 @@ quiet="${args['quiet']}" desktop="${args['desktop']-'xfce'}" data_dir="${args['data_dir']}" arch="${args['arch']-amd64}" +release="${args['release']-bookworm}" arm_boards=" corsola hana jacuzzi kukui strongbad nyan-big kevin bob @@ -39,12 +41,12 @@ if grep -q "$board" <<< "$arm_boards"; then arch="arm64" fi -needed_deps="wget python3 unzip zip git debootstrap cpio binwalk pcregrep cgpt mkfs.ext4 mkfs.ext2 fdisk rsync depmod findmnt lz4" +needed_deps="wget python3 unzip zip git debootstrap cpio binwalk pcregrep cgpt mkfs.ext4 mkfs.ext2 fdisk depmod findmnt lz4 pv" if [ "$(check_deps "$needed_deps")" ]; then #install deps automatically on debian and ubuntu if [ -f "/etc/debian_version" ]; then echo "attempting to install build deps" - apt-get install wget python3-all unzip zip debootstrap cpio binwalk pcregrep cgpt rsync kmod pv lz4 -y + apt-get install wget python3-all unzip zip debootstrap cpio binwalk pcregrep cgpt kmod pv lz4 -y if [ "$arch" = "arm64" ]; then apt-get install qemu-user-static binfmt-support -y fi @@ -142,7 +144,7 @@ if [ ! "$rootfs_dir" ]; then mkdir -p $rootfs_dir echo "building debian rootfs" - ./build_rootfs.sh $rootfs_dir bookworm \ + ./build_rootfs.sh $rootfs_dir $release \ custom_packages=$desktop_package \ hostname=shimboot-$board \ username=user \ diff --git a/image_utils.sh b/image_utils.sh index 779b3e2..d7b7222 100755 --- a/image_utils.sh +++ b/image_utils.sh @@ -119,9 +119,9 @@ populate_partitions() { local rootfs_mount=/tmp/new_rootfs safe_mount "${image_loop}p4" $rootfs_mount if [ "$quiet" ]; then - rsync --archive --human-readable --hard-links --quiet --sparse $rootfs_dir/ $rootfs_mount/ + cp -ar $rootfs_dir/* $rootfs_mount else - rsync --archive --human-readable --hard-links --info=progress2 --sparse $rootfs_dir/ $rootfs_mount/ + copy_progress $rootfs_dir $rootfs_mount fi umount $rootfs_mount } @@ -155,8 +155,14 @@ clean_loops() { local mountpoints="$(cat /proc/mounts | grep "$loop_device")" if [ ! "$mountpoints" ]; then losetup -d $loop_device - else - echo "warning: not removing $loop_device because it is still mounted" fi done -} \ No newline at end of file +} + +copy_progress() { + local source="$1" + local destination="$2" + local total_bytes="$(du -sb "$source" | cut -f1)" + mkdir -p "$destination" + tar -cf - -C "${source}" . | pv -f -s $total_bytes | tar -xf - -C "${destination}" +} diff --git a/rootfs/opt/setup_rootfs.sh b/rootfs/opt/setup_rootfs.sh index fc2633d..d782e1b 100755 --- a/rootfs/opt/setup_rootfs.sh +++ b/rootfs/opt/setup_rootfs.sh @@ -39,7 +39,7 @@ apt-get install -y ca-certificates apt-get update installed_systemd="$(dpkg-query -W -f='${binary:Package}\n' | grep "systemd")" apt-get clean -apt-get install --reinstall $installed_systemd +apt-get install -y --reinstall --allow-downgrades $installed_systemd #enable shimboot services systemctl enable kill-frecon.service