sourceparts-pocketpc: new device (MR 2807)
The Pocket P.C. PDA from SourceParts/Popcorn Computers.
This commit is contained in:
parent
adb40263c3
commit
d199a3b1ef
9 changed files with 6424 additions and 0 deletions
device/testing
device-sourceparts-pocketpc
linux-sourceparts-pocketpc
u-boot-sourceparts-pocketpc
46
device/testing/device-sourceparts-pocketpc/APKBUILD
Normal file
46
device/testing/device-sourceparts-pocketpc/APKBUILD
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
# Reference: <https://postmarketos.org/devicepkg>
|
||||||
|
pkgname=device-sourceparts-pocketpc
|
||||||
|
pkgdesc="Source Parts Pocket P.C."
|
||||||
|
pkgver=0.1
|
||||||
|
pkgrel=0
|
||||||
|
url="https://postmarketos.org"
|
||||||
|
license="MIT"
|
||||||
|
arch="aarch64"
|
||||||
|
options="!check !archcheck"
|
||||||
|
depends="
|
||||||
|
linux-sourceparts-pocketpc
|
||||||
|
mesa-dri-gallium
|
||||||
|
postmarketos-base
|
||||||
|
u-boot-sourceparts-pocketpc
|
||||||
|
uboot-tools
|
||||||
|
"
|
||||||
|
makedepends="devicepkg-dev"
|
||||||
|
source="
|
||||||
|
deviceinfo
|
||||||
|
uboot-script.cmd
|
||||||
|
"
|
||||||
|
|
||||||
|
build() {
|
||||||
|
devicepkg_build $startdir $pkgname
|
||||||
|
mkimage \
|
||||||
|
-A arm \
|
||||||
|
-O linux \
|
||||||
|
-T script \
|
||||||
|
-C none \
|
||||||
|
-a 0 \
|
||||||
|
-e 0 \
|
||||||
|
-n postmarketos \
|
||||||
|
-d "$srcdir"/uboot-script.cmd \
|
||||||
|
"$srcdir"/boot.scr
|
||||||
|
}
|
||||||
|
|
||||||
|
package() {
|
||||||
|
devicepkg_package $startdir $pkgname
|
||||||
|
install -Dm644 "$srcdir"/boot.scr \
|
||||||
|
"$pkgdir"/boot/boot.scr
|
||||||
|
}
|
||||||
|
|
||||||
|
sha512sums="
|
||||||
|
69d6d0f8daf09403cd59a46873db575616ca9c7c5d2571a2e6aa975d26cc7777f47f51201003d197f3df32f41e076be64a4f4559db5c6bd234a4dfd6dfc9a169 deviceinfo
|
||||||
|
328658f476cf43962e4bf2e9b2c0773f3fd5bad5cbe8543fb32ef9447b4c2729c1f625be0e1042517a456a44c4f77bae5b82ec208dc6789ba26545e3fce2578d uboot-script.cmd
|
||||||
|
"
|
28
device/testing/device-sourceparts-pocketpc/deviceinfo
Normal file
28
device/testing/device-sourceparts-pocketpc/deviceinfo
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
# Reference: <https://postmarketos.org/deviceinfo>
|
||||||
|
# Please use double quotes only. You can source this file in shell
|
||||||
|
# scripts.
|
||||||
|
|
||||||
|
deviceinfo_format_version="0"
|
||||||
|
deviceinfo_name="Source Parts Pocket P.C."
|
||||||
|
deviceinfo_manufacturer="Source Parts"
|
||||||
|
deviceinfo_codename="sourceparts-pocketpc"
|
||||||
|
deviceinfo_year="2021"
|
||||||
|
deviceinfo_dtb="allwinner/sun50i-a64-pocket-pc"
|
||||||
|
deviceinfo_arch="aarch64"
|
||||||
|
|
||||||
|
# Device related
|
||||||
|
deviceinfo_gpu_accelerated="true"
|
||||||
|
deviceinfo_chassis="tablet"
|
||||||
|
deviceinfo_keyboard="true"
|
||||||
|
deviceinfo_external_storage="true"
|
||||||
|
deviceinfo_screen_width="1920"
|
||||||
|
deviceinfo_screen_height="1080"
|
||||||
|
deviceinfo_getty="ttyS0;115200"
|
||||||
|
deviceinfo_mesa_driver="sun4i-drm"
|
||||||
|
deviceinfo_dev_internal_storage="/dev/mmcblk2"
|
||||||
|
deviceinfo_dev_internal_storage_repartition="true"
|
||||||
|
|
||||||
|
# Bootloader related
|
||||||
|
deviceinfo_flash_method="none"
|
||||||
|
deviceinfo_generate_legacy_uboot_initfs="true"
|
||||||
|
deviceinfo_sd_embed_firmware="u-boot/sourceparts-pocketpc/u-boot-sunxi-with-spl-552.bin:8"
|
28
device/testing/device-sourceparts-pocketpc/uboot-script.cmd
Normal file
28
device/testing/device-sourceparts-pocketpc/uboot-script.cmd
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
if test ${mmc_bootdev} -eq 0 ; then
|
||||||
|
echo "Booting from SD";
|
||||||
|
setenv bootdev 0;
|
||||||
|
else
|
||||||
|
echo "Booting from eMMC";
|
||||||
|
setenv bootdev 2;
|
||||||
|
fi;
|
||||||
|
|
||||||
|
# This is close to the max env size, https://unix.stackexchange.com/questions/530762/max-line-length-for-u-boot-setenv
|
||||||
|
setenv bootargs init=/init.sh rw console=tty0 console=ttyS0,115200 earlycon=uart,mmio32,0x01c28000 panic=10 consoleblank=0 loglevel=1 fbcon=rotate:1 PMOS_NO_OUTPUT_REDIRECT PMOS_FORCE_PARTITION_RESIZE pmos_boot=/dev/mmcblk${bootdev}p1 pmos_root=/dev/mmcblk${bootdev}p2
|
||||||
|
|
||||||
|
printenv
|
||||||
|
|
||||||
|
echo Loading DTB
|
||||||
|
load mmc ${mmc_bootdev}:1 ${fdt_addr_r} sun50i-a64-pocket-pc.dtb
|
||||||
|
|
||||||
|
echo Loading Initramfs
|
||||||
|
load mmc ${mmc_bootdev}:1 ${ramdisk_addr_r} uInitrd
|
||||||
|
|
||||||
|
echo Loading Kernel
|
||||||
|
load mmc ${mmc_bootdev}:1 ${kernel_addr_r} vmlinuz
|
||||||
|
|
||||||
|
echo Resizing FDT
|
||||||
|
fdt addr ${fdt_addr_r}
|
||||||
|
fdt resize
|
||||||
|
|
||||||
|
echo Booting kernel
|
||||||
|
booti ${kernel_addr_r} ${ramdisk_addr_r} ${fdt_addr_r}
|
|
@ -0,0 +1,26 @@
|
||||||
|
diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig
|
||||||
|
index 8744f944ede9..e224887bd891 100644
|
||||||
|
--- a/drivers/staging/Kconfig
|
||||||
|
+++ b/drivers/staging/Kconfig
|
||||||
|
@@ -106,4 +106,12 @@ source "drivers/staging/hikey9xx/Kconfig"
|
||||||
|
|
||||||
|
source "drivers/staging/rtl8723cs/Kconfig"
|
||||||
|
|
||||||
|
+config RTL8723DS
|
||||||
|
+ tristate "Realtek RTL8723DS SDIO WiFi driver"
|
||||||
|
+ depends on WLAN && MMC && CFG80211
|
||||||
|
+ select WIRELESS_EXT
|
||||||
|
+ select WEXT_PRIV
|
||||||
|
+ help
|
||||||
|
+ Help message of RTL8723DS
|
||||||
|
+
|
||||||
|
endif # STAGING
|
||||||
|
diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile
|
||||||
|
index 90ea2bf5ff76..72c9957832d3 100644
|
||||||
|
--- a/drivers/staging/Makefile
|
||||||
|
+++ b/drivers/staging/Makefile
|
||||||
|
@@ -43,3 +43,4 @@ obj-$(CONFIG_QLGE) += qlge/
|
||||||
|
obj-$(CONFIG_WFX) += wfx/
|
||||||
|
obj-y += hikey9xx/
|
||||||
|
obj-$(CONFIG_RTL8723CS) += rtl8723cs/
|
||||||
|
+obj-$(CONFIG_RTL8723DS) += rtl8723ds/
|
91
device/testing/linux-sourceparts-pocketpc/APKBUILD
Normal file
91
device/testing/linux-sourceparts-pocketpc/APKBUILD
Normal file
|
@ -0,0 +1,91 @@
|
||||||
|
# Maintainer: Martijn Braam <martijn@brixit.nl>
|
||||||
|
_flavor=sourceparts-pocketpc
|
||||||
|
_config="config-$_flavor.$CARCH"
|
||||||
|
pkgname=linux-$_flavor
|
||||||
|
pkgver=5.14.6_git20210920
|
||||||
|
pkgrel=0
|
||||||
|
_tag="81a7953afc5cd1001b727701dc99625ec656160a"
|
||||||
|
_wifi_ref="1b6ddd544b4a829ed2b7feb32575359b6443cd3d"
|
||||||
|
pkgdesc="Kernel fork for the Pocket P.C."
|
||||||
|
arch="aarch64"
|
||||||
|
url="https://megous.com/git/linux/"
|
||||||
|
license="GPL-2.0-only"
|
||||||
|
makedepends="
|
||||||
|
bison
|
||||||
|
devicepkg-dev
|
||||||
|
findutils
|
||||||
|
flex
|
||||||
|
gmp-dev
|
||||||
|
installkernel
|
||||||
|
mpc1-dev
|
||||||
|
mpfr-dev
|
||||||
|
openssl-dev
|
||||||
|
perl
|
||||||
|
rsync
|
||||||
|
xz
|
||||||
|
"
|
||||||
|
options="!strip !check !tracedeps
|
||||||
|
pmb:cross-native
|
||||||
|
pmb:kconfigcheck-anbox
|
||||||
|
pmb:kconfigcheck-iwd
|
||||||
|
pmb:kconfigcheck-nftables
|
||||||
|
pmb:kconfigcheck-zram
|
||||||
|
"
|
||||||
|
source="$pkgname-$_tag.tar.gz::https://github.com/PopcornComputer/PocketPC-Linux/archive/$_tag.tar.gz
|
||||||
|
https://github.com/lwfinger/rtl8723ds/archive/$_wifi_ref.tar.gz
|
||||||
|
0001-rtl8723ds.patch
|
||||||
|
config-$_flavor.aarch64
|
||||||
|
"
|
||||||
|
subpackages="$pkgname-dev"
|
||||||
|
builddir="$srcdir/PocketPC-Linux-$_tag"
|
||||||
|
|
||||||
|
case "$CARCH" in
|
||||||
|
aarch64*) _carch="arm64" ;;
|
||||||
|
arm*) _carch="arm" ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
|
||||||
|
prepare() {
|
||||||
|
default_prepare
|
||||||
|
|
||||||
|
mv "$srcdir"/rtl8723ds-$_wifi_ref "$builddir"/drivers/staging/rtl8723ds
|
||||||
|
|
||||||
|
REPLACE_GCCH=0 \
|
||||||
|
. downstreamkernel_prepare
|
||||||
|
}
|
||||||
|
|
||||||
|
build() {
|
||||||
|
unset LDFLAGS
|
||||||
|
make ARCH="$_carch" CC="${CC:-gcc}" \
|
||||||
|
KBUILD_BUILD_VERSION="$((pkgrel + 1 ))-$_flavor" \
|
||||||
|
CFLAGS_MODULE=-fno-pic \
|
||||||
|
DTC_FLAGS="-@"
|
||||||
|
}
|
||||||
|
|
||||||
|
package() {
|
||||||
|
downstreamkernel_package "$builddir" "$pkgdir" "$_carch" "$_flavor"
|
||||||
|
|
||||||
|
make -j1 modules_install dtbs_install \
|
||||||
|
ARCH="$_carch" \
|
||||||
|
INSTALL_MOD_STRIP=1 \
|
||||||
|
INSTALL_MOD_PATH="$pkgdir" \
|
||||||
|
INSTALL_DTBS_PATH="$pkgdir/usr/share/dtb"
|
||||||
|
}
|
||||||
|
|
||||||
|
dev() {
|
||||||
|
provides="linux-headers"
|
||||||
|
replaces="linux-headers"
|
||||||
|
|
||||||
|
cd $builddir
|
||||||
|
|
||||||
|
# https://github.com/torvalds/linux/blob/master/Documentation/kbuild/headers_install.rst
|
||||||
|
make -j1 headers_install \
|
||||||
|
ARCH="$_carch" \
|
||||||
|
INSTALL_HDR_PATH="$subpkgdir"/usr
|
||||||
|
}
|
||||||
|
sha512sums="
|
||||||
|
49e091de60b820c48e19bb9d3602cb0e5c3470b99112ad63da3f112b503569e6bab21738f2be014705212974a3a824c9f91acd98fa33632e7bc8bf2057f51d75 linux-sourceparts-pocketpc-81a7953afc5cd1001b727701dc99625ec656160a.tar.gz
|
||||||
|
68001a7fdc022b4ff82e3f1762a00369c2be18a4c9f5ea2074e3e9248678c48525f4bcec47ef0c4678d6a0b6aef031eb52cac9a9811f3291a73e00cb33fb5c85 1b6ddd544b4a829ed2b7feb32575359b6443cd3d.tar.gz
|
||||||
|
75af8bd55fc006b8f208fec57bce612112ff066fa71f1cfe6d4a0904e201e54d574dbf13ae8913ec570f790ac360f4b87ac26e7dac19f641a7f4c403a5df938b 0001-rtl8723ds.patch
|
||||||
|
d637fc8c40971b7b5587039bddd8103fda5559e3055fe9ec7b2d0b40f62b213d04e70f165f50e2eca0cd25874e32352a9b62f490964a09a5755f013aebfcc61a config-sourceparts-pocketpc.aarch64
|
||||||
|
"
|
File diff suppressed because it is too large
Load diff
51
device/testing/u-boot-sourceparts-pocketpc/APKBUILD
Normal file
51
device/testing/u-boot-sourceparts-pocketpc/APKBUILD
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
# U-boot with patches to make the PinePhone boot faster and have control over the ddr clock speed
|
||||||
|
pkgname=u-boot-sourceparts-pocketpc
|
||||||
|
pkgver=2021.1
|
||||||
|
pkgrel=0
|
||||||
|
pkgdesc="U-Boot bootloader for the Sourceparts Pocket P.C."
|
||||||
|
url="https://source.denx.de/u-boot"
|
||||||
|
arch="aarch64"
|
||||||
|
license="GPL-2.0-or-later OFL-1.1 BSD-2-Clause BSD-3-Clause eCos-2.0 IBM-pibs
|
||||||
|
ISC LGPL-2.0-only LGPL-2.1-only X11"
|
||||||
|
makedepends="$depends_dev bc dtc python3-dev py3-setuptools swig bison flex openssl-dev arm-trusted-firmware"
|
||||||
|
options="!check"
|
||||||
|
_ref="49694d39d856c9ab537c4f2ff1d0167f4e21d19b"
|
||||||
|
source="https://github.com/PopcornComputer/PocketPC-Uboot/archive/$_ref.tar.gz
|
||||||
|
update-u-boot
|
||||||
|
"
|
||||||
|
builddir="$srcdir/PocketPC-Uboot-$_ref"
|
||||||
|
install="$pkgname.post-upgrade"
|
||||||
|
_frequencies='528 552 624'
|
||||||
|
|
||||||
|
build() {
|
||||||
|
touch include/config.h
|
||||||
|
LC_ALL=C date +'#define U_BOOT_DATE "%b %d %C%y"' > include/timestamp_autogenerated.h
|
||||||
|
LC_ALL=C date +'#define U_BOOT_TIME "%T"' >> include/timestamp_autogenerated.h
|
||||||
|
|
||||||
|
export BL31="/usr/share/arm-trusted-firmware/sun50i_a64/bl31.bin"
|
||||||
|
export BUILD_DIR="$builddir"/build
|
||||||
|
|
||||||
|
for freq in $_frequencies; do
|
||||||
|
mkdir -p "$BUILD_DIR-$freq"
|
||||||
|
sed -rie "s/^(CONFIG_DRAM_CLK=).*$/CONFIG_DRAM_CLK=$freq/" configs/pocket_pc_defconfig
|
||||||
|
cat configs/pocket_pc_defconfig | grep CONFIG_DRAM_CLK
|
||||||
|
make O="$BUILD_DIR-$freq" HOSTCC=gcc ARCH=arm pocket_pc_defconfig
|
||||||
|
make O="$BUILD_DIR-$freq" HOSTCC=gcc ARCH=arm all
|
||||||
|
sha512sum -b "$BUILD_DIR-$freq/u-boot-sunxi-with-spl.bin" > "$BUILD_DIR-$freq/u-boot-sunxi-with-spl.bin.sha512"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
package() {
|
||||||
|
for freq in $_frequencies; do
|
||||||
|
install -D -m644 "build-$freq/u-boot-sunxi-with-spl.bin" \
|
||||||
|
"$pkgdir/usr/share/u-boot/sourceparts-pocketpc/u-boot-sunxi-with-spl-$freq.bin"
|
||||||
|
install -D -m644 "build-$freq/u-boot-sunxi-with-spl.bin.sha512" \
|
||||||
|
"$pkgdir/usr/share/u-boot/sourceparts-pocketpc/u-boot-sunxi-with-spl-$freq.bin.sha512"
|
||||||
|
done
|
||||||
|
install -D -m 755 "$srcdir"/update-u-boot "$pkgdir"/usr/sbin/update-u-boot
|
||||||
|
}
|
||||||
|
|
||||||
|
sha512sums="
|
||||||
|
39caa823655d38510d563b149265da1bba2e63efcd2ef5999a0a41a6b96775108c3ee86e6d9d6acc0fc11acb8dd66e534ec834c12fd8cd76057ca52c581557fe 49694d39d856c9ab537c4f2ff1d0167f4e21d19b.tar.gz
|
||||||
|
d9ebf59e37a2d8435d5a31884fde554f175390d1ce23511da8d38ba368f6b812b45f1399a0fa49821c37ef573dfb4500e895fcc993bb247fae88f63b3bb7804f update-u-boot
|
||||||
|
"
|
|
@ -0,0 +1,3 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
update-u-boot -s
|
196
device/testing/u-boot-sourceparts-pocketpc/update-u-boot
Normal file
196
device/testing/u-boot-sourceparts-pocketpc/update-u-boot
Normal file
|
@ -0,0 +1,196 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
verbose=
|
||||||
|
board=
|
||||||
|
device=
|
||||||
|
dryrun=
|
||||||
|
imagedir=
|
||||||
|
default_freq=528
|
||||||
|
freq=
|
||||||
|
skip_delay=
|
||||||
|
|
||||||
|
get_boot_blockdev() {
|
||||||
|
# Find the blockdevice where /boot is mounted from
|
||||||
|
mount | sed -n -E 's:.*(/dev/mmcblk[0-9])p[0-9] on /boot .*:\1:p'
|
||||||
|
}
|
||||||
|
|
||||||
|
get_defaults() {
|
||||||
|
if [ -z "$board" -a -e /sys/firmware/devicetree/base/compatible ]; then
|
||||||
|
case "$(cat /sys/firmware/devicetree/base/compatible 2>/dev/null)" in
|
||||||
|
pine64,pinephone*) board=pinephone ;;
|
||||||
|
pine64,pinetab*) board=pinetab ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$device" ]; then
|
||||||
|
case "$board" in
|
||||||
|
pinephone|pinetab) device=$(get_boot_blockdev) ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$imagedir" ]; then
|
||||||
|
imagedir="$(realpath $(dirname $0))"
|
||||||
|
[ -f "$imagedir/README.txt" ] || imagedir="/usr/share/u-boot"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$freq" -a -e /proc/device-tree/memory/ram_freq ]; then
|
||||||
|
proc_freq=$(cat /proc/device-tree/memory/ram_freq 2>/dev/null)
|
||||||
|
if [ -n "$proc_freq" ]; then
|
||||||
|
echo "Detected clock: $proc_freq MHz"
|
||||||
|
default_freq="$proc_freq"
|
||||||
|
else
|
||||||
|
echo "WARNING: Failed to read clock from /proc/device-tree/memory/ram_freq"
|
||||||
|
echo "Using default clock: $default_freq MHz"
|
||||||
|
fi
|
||||||
|
elif [ -z "$freq" ]; then
|
||||||
|
echo Using default clock: $default_freq MHz
|
||||||
|
else
|
||||||
|
echo Changing clock: $freq MHz
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
die() {
|
||||||
|
echo "ERROR: $@"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
usage() {
|
||||||
|
get_defaults
|
||||||
|
|
||||||
|
cat <<EOF
|
||||||
|
usage: $0 [-n,--dry-run] [-i,--imagedir <imagedir>] [-b|--board <board-type>] [-d|--device <device>] [-r|--ram-freq <freq>] [-s|--skip-delay]
|
||||||
|
|
||||||
|
options:
|
||||||
|
|
||||||
|
-b,--board <board> Specify the board type: pinephone, pinetab
|
||||||
|
(current default: ${board:-none})
|
||||||
|
|
||||||
|
-d,--device <device> Specify the device where to install u-boot
|
||||||
|
(current default: ${device:-none})
|
||||||
|
|
||||||
|
-i,--imagedir <imagedir> Specify u-boot image directory
|
||||||
|
(current default: ${imagedir:-none})
|
||||||
|
|
||||||
|
-n,--dry-run Print commands but don't execute them
|
||||||
|
|
||||||
|
-r,--ram-freq RAM clock speed, one of:
|
||||||
|
* 528 (default for new postmarketOS installations)
|
||||||
|
* 552 (default before v21.03 / edge 2021-04-05)
|
||||||
|
* 624
|
||||||
|
|
||||||
|
-s,--skip-delay Skip delay and flash the image immediately
|
||||||
|
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
validate_checksum() {
|
||||||
|
file="$1"
|
||||||
|
file_sha512="$file.sha512"
|
||||||
|
file_size=$(stat -c%s $file)
|
||||||
|
device="$2"
|
||||||
|
bs="$3"
|
||||||
|
seek="$4"
|
||||||
|
|
||||||
|
checksum0=$(cat $file_sha512 | awk {'print $1'})
|
||||||
|
checksum1=$(dd if=$device bs=1 skip=$(($seek * $bs)) count=$file_size status=none | sha512sum | awk {'print $1'})
|
||||||
|
if [ "$checksum0" != "$checksum1" ]; then
|
||||||
|
echo "File: $checksum0"
|
||||||
|
echo "Part: $checksum1"
|
||||||
|
die "Checksum failed"
|
||||||
|
fi
|
||||||
|
echo "Successful U-Boot image checksum verification on $device :"
|
||||||
|
echo -e "\t$checksum1"
|
||||||
|
}
|
||||||
|
|
||||||
|
while [ $# -gt 0 ]; do
|
||||||
|
opt="$1"
|
||||||
|
shift
|
||||||
|
case "$opt" in
|
||||||
|
-b|--board)
|
||||||
|
case "$1" in
|
||||||
|
pinephone) board="pinephone" ;;
|
||||||
|
pinetab) board="pinetab" ;;
|
||||||
|
pocketpc) board="pocketpc" ;;
|
||||||
|
*) usage; exit 1;;
|
||||||
|
esac
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-d|--device)
|
||||||
|
device="$1"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-i|--imagedir)
|
||||||
|
imagedir="$1"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-n|--dry-run)
|
||||||
|
dryrun="echo"
|
||||||
|
;;
|
||||||
|
-r|--ram-freq)
|
||||||
|
case "$1" in
|
||||||
|
528) freq="528" ;;
|
||||||
|
552) freq="552" ;;
|
||||||
|
624) freq="624" ;;
|
||||||
|
*) usage; exit 1;;
|
||||||
|
esac
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-s|--skip-delay)
|
||||||
|
skip_delay="yes"
|
||||||
|
;;
|
||||||
|
--)
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
-*)
|
||||||
|
usage
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
get_defaults
|
||||||
|
if [ -z "$board" -o -z "$device" -o -z "$imagedir" -o ! -e "$imagedir" ]; then
|
||||||
|
usage
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$dryrun" ]; then
|
||||||
|
if [ ! -z "$freq" ]; then
|
||||||
|
echo "/!\ Disclaimer warning:"
|
||||||
|
echo "Overclocking your device may render it unstable or prevent it to boot"
|
||||||
|
echo "If you're unable to boot your device you'll have to flash an image to a mSD card"
|
||||||
|
echo "then boot on it and update u-boot running this command:"
|
||||||
|
echo "update-u-boot -d /dev/mmcblk2"
|
||||||
|
echo
|
||||||
|
read -p "Continue? (y/n) [n]: " -n 1 -r
|
||||||
|
echo
|
||||||
|
case "$REPLY" in
|
||||||
|
y|Y) ;;
|
||||||
|
*) exit 1 ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
if [ -z "$skip_delay" ]; then
|
||||||
|
echo "Updating $board u-boot in $device in 3 seconds..."
|
||||||
|
sleep 3
|
||||||
|
else
|
||||||
|
echo "Updating $board u-boot in $device"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$freq" ]; then
|
||||||
|
freq=$default_freq
|
||||||
|
fi
|
||||||
|
|
||||||
|
(
|
||||||
|
set -e
|
||||||
|
case "$board" in
|
||||||
|
pinephone|pinetab|pocketpc)
|
||||||
|
[ -e "$imagedir/sourceparts-pocketpc/" ] || die "pocketpc images not installed, apk add u-boot-sourceparts-pocketpc"
|
||||||
|
$dryrun dd if=$imagedir/sourceparts-pocketpc/u-boot-sunxi-with-spl-$freq.bin of=$device bs=1024 seek=8 oflag=direct status=none
|
||||||
|
[ -z "$dryrun" ] && validate_checksum $imagedir/sourceparts-pocketpc/u-boot-sunxi-with-spl-$freq.bin $device 1024 8
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
$dryrun sync
|
||||||
|
) || die "U-Boot installation in $device failed"
|
||||||
|
|
||||||
|
[ -z "$dryrun" ] && echo "Completed successfully."
|
Loading…
Reference in a new issue