add arm support to other build scripts

This commit is contained in:
ading2210 2024-06-11 22:27:19 -07:00
parent 0b56369b5d
commit f885473488
3 changed files with 13 additions and 5 deletions

View File

@ -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
@ -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
@ -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"
@ -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"

View File

@ -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."
}
@ -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
@ -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
@ -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}"

View File

@ -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"
@ -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