Skip to content

Commit

Permalink
add arm support to other build scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
ading2210 committed Jun 12, 2024
1 parent 0b56369 commit f885473
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
7 changes: 5 additions & 2 deletions build_complete.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ print_help() {
echo " desktop - The desktop environment to install. This defaults to 'xfce'. Valid options include:"
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."
}

assert_root
Expand All @@ -23,6 +24,7 @@ rootfs_dir="${args['rootfs_dir']}"
quiet="${args['quiet']}"
desktop="${args['desktop']-'xfce'}"
data_dir="${args['data_dir']}"
arch="${args['arch']-'amd64'}"

needed_deps="wget python3 unzip zip git debootstrap cpio binwalk pcregrep cgpt mkfs.ext4 mkfs.ext2 fdisk rsync depmod findmnt"
if [ "$(check_deps "$needed_deps")" ]; then
Expand Down Expand Up @@ -130,7 +132,8 @@ if [ ! "$rootfs_dir" ]; then
custom_packages=$desktop_package \
hostname=shimboot-$board \
username=user \
user_passwd=user
user_passwd=user \
arch=$arch
fi

echo "patching debian rootfs"
Expand All @@ -139,7 +142,7 @@ retry_cmd ./patch_rootfs.sh $shim_bin $reco_bin $rootfs_dir "quiet=$quiet"
echo "building final disk image"
final_image="$data_dir/shimboot_$board.bin"
rm -rf $final_image
retry_cmd ./build.sh $final_image $shim_bin $rootfs_dir "quiet=$quiet"
retry_cmd ./build.sh $final_image $shim_bin $rootfs_dir "quiet=$quiet" "arch=$arch"
echo "build complete! the final disk image is located at $final_image"

echo "cleaning up"
Expand Down
7 changes: 5 additions & 2 deletions build_rootfs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ print_help() {
echo " username - The unprivileged user name for the new rootfs."
echo " user_passwd - The password for the unprivileged user."
echo " disable_base - Disable the base packages such as zram, cloud-utils, and command-not-found."
echo " arch - The CPU architecture to build the rootfs for."
echo "If you do not specify the hostname and credentials, you will be prompted for them later."
}

Expand All @@ -30,6 +31,7 @@ parse_args "$@"
rootfs_dir=$(realpath -m "${1}")
release_name="${2}"
packages="${args['custom_packages']-'task-xfce-desktop'}"
arch="${args['arch']-'amd64'}"
chroot_mounts="proc sys dev run"

mkdir -p $rootfs_dir
Expand All @@ -56,7 +58,7 @@ if [ "$(need_remount "$rootfs_dir")" ]; then
do_remount "$rootfs_dir"
fi

debootstrap --arch amd64 $release_name $rootfs_dir http://deb.debian.org/debian/
debootstrap --arch $arch $release_name $rootfs_dir http://deb.debian.org/debian/
cp -ar rootfs/* $rootfs_dir
cp /etc/resolv.conf $rootfs_dir/etc/resolv.conf

Expand All @@ -75,7 +77,8 @@ disable_base="${args['disable_base']}"
chroot_command="/opt/setup_rootfs.sh \
'$DEBUG' '$release_name' '$packages' \
'$hostname' '$root_passwd' '$username' \
'$user_passwd' '$enable_root' '$disable_base'"
'$user_passwd' '$enable_root' '$disable_base' \
'$arch'"

LC_ALL=C chroot $rootfs_dir /bin/bash -c "${chroot_command}"

Expand Down
4 changes: 3 additions & 1 deletion rootfs/opt/setup_rootfs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@ username="$6"
user_passwd="$7"
enable_root="$8"
disable_base_pkgs="$9"
arch="${10}"

custom_repo="https://shimboot.ading.dev/debian"
custom_repo_domain="shimboot.ading.dev"
sources_entry="deb [trusted=yes arch=amd64] ${custom_repo} ${release_name} main"
sources_entry="deb [trusted=yes arch=$arch] ${custom_repo} ${release_name} main"

export DEBIAN_FRONTEND="noninteractive"

Expand All @@ -37,6 +38,7 @@ END
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

#enable shimboot services
Expand Down

0 comments on commit f885473

Please sign in to comment.