Skip to content

Commit a335b5e

Browse files
committed
build: use 64bit RaspiOS image
Signed-off-by: nachoparker <[email protected]>
1 parent 9215669 commit a335b5e

File tree

3 files changed

+16
-19
lines changed

3 files changed

+16
-19
lines changed

bin/ncp-update-nc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ cleanup() {
7777
trap "" EXIT
7878
exit $RET
7979
}
80-
trap cleanup EXIT
80+
trap cleanup EXIT
8181

8282
# get new code
8383
####################

build-SD-rpi.sh

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
set -e
1212
source buildlib.sh
1313

14+
URL="https://downloads.raspberrypi.org/raspios_lite_arm64/images/raspios_lite_arm64-2020-08-24/2020-08-20-raspios-buster-arm64-lite.zip"
1415
SIZE=3G # Raspbian image size
1516
#CLEAN=0 # Pass this envvar to skip cleaning download cache
1617
IMG="NextCloudPi_RPi_$( date "+%m-%d-%y" ).img"
@@ -27,7 +28,7 @@ IMG=tmp/"$IMG"
2728

2829
trap clean_chroot_raspbian EXIT
2930
prepare_dirs # tmp cache output
30-
download_raspbian "$IMG"
31+
download_raspbian "$URL" "$IMG"
3132
resize_image "$IMG" "$SIZE"
3233
update_boot_uuid "$IMG" # PARTUUID has changed after resize
3334

@@ -46,9 +47,6 @@ PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \
4647
sudo chroot raspbian_root /bin/bash <<'EOFCHROOT'
4748
set -e
4849
49-
# avoid constant annoying spam due to qemu bug - ERROR: ld.so: object '/usr/lib/arm-linux-gnueabihf/libarmmem-${PLATFORM}.so' from /etc/ld.so.preload
50-
mv /etc/ld.so.preload /
51-
5250
# mark the image as an image build
5351
touch /.ncp-image
5452
@@ -93,8 +91,6 @@ PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \
9391
echo "$cfg" > /usr/local/etc/ncp-config.d/SSH.cfg
9492
9593
rm -rf /tmp/ncp-build
96-
97-
mv /ld.so.preload /etc
9894
EOFCHROOT
9995

10096
trap '' EXIT

buildlib.sh

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ function launch_install_qemu()
2323
IMGOUT="$IMG-$( date +%s )"
2424
cp --reflink=auto -v "$IMG" "$IMGOUT" || return 1
2525

26-
pgrep qemu-system-arm &>/dev/null && { echo -e "QEMU instance already running. Abort..."; return 1; }
26+
pgrep qemu-system-aarch64 &>/dev/null && { echo -e "QEMU instance already running. Abort..."; return 1; }
2727
launch_qemu "$IMGOUT" &
2828
sleep 10
2929
wait_SSH "$IP"
@@ -135,7 +135,7 @@ function mount_raspbian()
135135
local OFFSET=$(( SECTOR * 512 ))
136136
mkdir -p "$MP"
137137
sudo mount $IMG -o offset=$OFFSET "$MP" || return 1
138-
echo "Raspbian image mounted"
138+
echo "RaspiOS image mounted"
139139
}
140140

141141
function mount_raspbian_boot()
@@ -150,15 +150,15 @@ function mount_raspbian_boot()
150150
local OFFSET=$(( SECTOR * 512 ))
151151
mkdir -p "$MP"
152152
sudo mount $IMG -o offset=$OFFSET "$MP" || return 1
153-
echo "Raspbian image mounted"
153+
echo "RaspiOS image mounted"
154154
}
155155

156156
function umount_raspbian()
157157
{
158158
[[ -d raspbian_root ]] || [[ -d raspbian_boot ]] || { echo "Nothing to umount"; return 0; }
159159
[[ -d raspbian_root ]] && { sudo umount -l raspbian_root; rmdir raspbian_root || return 1; }
160160
[[ -d raspbian_boot ]] && { sudo umount -l raspbian_boot; rmdir raspbian_boot || return 1; }
161-
echo "Raspbian image umounted"
161+
echo "RaspiOS image umounted"
162162
}
163163

164164
function prepare_chroot_raspbian()
@@ -170,7 +170,7 @@ function prepare_chroot_raspbian()
170170
sudo mount -o bind /dev raspbian_root/dev/
171171
sudo mount -o bind /dev/pts raspbian_root/dev/pts
172172

173-
sudo cp /usr/bin/qemu-arm-static raspbian_root/usr/bin
173+
sudo cp /usr/bin/qemu-aarch64-static raspbian_root/usr/bin
174174

175175
# Prevent services from auto-starting
176176
sudo bash -c "echo -e '#!/bin/sh\nexit 101' > raspbian_root/usr/sbin/policy-rc.d"
@@ -179,7 +179,7 @@ function prepare_chroot_raspbian()
179179

180180
function clean_chroot_raspbian()
181181
{
182-
sudo rm -f raspbian_root/usr/bin/qemu-arm-static
182+
sudo rm -f raspbian_root/usr/bin/qemu-aarch64-static
183183
sudo rm -f raspbian_root/usr/sbin/policy-rc.d
184184
sudo umount -l raspbian_root/{proc,sys,dev/pts,dev}
185185
umount_raspbian
@@ -268,11 +268,12 @@ function deactivate_unattended_upgrades()
268268

269269
function download_raspbian()
270270
{
271-
local IMGFILE=$1
272-
local IMG_CACHE=cache/raspbian_lite.img
273-
local ZIP_CACHE=cache/raspbian_lite.zip
271+
local URL=$1
272+
local IMGFILE=$2
273+
local IMG_CACHE=cache/raspios_lite.img
274+
local ZIP_CACHE=cache/raspios_lite.zip
274275

275-
echo -e "\n\e[1m[ Download Raspbian ]\e[0m"
276+
echo -e "\n\e[1m[ Download RaspiOS ]\e[0m"
276277
mkdir -p cache
277278
test -f $IMG_CACHE && \
278279
echo -e "INFO: $IMG_CACHE already exists. Skipping download ..." && \
@@ -282,11 +283,11 @@ function download_raspbian()
282283
test -f "$ZIP_CACHE" && {
283284
echo -e "INFO: $ZIP_CACHE already exists. Skipping download ..."
284285
} || {
285-
wget https://downloads.raspberrypi.org/raspbian_lite_latest -O "$ZIP_CACHE" || return 1
286+
wget "$URL" -O "$ZIP_CACHE" || return 1
286287
}
287288

288289
unzip -o "$ZIP_CACHE" && \
289-
mv *-raspbian-*.img $IMG_CACHE && \
290+
mv *-raspios-*.img $IMG_CACHE && \
290291
cp -v --reflink=auto $IMG_CACHE "$IMGFILE"
291292
}
292293

0 commit comments

Comments
 (0)