Skip to content

Commit

Permalink
update docs and check for invalid board names
Browse files Browse the repository at this point in the history
  • Loading branch information
ading2210 committed Aug 23, 2024
1 parent eb5408e commit b70b054
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 5 deletions.
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,19 @@ Note: If you are building for an ARM Chromebook, you need the `qemu-user-static`
#### 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`.

Here is a list of distros that are supported out of the box:
- Debian 12
- Debian Unstable
- Alpine Linux

PRs to enable support for other distros are welcome.

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_complete.sh dedede release=unstable
```

There is also experimental support for Alpine Linux. The Alpine disk image is about half the size compared to Debian. Pass the `distro=alpine` to use it:
There is also experimental support for Alpine Linux. The Alpine disk image is about half the size compared to Debian, although some applications are missing. Pass the `distro=alpine` to use it:
```bash
sudo ./build_complete.sh dedede distro=alpine
```
Expand Down
25 changes: 21 additions & 4 deletions build_complete.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ print_help() {
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."
echo " distro - The Linux distro to use. This should be either 'debian' or 'alpine'."
echo " distro - The Linux distro to use. This should be either 'debian', 'ubuntu', or 'alpine'."
}

assert_root
Expand Down Expand Up @@ -79,7 +79,12 @@ reco_url="$(wget -qO- --show-progress $boards_url | python3 -c '
import json, sys
all_builds = json.load(sys.stdin)
board = all_builds["builds"][sys.argv[1]]
board_name = sys.argv[1]
if not board_name in all_builds["builds"]:
print("Invalid board name: " + board_name, file=sys.stderr)
sys.exit(1)
board = all_builds["builds"][board_name]
if "models" in board:
for device in board["models"].values():
if device["pushRecoveries"]:
Expand Down Expand Up @@ -149,14 +154,26 @@ if [ ! "$rootfs_dir" ]; then
if [ "$distro" = "debian" ]; then
release="${release:-bookworm}"
elif [ "$distro" = "ubuntu" ]; then
release="${release:-jammy}"
release="${release:-noble}"
elif [ "$distro" = "alpine" ]; then
release="${release:-latest-stable}"
release="${release:-edge}"
else
print_error "invalid distro selection"
exit 1
fi

#install a newer debootstrap version if needed
if [ -f "/etc/debian_version" ] && [ "$distro" = "ubuntu" -o "$distro" = "debian" ]; then
if [ ! -f "/usr/share/debootstrap/scripts/$release" ]; then
print_info "installing newer debootstrap version"
mirror_url="https://deb.debian.org/debian/pool/main/d/debootstrap/"
deb_file="$(curl "https://deb.debian.org/debian/pool/main/d/debootstrap/" | pcregrep -o1 'href="(debootstrap_.+?\.deb)"' | tail -n1)"
deb_url="${mirror_url}${deb_file}"
wget -q --show-progress "$deb_url" -O "/tmp/$deb_file"
apt-get install -y "/tmp/$deb_file"
fi
fi

./build_rootfs.sh $rootfs_dir $release \
custom_packages=$desktop_package \
hostname=shimboot-$board \
Expand Down

0 comments on commit b70b054

Please sign in to comment.