fix handling of compressed kernel modules

This commit is contained in:
ading2210 2024-04-29 00:53:01 -07:00
parent b26505849c
commit 8c522cd615
4 changed files with 28 additions and 39 deletions

View File

@ -22,49 +22,34 @@ Note that rootfs partitions have to be named `shimboot_rootfs:<partname>` for th
## Status: ## Status:
Driver support depends on the device you are using shimboot on. This list is for the [`dedede`](https://chrome100.dev/board/dedede/) board, which is the only device I was able to do extensive testing on. The `patch_rootfs.sh` script attempts to copy all the firmware from the shim and recovery image into the rootfs, so expect most things to work on other boards. Driver support depends on the device you are using shimboot on. This list is for the [`dedede`](https://chrome100.dev/board/dedede/) board, which is the only device I was able to do extensive testing on. The `patch_rootfs.sh` script attempts to copy all the firmware from the shim and recovery image into the rootfs, so expect most things to work on other boards.
### What Works: ### Device Compatibility Table:
- Booting Chrome OS | Feature \ Board Name | [`dedede`](https://chrome100.dev/board/dedede/) | [`octopus`](https://chrome100.dev/board/octopus/) | [`reks`](https://chrome100.dev/board/reks/) | [`nissa`](https://chrome100.dev/board/nissa/) |
- Systemd |----------------------|-------------------------------------------------|---------------------------------------------------|---------------------------------------------|-----------------------------------------------|
- X11 | X11 | yes | yes | no (kernel too old) | yes |
- XFCE | Wifi | yes | yes | yes | yes |
- Backlight | Internal Audio | no | yes | untested | no |
- Touchscreen | Backlight | yes | yes | untested | yes |
- 3D acceleration | Touchscreen | yes | yes | untested | yes |
- Bluetooth | 3D Acceleration | yes | yes | no | yes |
- Zram | Bluetooth | yes | yes | untested | yes |
- Wifi | Webcam | yes | yes | untested | yes |
- Booting a squashfs
- Webcam
### What Doesn't Work: This table is incomplete. If you want to contribute a device compatibility report please create a new issue on the Github repository.
- Audio (due to a firmware bug on `dedede`, this works just fine on `octopus`)
On all devices, the following features will not work:
- Suspend (disabled by the kernel) - Suspend (disabled by the kernel)
- Swap (disabled by the kernel) - Swap (disabled by the kernel)
### Development Roadmap: ### TODO:
- ~~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~~
- ~~load all needed drivers~~
- ~~autostart X11~~
- ~~host repo for patched systemd packages~~
- ~~use debootstrap to install debian~~
- ~~prompt user for hostname and account when creating the rootfs~~
- ~~auto load iwlmvm~~
- ~~get wifi fully working~~
- ~~host prebuilt images~~
- ~~write detailed documentation~~
- Finish Python TUI rewrite - Finish Python TUI rewrite
### Long Term Goals:
- Transparent disk compression - Transparent disk compression
- Full disk encryption - Full disk encryption
- eliminate binwalk dependency - eliminate binwalk dependency
- get audio to work - get audio to work
- get kexec working - get kexec working
PRs and contributions are welcome to help implement these features.
## Usage: ## Usage:
### Prerequisites: ### Prerequisites:
@ -88,7 +73,7 @@ Alternatively, you can run each of the steps manually:
7. Run `sudo ./build.sh image.bin path_to_shim data/rootfs` to generate a disk image at `image.bin`. 7. Run `sudo ./build.sh image.bin path_to_shim data/rootfs` to generate a disk image at `image.bin`.
### Booting the Image: ### Booting the Image:
1. Obtain a shimboot image by downloading a [prebuilt one](https://github.com/ading2210/shimboot/actions?query=branch%3Amain) or building it yourself. 1. Obtain a shimboot image by downloading a [prebuilt one](https://github.com/ading2210/shimboot/releases) or building it yourself.
2. Flash the shimboot image to a USB drive or SD card. Use the [Chromebook Recovery Utility](https://chrome.google.com/webstore/detail/chromebook-recovery-utili/pocpnlppkickgojjlmhdmidojbmbodfm) or [dd](https://linux.die.net/man/1/dd) if you're on Linux. 2. Flash the shimboot image to a USB drive or SD card. Use the [Chromebook Recovery Utility](https://chrome.google.com/webstore/detail/chromebook-recovery-utili/pocpnlppkickgojjlmhdmidojbmbodfm) or [dd](https://linux.die.net/man/1/dd) if you're on Linux.
3. Enable developer mode on your Chromebook. If the Chromebook is enrolled, follow the instructions on the [sh1mmer website](https://sh1mmer.me) (see the "Executing on Chromebook" section). 3. Enable developer mode on your Chromebook. If the Chromebook is enrolled, follow the instructions on the [sh1mmer website](https://sh1mmer.me) (see the "Executing on Chromebook" section).
4. Plug the USB into your Chromebook and enter recovery mode. It should detect the USB and run the shimboot bootloader. 4. Plug the USB into your Chromebook and enter recovery mode. It should detect the USB and run the shimboot bootloader.

View File

@ -80,7 +80,7 @@ move_mounts() {
print_license() { print_license() {
cat << EOF cat << EOF
Shimboot v1.0.0 Shimboot v1.0.1
ading2210/shimboot: Boot desktop Linux from a Chrome OS RMA shim. ading2210/shimboot: Boot desktop Linux from a Chrome OS RMA shim.
Copyright (C) 2023 ading2210 Copyright (C) 2023 ading2210

View File

@ -7,16 +7,16 @@ if [ "$DEBUG" ]; then
set -x set -x
fi fi
. ./common.sh
. ./image_utils.sh . ./image_utils.sh
print_help() { print_help() {
echo "Usage: ./patch_rootfs.sh shim_path reco_path rootfs_dir" echo "Usage: ./patch_rootfs.sh shim_path reco_path rootfs_dir"
} }
if [ "$EUID" -ne 0 ]; then assert_root
echo "this needs to be run as root." assert_deps "git gunzip"
exit 1 assert_args "$3"
fi
if [ -z "$3" ]; then if [ -z "$3" ]; then
print_help print_help
@ -39,6 +39,9 @@ copy_modules() {
mkdir -p "${target_rootfs}/etc/modprobe.d/" mkdir -p "${target_rootfs}/etc/modprobe.d/"
cp -r "${reco_rootfs}/lib/modprobe.d/"* "${target_rootfs}/lib/modprobe.d/" cp -r "${reco_rootfs}/lib/modprobe.d/"* "${target_rootfs}/lib/modprobe.d/"
cp -r "${reco_rootfs}/etc/modprobe.d/"* "${target_rootfs}/etc/modprobe.d/" cp -r "${reco_rootfs}/etc/modprobe.d/"* "${target_rootfs}/etc/modprobe.d/"
#decompress kernel modules if necessary - debian won't recognize these otherwise
find "${target_rootfs}/lib/modules" -name "*.gz" | xargs gunzip
} }
copy_firmware() { copy_firmware() {

View File

@ -68,7 +68,7 @@ Another problem is encountered at this stage: the Chrome OS kernel will complain
After copying all the firmware from the recovery image and shim to the rootfs, we're able to boot to a mostly working XFCE desktop. After copying all the firmware from the recovery image and shim to the rootfs, we're able to boot to a mostly working XFCE desktop.
<b id="prebuilt">Prebuilt Images:</b> <b id="prebuilt">Prebuilt Images:</b>
Prebuilt images are available <a href="https://github.com/ading2210/shimboot/actions">here</a>. If there is not a prebuilt image for your board, you must manually build the shimboot image. Prebuilt images are available <a href="https://github.com/ading2210/shimboot/releases">here</a>. If there is not a prebuilt image for your board, you must manually build the shimboot image.
For these images, the root password is "root". The name of the default user is "user" and its password is "user" as well. You should change these credentials as soon as possible. For these images, the root password is "root". The name of the default user is "user" and its password is "user" as well. You should change these credentials as soon as possible.
@ -92,6 +92,7 @@ Alternatively, you can run each of the steps manually:
4. Plug the USB into your Chromebook and enter recovery mode. It should detect the USB and run the shimboot bootloader. 4. Plug the USB into your Chromebook and enter recovery mode. It should detect the USB and run the shimboot bootloader.
5. Boot into Debian and log in with the username and password that you configured earlier. The default username/password for the prebuilt images is `user/user`. 5. Boot into Debian and log in with the username and password that you configured earlier. The default username/password for the prebuilt images is `user/user`.
6. Expand the rootfs partition so that it fills up the entire disk by running `sudo growpart /dev/sdX 4` (replacing `sdX` with the block device corresponding to your disk) to expand the partition, then running `sudo resize2fs /dev/sdX4` to expand the filesystem. 6. Expand the rootfs partition so that it fills up the entire disk by running `sudo growpart /dev/sdX 4` (replacing `sdX` with the block device corresponding to your disk) to expand the partition, then running `sudo resize2fs /dev/sdX4` to expand the filesystem.
7. Change the root password and regular user password by running `sudo passwd root` and `passwd user`.
<b id="copyright">Copyright:</b> <b id="copyright">Copyright:</b>
Shimboot is licensed under the <a href="https://www.gnu.org/licenses/gpl-3.0.txt">GNU GPL v3</a>. Unless otherwise indicated, all code has been written by me, <a href="https://ading.dev">ading2210</a>. Shimboot is licensed under the <a href="https://www.gnu.org/licenses/gpl-3.0.txt">GNU GPL v3</a>. Unless otherwise indicated, all code has been written by me, <a href="https://ading.dev">ading2210</a>.