From 86ab7504d64668fba7ccf779e48bc08cdc1da53e Mon Sep 17 00:00:00 2001 From: Kevin Mihelich Date: Thu, 16 Nov 2017 02:27:09 +0000 Subject: [PATCH] added alarm/uboot-veyron --- ...CONFIG_SYS_TEXT_BASE-for-depthcharge.patch | 25 +++++ ...-minnie-Add-a-.its-file-for-chromium.patch | 61 ++++++++++++ ...-mickey-Add-a-.its-file-for-chromium.patch | 61 ++++++++++++ .../0004-dtoc-python2-compatibility.patch | 25 +++++ alarm/uboot-veyron/PKGBUILD | 95 +++++++++++++++++++ alarm/uboot-veyron/boot.txt | 18 ++++ alarm/uboot-veyron/mkscr | 9 ++ alarm/uboot-veyron/uboot-veyron.install | 25 +++++ 8 files changed, 319 insertions(+) create mode 100644 alarm/uboot-veyron/0001-rk3288-set-CONFIG_SYS_TEXT_BASE-for-depthcharge.patch create mode 100644 alarm/uboot-veyron/0002-rockchip-minnie-Add-a-.its-file-for-chromium.patch create mode 100644 alarm/uboot-veyron/0003-rockchip-mickey-Add-a-.its-file-for-chromium.patch create mode 100644 alarm/uboot-veyron/0004-dtoc-python2-compatibility.patch create mode 100644 alarm/uboot-veyron/PKGBUILD create mode 100644 alarm/uboot-veyron/boot.txt create mode 100755 alarm/uboot-veyron/mkscr create mode 100644 alarm/uboot-veyron/uboot-veyron.install diff --git a/alarm/uboot-veyron/0001-rk3288-set-CONFIG_SYS_TEXT_BASE-for-depthcharge.patch b/alarm/uboot-veyron/0001-rk3288-set-CONFIG_SYS_TEXT_BASE-for-depthcharge.patch new file mode 100644 index 000000000..e6efa5640 --- /dev/null +++ b/alarm/uboot-veyron/0001-rk3288-set-CONFIG_SYS_TEXT_BASE-for-depthcharge.patch @@ -0,0 +1,25 @@ +From c359ae27d1c204cf2594c357f3abf22e343d6ec8 Mon Sep 17 00:00:00 2001 +From: Kevin Mihelich +Date: Mon, 7 Aug 2017 23:10:58 -0600 +Subject: [PATCH 1/4] rk3288: set CONFIG_SYS_TEXT_BASE for depthcharge + +--- + include/configs/rk3288_common.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/include/configs/rk3288_common.h b/include/configs/rk3288_common.h +index c7757f023f..07e51bafb1 100644 +--- a/include/configs/rk3288_common.h ++++ b/include/configs/rk3288_common.h +@@ -27,7 +27,7 @@ + /* Bootrom will load u-boot binary to 0x0 once return from SPL */ + #define CONFIG_SYS_TEXT_BASE 0x00000000 + #else +-#define CONFIG_SYS_TEXT_BASE 0x00100000 ++#define CONFIG_SYS_TEXT_BASE 0x02000100 + #endif + #define CONFIG_SYS_INIT_SP_ADDR 0x00100000 + #define CONFIG_SYS_LOAD_ADDR 0x00800800 +-- +2.14.1 + diff --git a/alarm/uboot-veyron/0002-rockchip-minnie-Add-a-.its-file-for-chromium.patch b/alarm/uboot-veyron/0002-rockchip-minnie-Add-a-.its-file-for-chromium.patch new file mode 100644 index 000000000..25dc0749e --- /dev/null +++ b/alarm/uboot-veyron/0002-rockchip-minnie-Add-a-.its-file-for-chromium.patch @@ -0,0 +1,61 @@ +From 8fe64bf19f3341886fdc4edd727fd3773a131100 Mon Sep 17 00:00:00 2001 +From: Kevin Mihelich +Date: Tue, 8 Aug 2017 18:40:45 -0600 +Subject: [PATCH 2/4] rockchip: minnie: Add a .its file for chromium + +--- + doc/chromium/chromebook_minnie.its | 42 ++++++++++++++++++++++++++++++++++++++ + 1 file changed, 42 insertions(+) + create mode 100644 doc/chromium/chromebook_minnie.its + +diff --git a/doc/chromium/chromebook_minnie.its b/doc/chromium/chromebook_minnie.its +new file mode 100644 +index 0000000000..0efc1f0bdf +--- /dev/null ++++ b/doc/chromium/chromebook_minnie.its +@@ -0,0 +1,42 @@ ++/dts-v1/; ++ ++/ { ++ description = "U-Boot mainline"; ++ #address-cells = <1>; ++ ++ images { ++ kernel@1 { ++ description = "U-Boot mainline"; ++ type = "kernel_noload"; ++ arch = "arm"; ++ os = "linux"; ++ data = /incbin/("../../b/chromebook_minnie/u-boot.bin"); ++ compression = "none"; ++ load = <0>; ++ entry = <0>; ++ hash@2 { ++ algo = "sha1"; ++ }; ++ }; ++ ++ fdt@1{ ++ description = "rk3288-veryron-minnie.dtb"; ++ data = /incbin/("../../b/chromebook_minnie/u-boot.dtb"); ++ type = "flat_dt"; ++ arch = "arm"; ++ compression = "none"; ++ hash@1{ ++ algo = "sha1"; ++ }; ++ }; ++ }; ++ ++ configurations { ++ default = "config@1"; ++ config@1 { ++ description = "Boot U-Boot"; ++ kernel = "kernel@1"; ++ fdt = "fdt@1"; ++ }; ++ }; ++}; +-- +2.14.1 + diff --git a/alarm/uboot-veyron/0003-rockchip-mickey-Add-a-.its-file-for-chromium.patch b/alarm/uboot-veyron/0003-rockchip-mickey-Add-a-.its-file-for-chromium.patch new file mode 100644 index 000000000..0d913f2db --- /dev/null +++ b/alarm/uboot-veyron/0003-rockchip-mickey-Add-a-.its-file-for-chromium.patch @@ -0,0 +1,61 @@ +From 42325e59c81bf8892280d6da0831df314ae4663c Mon Sep 17 00:00:00 2001 +From: Kevin Mihelich +Date: Tue, 8 Aug 2017 18:43:03 -0600 +Subject: [PATCH 3/4] rockchip: mickey: Add a .its file for chromium + +--- + doc/chromium/chromebit_mickey.its | 42 +++++++++++++++++++++++++++++++++++++++ + 1 file changed, 42 insertions(+) + create mode 100644 doc/chromium/chromebit_mickey.its + +diff --git a/doc/chromium/chromebit_mickey.its b/doc/chromium/chromebit_mickey.its +new file mode 100644 +index 0000000000..44174a5edd +--- /dev/null ++++ b/doc/chromium/chromebit_mickey.its +@@ -0,0 +1,42 @@ ++/dts-v1/; ++ ++/ { ++ description = "U-Boot mainline"; ++ #address-cells = <1>; ++ ++ images { ++ kernel@1 { ++ description = "U-Boot mainline"; ++ type = "kernel_noload"; ++ arch = "arm"; ++ os = "linux"; ++ data = /incbin/("../../b/chromebit_mickey/u-boot.bin"); ++ compression = "none"; ++ load = <0>; ++ entry = <0>; ++ hash@2 { ++ algo = "sha1"; ++ }; ++ }; ++ ++ fdt@1{ ++ description = "rk3288-veyron-mickey.dtb"; ++ data = /incbin/("../../b/chromebit_mickey/u-boot.dtb"); ++ type = "flat_dt"; ++ arch = "arm"; ++ compression = "none"; ++ hash@1{ ++ algo = "sha1"; ++ }; ++ }; ++ }; ++ ++ configurations { ++ default = "config@1"; ++ config@1 { ++ description = "Boot U-Boot"; ++ kernel = "kernel@1"; ++ fdt = "fdt@1"; ++ }; ++ }; ++}; +-- +2.14.1 + diff --git a/alarm/uboot-veyron/0004-dtoc-python2-compatibility.patch b/alarm/uboot-veyron/0004-dtoc-python2-compatibility.patch new file mode 100644 index 000000000..a891ee5bb --- /dev/null +++ b/alarm/uboot-veyron/0004-dtoc-python2-compatibility.patch @@ -0,0 +1,25 @@ +From 0e89248a96f4f1ec2825b9c14a86b87c6490f04e Mon Sep 17 00:00:00 2001 +From: Kevin Mihelich +Date: Wed, 6 Sep 2017 21:29:42 -0600 +Subject: [PATCH 4/4] dtoc: python2 compatibility + +--- + scripts/Makefile.spl | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl +index dd8065d87d..93ed4f00dd 100644 +--- a/scripts/Makefile.spl ++++ b/scripts/Makefile.spl +@@ -246,7 +246,7 @@ quiet_cmd_fdtgrep = FDTGREP $@ + $(obj)/$(SPL_BIN).dtb: dts/dt.dtb $(objtree)/tools/fdtgrep FORCE + $(call if_changed,fdtgrep) + +-pythonpath = PYTHONPATH=tools ++pythonpath = PYTHONPATH=tools $(PYTHON) + + quiet_cmd_dtocc = DTOC C $@ + cmd_dtocc = $(pythonpath) $(srctree)/tools/dtoc/dtoc -d $(obj)/$(SPL_BIN).dtb -o $@ platdata +-- +2.14.1 + diff --git a/alarm/uboot-veyron/PKGBUILD b/alarm/uboot-veyron/PKGBUILD new file mode 100644 index 000000000..20b5e0de8 --- /dev/null +++ b/alarm/uboot-veyron/PKGBUILD @@ -0,0 +1,95 @@ +# U-Boot: Veyron Chromebooks +# Maintainer: Kevin Mihelich + +buildarch=4 + +pkgbase=uboot-veyron +pkgname=('uboot-minnie' 'uboot-mickey' 'uboot-jerry') +pkgver=2017.11 +pkgrel=1 +arch=('armv7h') +url="http://git.denx.de/u-boot.git/" +license=('GPL') +makedepends=('git' 'bc' 'dtc' 'vboot-utils' 'python2' 'swig') +conflicts=('linux-veyron' 'linux-armv7-chromebook') +install=${pkgbase}.install +source=("ftp://ftp.denx.de/pub/u-boot/u-boot-${pkgver/rc/-rc}.tar.bz2" + '0001-rk3288-set-CONFIG_SYS_TEXT_BASE-for-depthcharge.patch' + '0002-rockchip-minnie-Add-a-.its-file-for-chromium.patch' + '0003-rockchip-mickey-Add-a-.its-file-for-chromium.patch' + '0004-dtoc-python2-compatibility.patch' + 'boot.txt' + 'mkscr') +md5sums=('7848f6fd197e2c6ef2eb483dd5bd2858' + '1ff4ad552e1c5d32ff0a561f2d6ac702' + 'a7560967318753fbb2a60b0e15c5254d' + '612a0be69d8d55187ffe1782802cf566' + 'b2080e9a988a5be5356ef1f782ec23f2' + '029cb473f59f08834b54cdc3e34c9672' + '021623a04afd29ac3f368977140cfbfd') + +prepare() { + cd u-boot-${pkgver/rc/-rc} + git apply ../0001-rk3288-set-CONFIG_SYS_TEXT_BASE-for-depthcharge.patch + git apply ../0002-rockchip-minnie-Add-a-.its-file-for-chromium.patch + git apply ../0003-rockchip-mickey-Add-a-.its-file-for-chromium.patch + git apply ../0004-dtoc-python2-compatibility.patch +} + +build() { + cd u-boot-${pkgver/rc/-rc} + + unset LDFLAGS CFLAGS CXXFLAGS + export PYTHON=/usr/bin/python2 + + for i in chromebook_minnie chromebit_mickey chromebook_jerry; do + msg ${i} + make O=b/${i} ${i}_defconfig + echo 'CONFIG_IDENT_STRING=" Arch Linux ARM"' >> b/${i}/.config + make O=b/${i} EXTRAVERSION=-${pkgrel} + done +} + +common_package() { + name=$1 + dtb=$2 + + cd u-boot-${pkgver/rc/-rc} + + b/${name}/tools/mkimage -f doc/chromium/${name}.its uboot.img + echo "" > config + dd if=/dev/zero of=bootloader.bin bs=512 count=1 + vbutil_kernel \ + --pack uboot.kpart \ + --version 1 \ + --vmlinuz uboot.img \ + --arch arm \ + --keyblock doc/chromium/devkeys/kernel.keyblock \ + --signprivate doc/chromium/devkeys/kernel_data_key.vbprivk \ + --config config \ + --bootloader bootloader.bin + install -Dm644 uboot.kpart "${pkgdir}"/boot/uboot.kpart + + install -Dm644 ../boot.txt "${pkgdir}"/boot/boot.txt + sed -i "s/@@FDTFILE@@/${dtb}/" "${pkgdir}"/boot/boot.txt + b/${name}/tools/mkimage -A arm -O linux -T script -C none -n "U-Boot boot script" -d "${pkgdir}"/boot/boot.txt "${pkgdir}"/boot/boot.scr + install -Dm755 ../mkscr "${pkgdir}"/boot/mkscr +} + +package_uboot-minnie() { + pkgdesc="U-Boot for Veyron Minnie Chromebook" + + common_package "chromebook_minnie" "rk3288-veyron-minnie.dtb" +} + +package_uboot-mickey() { + pkgdesc="U-Boot for Veyron Mickey Chromebit" + + common_package "chromebit_mickey" "rk3288-veyron-mickey.dtb" +} + +package_uboot-jerry() { + pkgdesc="U-Boot for Veyron Jerry Chromebook" + + common_package "chromebook_jerry" "rk3288-veyron-jerry.dtb" +} diff --git a/alarm/uboot-veyron/boot.txt b/alarm/uboot-veyron/boot.txt new file mode 100644 index 000000000..1c0a24375 --- /dev/null +++ b/alarm/uboot-veyron/boot.txt @@ -0,0 +1,18 @@ +# After modifying, run ./mkscr + +if test -n ${distro_bootpart}; then setenv bootpart ${distro_bootpart}; else setenv bootpart 1; fi +part uuid ${devtype} ${devnum}:${bootpart} uuid + +setenv bootargs console=tty0 root=PARTUUID=${uuid} rw rootwait + +setenv fdtfile @@FDTFILE@@ + +if load ${devtype} ${devnum}:${bootpart} ${kernel_addr_r} /boot/zImage; then + if load ${devtype} ${devnum}:${bootpart} ${fdt_addr_r} /boot/dtbs/${fdtfile}; then + if load ${devtype} ${devnum}:${bootpart} ${ramdisk_addr_r} /boot/initramfs-linux.img; then + bootz ${kernel_addr_r} ${ramdisk_addr_r}:${filesize} ${fdt_addr_r}; + else + bootz ${kernel_addr_r} - ${fdt_addr_r}; + fi; + fi; +fi diff --git a/alarm/uboot-veyron/mkscr b/alarm/uboot-veyron/mkscr new file mode 100755 index 000000000..272b6a7a5 --- /dev/null +++ b/alarm/uboot-veyron/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 diff --git a/alarm/uboot-veyron/uboot-veyron.install b/alarm/uboot-veyron/uboot-veyron.install new file mode 100644 index 000000000..1a1fd7b24 --- /dev/null +++ b/alarm/uboot-veyron/uboot-veyron.install @@ -0,0 +1,25 @@ +flash_uboot() { + major=$(mountpoint -d / | cut -f 1 -d ':') + minor=$(mountpoint -d / | cut -f 2 -d ':') + device=$(cat /proc/partitions | awk {'if ($1 == "'${major}'" && $2 == "'${minor}'") print $4 '}) + device="/dev/${device/%2/1}" + + echo "A new U-Boot version needs to be flashed onto ${device}." + echo "Do you want to do this now? [y|N]" + read -r shouldwe + if [[ $shouldwe =~ ^([yY][eE][sS]|[yY])$ ]]; then + dd if=/boot/uboot.kpart of=${device} + sync + else + echo "You can do this later by running:" + echo "# dd if=/boot/uboot.kpart of=${device}" + fi +} + +post_install() { + flash_uboot +} + +post_upgrade() { + flash_uboot +}