From 9f469025e194fa58b3119a7719e11e558b533b4f Mon Sep 17 00:00:00 2001 From: ArenM Date: Sun, 29 May 2022 20:18:56 -0400 Subject: [PATCH 1/3] pkg: pine64: device-pine64-pinephone: include boot script Move the u-boot configuration to the device meta-package, and change mmc_bootdev to devnum for compatibility with tow-boot. When booting from tow-boot mmc_bootdev points at the emmc, even if arch is installed to the sd card, devnum gets set to be the correct device though. --- .../pine64/device-pine64-pinephone/PKGBUILD | 19 +++++-- .../pine64/device-pine64-pinephone/boot.txt | 50 +++++++++++++++++++ .../device-pine64-pinephone.install | 9 ++-- .../pine64/device-pine64-pinephone/mkscr | 9 ++++ 4 files changed, 79 insertions(+), 8 deletions(-) create mode 100644 PKGBUILDS/pine64/device-pine64-pinephone/boot.txt create mode 100755 PKGBUILDS/pine64/device-pine64-pinephone/mkscr diff --git a/PKGBUILDS/pine64/device-pine64-pinephone/PKGBUILD b/PKGBUILDS/pine64/device-pine64-pinephone/PKGBUILD index be5a1e498..1f1fe9649 100644 --- a/PKGBUILDS/pine64/device-pine64-pinephone/PKGBUILD +++ b/PKGBUILDS/pine64/device-pine64-pinephone/PKGBUILD @@ -1,19 +1,23 @@ # Maintainer: Danct12 pkgname=device-pine64-pinephone pkgver=0.2 -pkgrel=4 +pkgrel=5 pkgdesc="PinePhone device package" arch=(aarch64) url="https://github.com/dreemurrs-embedded/Pine64-Arch" license=('MIT') -depends=(danctnix-tweaks alsa-ucm-pinephone linux-megi uboot-pinephone rtl8723bt-firmware anx7688-firmware - ov5640-firmware eg25-manager) +depends=(danctnix-tweaks alsa-ucm-pinephone linux-megi rtl8723bt-firmware anx7688-firmware + ov5640-firmware eg25-manager uboot-tools) +optdepends=('uboot-pinephone: required if not using tow-boot') install="$pkgname.install" +backup=("boot/boot.txt") source=(10-proximity.rules 10-pinephone-brightness.rules pinephone-suspend-hook.sh machine-info - pulseaudio-pinetweaks.conf) + pulseaudio-pinetweaks.conf + boot.txt + mkscr) package() { # Kanged from Mobian, this is to make iio-sensor-proxy works with proximity sensor. @@ -28,10 +32,15 @@ package() { install -Dm644 "$srcdir"/machine-info "$pkgdir"/etc/machine-info install -Dm644 "$srcdir"/pulseaudio-pinetweaks.conf "$pkgdir"/etc/pulse/daemon.conf.d/pinetweaks.conf + + # u-boot startup script + install -Dm644 -t "${pkgdir}"/boot boot.txt mkscr } md5sums=('b72ff096c022588f72c226283ac328bd' '3a478fece4381cf41fb795009bfe8cc3' 'b0912b95d7d810a0f161d9bd79fc162b' 'b53781dde1d7a9a44e5076f3be463570' - '1504e684e5a2aec439e0674cdfc9d3c1') + '1504e684e5a2aec439e0674cdfc9d3c1' + '69400a6dfe94221172b2a00f18b1a8bd' + '021623a04afd29ac3f368977140cfbfd') diff --git a/PKGBUILDS/pine64/device-pine64-pinephone/boot.txt b/PKGBUILDS/pine64/device-pine64-pinephone/boot.txt new file mode 100644 index 000000000..d18bc5bb5 --- /dev/null +++ b/PKGBUILDS/pine64/device-pine64-pinephone/boot.txt @@ -0,0 +1,50 @@ +gpio set 98 # Enable vibrator + +if test ${devnum} -eq 0; then + echo "Booting from SD" + setenv linux_mmcdev 0 +else + echo "Booting from eMMC" + setenv linux_mmcdev 2 +fi + +# If we have at least 2 partitions, then the 1st one is /boot, and / is #2 +if part size mmc ${devnum} 2 none; then + setenv rootpart 2 +else + setenv rootpart 1 + setenv bootdir "/boot" +fi + +setenv bootargs loglevel=4 console=${console} console=tty0 root=/dev/mmcblk${linux_mmcdev}p${rootpart} rw rootwait quiet bootsplash.bootfile=bootsplash-themes/danctnix/bootsplash + +echo "Loading kernel..." +load mmc ${devnum}:1 ${ramdisk_addr_r} ${bootdir}/Image.gz + +echo "Uncompressing kernel..." +unzip ${ramdisk_addr_r} ${kernel_addr_r} + +echo "Loading initramfs..." +load mmc ${devnum}:1 ${ramdisk_addr_r} ${bootdir}/initramfs-linux.img +setenv ramdisk_size ${filesize} + +echo "Loading dtb..." +load mmc ${devnum}:1 ${fdt_addr_r} ${bootdir}/dtbs/${fdtfile} + +echo Resizing FDT +fdt addr ${fdt_addr_r} +fdt resize + +echo Adding FTD RAM clock +fdt mknode / memory +fdt set /memory ram_freq ${ram_freq} +fdt list /memory + +echo Loading user script +setenv user_scriptaddr 0x61dbc200 +load mmc ${devnum}:1 ${user_scriptaddr} ${bootdir}/user.scr +if test $? -eq 0; then source ${user_scriptaddr}; else echo No user script found; fi + +echo "Booting..." +gpio clear 98 # Disable vibrator +booti ${kernel_addr_r} ${ramdisk_addr_r}:0x${ramdisk_size} ${fdt_addr_r} diff --git a/PKGBUILDS/pine64/device-pine64-pinephone/device-pine64-pinephone.install b/PKGBUILDS/pine64/device-pine64-pinephone/device-pine64-pinephone.install index 23c4d680c..a45bef8b0 100644 --- a/PKGBUILDS/pine64/device-pine64-pinephone/device-pine64-pinephone.install +++ b/PKGBUILDS/pine64/device-pine64-pinephone/device-pine64-pinephone.install @@ -1,7 +1,10 @@ -post_install() { +post_upgrade() { + echo "Generating U-Boot script" + mkimage -A arm -O linux -T script -C none -n "U-Boot boot script" -d /boot/boot.txt /boot/boot.scr + systemctl enable eg25-manager } -post_upgrade() { - systemctl enable eg25-manager +post_install() { + post_upgrade } diff --git a/PKGBUILDS/pine64/device-pine64-pinephone/mkscr b/PKGBUILDS/pine64/device-pine64-pinephone/mkscr new file mode 100755 index 000000000..272b6a7a5 --- /dev/null +++ b/PKGBUILDS/pine64/device-pine64-pinephone/mkscr @@ -0,0 +1,9 @@ +#!/bin/bash + +if [[ ! -x /usr/bin/mkimage ]]; then + echo "mkimage not found. Please install uboot-tools:" + echo " pacman -S uboot-tools" + exit 1 +fi + +mkimage -A arm -O linux -T script -C none -n "U-Boot boot script" -d boot.txt boot.scr From a7b6a5da4e08ead5d92bbfcf985762689eee0eee Mon Sep 17 00:00:00 2001 From: ArenM Date: Sun, 29 May 2022 20:29:23 -0400 Subject: [PATCH 2/3] pkg: pine64: device-pine64-pinetab: include boot script Move the u-boot configuration to the device meta-package, and change mmc_bootdev to devnum for compatibility with tow-boot. When booting from tow-boot mmc_bootdev points at the emmc, even if arch is installed to the sd card, devnum gets set to be the correct device though. --- .../pine64/device-pine64-pinetab/PKGBUILD | 20 ++++++-- .../pine64/device-pine64-pinetab/boot.txt | 47 +++++++++++++++++++ .../device-pine64-pinetab.install | 8 ++++ PKGBUILDS/pine64/device-pine64-pinetab/mkscr | 9 ++++ 4 files changed, 79 insertions(+), 5 deletions(-) create mode 100644 PKGBUILDS/pine64/device-pine64-pinetab/boot.txt create mode 100644 PKGBUILDS/pine64/device-pine64-pinetab/device-pine64-pinetab.install create mode 100755 PKGBUILDS/pine64/device-pine64-pinetab/mkscr diff --git a/PKGBUILDS/pine64/device-pine64-pinetab/PKGBUILD b/PKGBUILDS/pine64/device-pine64-pinetab/PKGBUILD index 64a6dcc20..ec888dad3 100644 --- a/PKGBUILDS/pine64/device-pine64-pinetab/PKGBUILD +++ b/PKGBUILDS/pine64/device-pine64-pinetab/PKGBUILD @@ -1,21 +1,26 @@ # Maintainer: Danct12 pkgname=device-pine64-pinetab pkgver=0.2 -pkgrel=3 +pkgrel=4 pkgdesc="PineTab device package" arch=(aarch64) url="https://github.com/dreemurrs-embedded/Pine64-Arch" license=('MIT') +install="$pkgname.install" +backup=("boot/boot.txt") depends=(linux-megi - uboot-pinephone rtl8723bt-firmware ov5640-firmware - alsa-ucm-pinetab) + uboot-tools # we need this for mkscr + alsa-ucm-pinetab + uboot-pinephone) source=(pinetab-suspend-hook.sh phoc.ini machine-info pulseaudio-pinetweaks.conf - gsk-renderer-gl.sh) + gsk-renderer-gl.sh + boot.txt + mkscr) package() { # Current workaround for suspend @@ -29,10 +34,15 @@ package() { install -Dm644 "$srcdir"/pulseaudio-pinetweaks.conf "$pkgdir"/etc/pulse/daemon.conf.d/pinetweaks.conf install -Dm755 "$srcdir"/gsk-renderer-gl.sh -t "$pkgdir"/etc/profile.d/ + + # u-boot startup script + install -Dm644 -t "${pkgdir}"/boot boot.txt mkscr } md5sums=('b0912b95d7d810a0f161d9bd79fc162b' 'ecd8742a921d805e6756abc522da1dba' '340993065eb26f928700733369be2d9b' '1504e684e5a2aec439e0674cdfc9d3c1' - 'df623da01912f5ce89c178639fc22656') + 'df623da01912f5ce89c178639fc22656' + '57662f9c45c1432c2756149724422f6d' + '021623a04afd29ac3f368977140cfbfd') diff --git a/PKGBUILDS/pine64/device-pine64-pinetab/boot.txt b/PKGBUILDS/pine64/device-pine64-pinetab/boot.txt new file mode 100644 index 000000000..9da1e5648 --- /dev/null +++ b/PKGBUILDS/pine64/device-pine64-pinetab/boot.txt @@ -0,0 +1,47 @@ +if test ${devnum} -eq 0; then + echo "Booting from SD" + setenv linux_mmcdev 0 +else + echo "Booting from eMMC" + setenv linux_mmcdev 2 +fi + +# If we have at least 2 partitions, then the 1st one is /boot, and / is #2 +if part size mmc ${devnum} 2 none; then + setenv rootpart 2 +else + setenv rootpart 1 + setenv bootdir "/boot" +fi + +setenv bootargs loglevel=4 console=${console} console=tty0 root=/dev/mmcblk${linux_mmcdev}p${rootpart} rw rootwait quiet bootsplash.bootfile=bootsplash-themes/danctnix/bootsplash + +echo "Loading kernel..." +load mmc ${devnum}:1 ${ramdisk_addr_r} ${bootdir}/Image.gz + +echo "Uncompressing kernel..." +unzip ${ramdisk_addr_r} ${kernel_addr_r} + +echo "Loading initramfs..." +load mmc ${devnum}:1 ${ramdisk_addr_r} ${bootdir}/initramfs-linux.img +setenv ramdisk_size ${filesize} + +echo "Loading dtb..." +load mmc ${devnum}:1 ${fdt_addr_r} ${bootdir}/dtbs/${fdtfile} + +echo Resizing FDT +fdt addr ${fdt_addr_r} +fdt resize + +echo Adding FTD RAM clock +fdt mknode / memory +fdt set /memory ram_freq ${ram_freq} +fdt list /memory + +echo Loading user script +setenv user_scriptaddr 0x61dbc200 +load mmc ${devnum}:1 ${user_scriptaddr} ${bootdir}/user.scr +if test $? -eq 0; then source ${user_scriptaddr}; else echo No user script found; fi + +echo "Booting..." +booti ${kernel_addr_r} ${ramdisk_addr_r}:0x${ramdisk_size} ${fdt_addr_r} diff --git a/PKGBUILDS/pine64/device-pine64-pinetab/device-pine64-pinetab.install b/PKGBUILDS/pine64/device-pine64-pinetab/device-pine64-pinetab.install new file mode 100644 index 000000000..5bf827029 --- /dev/null +++ b/PKGBUILDS/pine64/device-pine64-pinetab/device-pine64-pinetab.install @@ -0,0 +1,8 @@ +post_upgrade() { + echo "Generating U-Boot script" + mkimage -A arm -O linux -T script -C none -n "U-Boot boot script" -d /boot/boot.txt /boot/boot.scr +} + +post_install() { + post_upgrade +} diff --git a/PKGBUILDS/pine64/device-pine64-pinetab/mkscr b/PKGBUILDS/pine64/device-pine64-pinetab/mkscr new file mode 100755 index 000000000..272b6a7a5 --- /dev/null +++ b/PKGBUILDS/pine64/device-pine64-pinetab/mkscr @@ -0,0 +1,9 @@ +#!/bin/bash + +if [[ ! -x /usr/bin/mkimage ]]; then + echo "mkimage not found. Please install uboot-tools:" + echo " pacman -S uboot-tools" + exit 1 +fi + +mkimage -A arm -O linux -T script -C none -n "U-Boot boot script" -d boot.txt boot.scr From 5fb1dfaadce5b8505a145410d97e8c07d7e3c0fc Mon Sep 17 00:00:00 2001 From: ArenM Date: Sun, 29 May 2022 15:26:34 -0400 Subject: [PATCH 3/3] pkg: pine64: uboot-pinephone: remove boot configuration These files are now installed in the device meta-packages --- PKGBUILDS/pine64/uboot-pinephone/PKGBUILD | 7 ---- PKGBUILDS/pine64/uboot-pinephone/boot.txt | 50 ----------------------- PKGBUILDS/pine64/uboot-pinephone/mkscr | 9 ---- 3 files changed, 66 deletions(-) delete mode 100644 PKGBUILDS/pine64/uboot-pinephone/boot.txt delete mode 100755 PKGBUILDS/pine64/uboot-pinephone/mkscr diff --git a/PKGBUILDS/pine64/uboot-pinephone/PKGBUILD b/PKGBUILDS/pine64/uboot-pinephone/PKGBUILD index d45d9e35d..d8558a2ca 100644 --- a/PKGBUILDS/pine64/uboot-pinephone/PKGBUILD +++ b/PKGBUILDS/pine64/uboot-pinephone/PKGBUILD @@ -10,10 +10,8 @@ pkgdesc="U-Boot for PinePhone" arch=('aarch64') url='http://www.denx.de/wiki/U-Boot/WebHome' license=('GPL') -depends=('uboot-tools') # we need this for mkscr makedepends=('bc' 'python' 'swig' 'dtc' 'python-setuptools') install=${pkgname}.install -backup=("boot/boot.txt") _commit_atf="d005bfcdff423fc84f03c657e0dcdb4b45621b22" @@ -23,8 +21,6 @@ source=("https://ftp.denx.de/pub/u-boot/u-boot-${pkgver/rc/-rc}.tar.bz2" '0001-expose-DRAM-clock-speed.patch' 'Improve-Allwinner-A64-timer-workaround.patch' 'Add-volume_key-environment-variable.patch' - 'boot.txt' - 'mkscr' 'update-u-boot' 'scp.bin') md5sums=('49ba74a214d14c6340c8067bc1ed5fa0' @@ -33,8 +29,6 @@ md5sums=('49ba74a214d14c6340c8067bc1ed5fa0' '061a510280d16bddf16679cf0d23bf6e' '98ad5f31b1d7ff2e6e03555f29ebc6e6' 'fb9def68f0b44c69f88f7923e21379cc' - '06c27a80909035513aac45036e8d954b' - '021623a04afd29ac3f368977140cfbfd' '5f85361d1d5ce47ff11ec4009cc2e18a' '90616d501a12d6f7a12c4349f789c343') @@ -132,6 +126,5 @@ package() { cp u-boot-sunxi-with-spl-pinetab{-624,-552,-528,-492}.bin "${pkgdir}"/boot cp u-boot-sunxi-with-spl-pinephone{-624,-552,-528,-492}.bin "${pkgdir}"/boot - cp ../boot.txt ../mkscr "${pkgdir}"/boot mkdir -p "${pkgdir}"/usr/bin && cp ../update-u-boot "${pkgdir}"/usr/bin } diff --git a/PKGBUILDS/pine64/uboot-pinephone/boot.txt b/PKGBUILDS/pine64/uboot-pinephone/boot.txt deleted file mode 100644 index 93aa71b78..000000000 --- a/PKGBUILDS/pine64/uboot-pinephone/boot.txt +++ /dev/null @@ -1,50 +0,0 @@ -gpio set 98 # Enable vibrator - -if test ${mmc_bootdev} -eq 0; then - echo "Booting from SD" - setenv linux_mmcdev 0 -else - echo "Booting from eMMC" - setenv linux_mmcdev 2 -fi - -# If we have at least 2 partitions, then the 1st one is /boot, and / is #2 -if part size mmc ${mmc_bootdev} 2 none; then - setenv rootpart 2 -else - setenv rootpart 1 - setenv bootdir "/boot" -fi - -setenv bootargs loglevel=4 console=${console} console=tty0 root=/dev/mmcblk${linux_mmcdev}p${rootpart} rw rootwait quiet bootsplash.bootfile=bootsplash-themes/danctnix/bootsplash - -echo "Loading kernel..." -load mmc ${mmc_bootdev}:1 ${ramdisk_addr_r} ${bootdir}/Image.gz - -echo "Uncompressing kernel..." -unzip ${ramdisk_addr_r} ${kernel_addr_r} - -echo "Loading initramfs..." -load mmc ${mmc_bootdev}:1 ${ramdisk_addr_r} ${bootdir}/initramfs-linux.img -setenv ramdisk_size ${filesize} - -echo "Loading dtb..." -load mmc ${mmc_bootdev}:1 ${fdt_addr_r} ${bootdir}/dtbs/${fdtfile} - -echo Resizing FDT -fdt addr ${fdt_addr_r} -fdt resize - -echo Adding FTD RAM clock -fdt mknode / memory -fdt set /memory ram_freq ${ram_freq} -fdt list /memory - -echo Loading user script -setenv user_scriptaddr 0x61dbc200 -load mmc ${mmc_bootdev}:1 ${user_scriptaddr} ${bootdir}/user.scr -if test $? -eq 0; then source ${user_scriptaddr}; else echo No user script found; fi - -echo "Booting..." -gpio clear 98 # Disable vibrator -booti ${kernel_addr_r} ${ramdisk_addr_r}:0x${ramdisk_size} ${fdt_addr_r} diff --git a/PKGBUILDS/pine64/uboot-pinephone/mkscr b/PKGBUILDS/pine64/uboot-pinephone/mkscr deleted file mode 100755 index 272b6a7a5..000000000 --- a/PKGBUILDS/pine64/uboot-pinephone/mkscr +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -if [[ ! -x /usr/bin/mkimage ]]; then - echo "mkimage not found. Please install uboot-tools:" - echo " pacman -S uboot-tools" - exit 1 -fi - -mkimage -A arm -O linux -T script -C none -n "U-Boot boot script" -d boot.txt boot.scr