device-odroid-hc2: add tools (MR 2320)

The ODROID HC2 device must have its boot partition
on a microSD card while the rootfs can be on an external HDD.
Provide a script to transfer the rootfs and update the U-boot script.

[ci:skip-build] already built successfully in CI
This commit is contained in:
Dylan Van Assche 2021-07-06 20:48:55 +02:00 committed by Clayton Craft
parent c9c3790896
commit 705f673aac
No known key found for this signature in database
GPG key ID: 7A3461CA187CEA54
4 changed files with 70 additions and 6 deletions

View file

@ -3,7 +3,7 @@
pkgname=device-odroid-hc2
pkgdesc="ODROID HC2"
pkgver=0.2
pkgver=0.3
pkgrel=0
url="https://postmarketos.org"
license="MIT"
@ -16,10 +16,10 @@ depends="linux-odroid-hc2
u-boot-tools
"
makedepends="devicepkg-dev"
subpackages="$pkgname-nonfree-firmware:nonfree_firmware"
subpackages="$pkgname-nonfree-firmware:nonfree_firmware $pkgname-tools"
_commit="42ac93dcfbbb8a08c2bdc02e19f96eb35a81891a"
install="$pkgname.post-install $pkgname.post-upgrade"
source="deviceinfo uboot-script.cmd"
source="deviceinfo uboot-script.cmd install-rootfs-hdd.sh"
build() {
devicepkg_build $startdir $pkgname
@ -47,7 +47,16 @@ nonfree_firmware() {
mkdir "$subpkgdir"
}
tools() {
pkgdesc="ODROID HC2 tools"
depends="rsync e2fsprogs-extra"
mkdir "$subpkgdir"
install -Dm744 "$srcdir"/install-rootfs-hdd.sh \
"$pkgdir"/usr/bin/install-rootfs-hdd
}
sha512sums="
90afdace4ad938ed69747d3b51ac1678bc325cb4e7234ac4eeded7b6fa79f10bd88d15ebfc6f20f0a9252c48008288a489cb99751ae6d2cdb12f289b9154a9f3 deviceinfo
83a4bcc34d20c2e5e6f1c3412c291baa90a8137df7925c02d8e46d922d45615cc957d79d37a23982bed7e1cfa92f2be22fa5f11cc59d3706b79ba62a2d550263 uboot-script.cmd
d02702884d47c2c6b98f1ec194fc3a11b2c6559d416c112d41ddecfbbd84f0706adfc72e13e9943f130e548d987aa7d151f4f416443d15b7dff2375d4d067144 deviceinfo
48e76599c21dd0df595ad2f5a9fe9f71962b5c1f631c91ce6f9904fe393ee7bf7c0d71df54f08bdf7fc4ed9176d36abc2f887781159304f862bf996f2157a5bd uboot-script.cmd
8273be5a8c5a7b9a27ae91a1581ca2d247d0fb45e24e25e46ba8272955d7fce31c62562c3fae402f6a66918c9c61d838de692cca11eea3cdfde6a91f478f2955 install-rootfs-hdd.sh
"

View file

@ -14,6 +14,7 @@ deviceinfo_no_framebuffer="true"
deviceinfo_generate_legacy_uboot_initfs="true"
deviceinfo_getty="ttySAC2;115200"
deviceinfo_disable_dhcpd="true"
deviceinfo_modules_initfs="uas usb-storage scsi_mod sd_mod t10_pi"
# Device related
deviceinfo_gpu_accelerated="true"

View file

@ -0,0 +1,54 @@
#!/bin/sh
set -e
MOUNT_POINT=/mnt/hdd
MMC_ROOT_PARTITION=/dev/mmcblk0p2
echo "### Move rootfs to external HDD ###"
echo "This script requires root permissions!"
echo "This action is inreversible without reflashing your device!"
echo "Are you sure you want to continue? [y/N]"
read -n 1 ANSWER
echo ""
if [ "$ANSWER" != "y" ]; then
echo "Operation aborted"
exit 1
fi
echo "Which partition should be used as rootfs?:"
read HDD_ROOT_PARTITION
echo ""
echo "### Copying rootfs to partition $HDD_ROOT_PARTITION ###"
# Mount partition
echo "Trying to unmount $HDD_ROOT_PARTITION"
umount $HDD_ROOT_PARTITION || true # may fail
echo "Mounting $HDD_ROOT_PARTITION at $MOUNT_POINT"
mkdir -p $MOUNT_POINT
mount $HDD_ROOT_PARTITION $MOUNT_POINT
# Copy rootfs
echo "Copying rootfs... This can take a while."
rsync \
-aAXx \
--exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"} \
/ \
$MOUNT_POINT
# Verify all files are copied
rsync \
-aAXx \
--exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"} \
/ \
$MOUNT_POINT
sync
echo "Rootfs successfully copied!"
# pmOS initfs looks for rootfs by label, rename partitions
echo "Renaming partitions"
e2label $MMC_ROOT_PARTITION pmOS_root_old
e2label $HDD_ROOT_PARTITION pmOS_root
echo "Rootfs moved to external HDD, you must reboot NOW!"

View file

@ -8,7 +8,7 @@ setenv dtb_file "exynos5422-odroidhc1.dtb"
printenv
echo Setting bootargs
setenv bootargs init=/init.sh rw console=tty0 console=ttySAC2,115200 panic=10 consoleblank=0 loglevel=9 cma=256M PMOS_NO_OUTPUT_REDIRECT PMOS_FORCE_PARTITION_RESIZE pmos_boot=/dev/mmcblk0p1 pmos_root=/dev/mmcblk0p2
setenv bootargs init=/init.sh rw console=tty0 console=ttySAC2,115200 panic=10 consoleblank=0 loglevel=9 cma=256M PMOS_NO_OUTPUT_REDIRECT PMOS_FORCE_PARTITION_RESIZE
echo Loading Kernel
load mmc ${mmcbootdev}:${mmcbootpart} ${kernel_addr_r} ${kernel_image}