Skip to content

Commit 388993e

Browse files
CameronNemoJohnnynator
authored andcommitted
Add Rock64 support
1 parent 727abdd commit 388993e

3 files changed

Lines changed: 49 additions & 21 deletions

File tree

lib.sh.in

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,7 @@ set_target_arch_from_platform() {
297297
GCP*) XBPS_TARGET_ARCH="x86_64";;
298298
pinebookpro*) XBPS_TARGET_ARCH="aarch64";;
299299
pinephone*) XBPS_TARGET_ARCH="aarch64";;
300+
rock64*) XBPS_TARGET_ARCH="aarch64";;
300301
*) die "$PROGNAME: Unable to compute target architecture from platform";;
301302
esac
302303

@@ -319,6 +320,13 @@ set_cachedir() {
319320
: "${XBPS_CACHEDIR:=--cachedir=$PWD/xbps-cache/${XBPS_TARGET_ARCH}}"
320321
}
321322

323+
rk33xx_flash_uboot() {
324+
local dir="$1"
325+
local dev="$2"
326+
dd if="${dir}/idbloader.img" of="${dev}" seek=64 conv=notrunc,fsync >/dev/null 2>&1
327+
dd if="${dir}/u-boot.itb" of="${dev}" seek=16384 conv=notrunc,fsync >/dev/null 2>&1
328+
}
329+
322330
# These should all resolve even if they won't have the appropriate
323331
# repodata files for the selected architecture.
324332
: "${XBPS_REPOSITORY:=--repository=http://alpha.de.repo.voidlinux.org/current \

mkimage.sh.in

Lines changed: 39 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -117,14 +117,14 @@ PLATFORM="${PLATFORM%-PLATFORMFS*}"
117117

118118
# Be absolutely certain the platform is supported before continuing
119119
case "$PLATFORM" in
120-
bananapi|beaglebone|cubieboard2|cubietruck|odroid-c2|odroid-u2|rpi|rpi2|rpi3|rpi4|GCP|pinebookpro|pinephone|*-musl);;
120+
bananapi|beaglebone|cubieboard2|cubietruck|odroid-c2|odroid-u2|rpi|rpi2|rpi3|rpi4|GCP|pinebookpro|pinephone|rock64|*-musl);;
121121
*) die "The $PLATFORM is not supported, exiting..."
122122
esac
123123

124-
# Default for bigger boot partion on pinebookpro since it needs to fit
125-
# at least 2 Kernels + initramfs
124+
# Default for bigger boot partion on rk33xx devices since it needs to
125+
# fit at least 2 Kernels + initramfs
126126
case "$PLATFORM" in
127-
pinebookpro*)
127+
pinebookpro*|rock64*)
128128
: "${BOOT_FSSIZE:=256MiB}"
129129
;;
130130
esac
@@ -172,17 +172,6 @@ if [ "$BOOT_FSTYPE" = "vfat" ]; then
172172
_args="-I -F16"
173173
fi
174174

175-
BOOT_START=2048
176-
ROOT_START=
177-
case "$PLATFORM" in
178-
pinebookpro*)
179-
BOOT_START=32768
180-
# Without this, sfdisk creates root partition starting at
181-
# 2048, overlapping u-boot reserved space and boot partition.
182-
ROOT_START=$BOOT_START
183-
;;
184-
esac
185-
186175
case "$PLATFORM" in
187176
cubieboard2|cubietruck|ci20*|odroid-c2*)
188177
# These platforms use a single partition for the entire filesystem.
@@ -200,11 +189,26 @@ _EOF
200189
# partition (64M by default) and the rest of the space as the
201190
# root filesystem. This is the generally preferred disk
202191
# layout for new platforms.
203-
sfdisk "${FILENAME}" <<_EOF
192+
case "$PLATFORM" in
193+
pinebookpro*|rock64*)
194+
# rk33xx devices use GPT and need more space reserved
195+
sfdisk "$FILENAME" <<_EOF
196+
label: gpt
197+
unit: sectors
198+
first-lba: 32768
199+
name=BootFS, size=${BOOT_FSSIZE}, type=L, bootable
200+
name=RootFS, type=L
201+
_EOF
202+
;;
203+
*)
204+
# The rest use MBR and need less space reserved
205+
sfdisk "${FILENAME}" <<_EOF
204206
label: dos
205-
${BOOT_START},${BOOT_FSSIZE},b,*
206-
${ROOT_START},+,L
207+
2048,${BOOT_FSSIZE},b,*
208+
,+,L
207209
_EOF
210+
;;
211+
esac
208212
LOOPDEV=$(losetup --show --find --partscan "$FILENAME")
209213
# Normally we need to quote to prevent argument splitting, but
210214
# we explicitly want argument splitting here.
@@ -298,9 +302,24 @@ ci20*)
298302
dd if="${ROOTFS}/boot/u-boot-spl.bin" of="${LOOPDEV}" obs=512 seek=1 >/dev/null 2>&1
299303
dd if="${ROOTFS}/boot/u-boot.img" of="${LOOPDEV}" obs=1K seek=14 >/dev/null 2>&1
300304
;;
305+
rock64*)
306+
rk33xx_flash_uboot "${ROOTFS}/usr/lib/rock64-uboot" "$LOOPDEV"
307+
# populate the extlinux.conf file
308+
cat >"${ROOTFS}/etc/default/extlinux" <<_EOF
309+
TIMEOUT=10
310+
# Defaults to current kernel cmdline if left empty
311+
CMDLINE="panic=10 coherent_pool=1M console=ttyS2,1500000 root=UUID=${ROOT_UUID} rw"
312+
# set this to use a DEVICETREEDIR line in place of an FDT line
313+
USE_DEVICETREEDIR="yes"
314+
# relative dtb path supplied to FDT line, as long as above is unset
315+
DTBPATH=""
316+
_EOF
317+
mkdir -p "${ROOTFS}/boot/extlinux"
318+
run_cmd_chroot "${ROOTFS}" "/etc/kernel.d/post-install/60-extlinux"
319+
cleanup_chroot
320+
;;
301321
pinebookpro*)
302-
dd if="${ROOTFS}/usr/lib/pinebookpro-uboot/idbloader.img" of="${LOOPDEV}" seek=64 conv=notrunc,fsync >/dev/null 2>&1
303-
dd if="${ROOTFS}/usr/lib/pinebookpro-uboot/u-boot.itb" of="${LOOPDEV}" seek=16384 conv=notrunc,fsync >/dev/null 2>&1
322+
rk33xx_flash_uboot "${ROOTFS}/usr/lib/pinebookpro-uboot" "$LOOPDEV"
304323
run_cmd_chroot "${ROOTFS}" "xbps-reconfigure -f pinebookpro-kernel"
305324
cleanup_chroot
306325
;;

mkplatformfs.sh.in

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ Usage: $PROGNAME [options] <platform> <base-tarball>
5151
Supported platforms: i686, x86_64, GCP, bananapi, beaglebone,
5252
cubieboard2, cubietruck, odroid-c2, odroid-u2,
5353
rpi, rpi2 (armv7), rpi3 (aarch64), rpi4 (aarch64), ci20,
54-
pinebookpro, pinephone
54+
pinebookpro, pinephone, rock64
5555
5656
Options
5757
-b <syspkg> Set an alternative base-system package (defaults to base-system)
@@ -127,6 +127,7 @@ case "$PLATFORM" in
127127
GCP*) PKGS="$BASEPKG ${PLATFORM%-*}-base" ;;
128128
pinebookpro*) PKGS="$BASEPKG ${PLATFORM%-*}-base" ;;
129129
pinephone*) PKGS="$BASEPKG ${PLATFORM%-*}-base" ;;
130+
rock64*) PKGS="$BASEPKG ${PLATFORM%-*}-base" ;;
130131
*) die "$PROGNAME: invalid platform!";;
131132
esac
132133

0 commit comments

Comments
 (0)