Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jakogut committed Jan 30, 2020
0 parents commit f674f4b
Show file tree
Hide file tree
Showing 4 changed files with 113 additions and 0 deletions.
57 changes: 57 additions & 0 deletions PKGBUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# U-Boot: Orange Pi RK3399/4
# Based on Arch Linux ARM package alarm/uboot-rock64
#
# Maintainer: Joseph Kogut <joseph.kogut@gmail.com>

buildarch=8

pkgname=uboot-orangepi-rk3399
pkgver=2019.10
_srcname=u-boot-${pkgver}
pkgrel=1
pkgdesc="U-Boot for Orange Pi RK3399/4"
arch=('aarch64')
url='http://www.denx.de/wiki/U-Boot/WebHome'
license=('GPL')
backup=('boot/boot.txt' 'boot/boot.scr')
makedepends=('bc' 'git')
install=${pkgname}.install
_commit_rkbin=5aa9a92b5652d37b323c870329103e120dfc8d87
source=("ftp://ftp.denx.de/pub/u-boot/${_srcname}.tar.bz2"
"git+https://github.com/rockchip-linux/rkbin.git#commit=$_commit_rkbin"
'boot.txt'
'mkscr')
md5sums=('216b68925ab4cf3af6a2e3aeb2c47a58'
'SKIP'
'e2869196adb467048d6e8c86fbf15fee'
'021623a04afd29ac3f368977140cfbfd')

build() {
cd ${_srcname}

unset CLFAGS CXXFLAGS CPPFLAGS LDFLAGS

make orangepi-rk3399_defconfig
echo 'CONFIG_IDENT_STRING=" Arch Linux ARM"' >> .config
make EXTRAVERSION=-${pkgrel}
}

package() {
cd ${_srcname}

mkdir -p "${pkgdir}/boot"

tools/mkimage -n rk3399 -T rksd -d ../rkbin/bin/rk33/rk3399_ddr_933MHz_v1.24.bin "${pkgdir}/boot/idbloader.img"
cat ../rkbin/bin/rk33/rk3399_miniloader_v1.24.bin >> "${pkgdir}/boot/idbloader.img"

../rkbin/tools/loaderimage --pack --uboot u-boot-dtb.bin "${pkgdir}/boot/uboot.img" 0x200000

pushd ../rkbin
tools/trust_merger ../rkbin/RKTRUST/RK3399TRUST.ini
popd

cp u-boot-dtb.bin ../rkbin/trust.img "${pkgdir}/boot"

tools/mkimage -A arm -O linux -T script -C none -n "U-Boot boot script" -d ../boot.txt "${pkgdir}/boot/boot.scr"
cp ../{boot.txt,mkscr} "${pkgdir}"/boot
}
21 changes: 21 additions & 0 deletions boot.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# After modifying, run ./mkscr

# MAC address (use spaces instead of colons)
setenv macaddr da 19 c8 7a 6d f4

part uuid ${devtype} ${devnum}:${bootpart} uuid
setenv bootargs console=ttyS2,1500000 root=PARTUUID=${uuid} rw rootwait earlycon=uart8250,mmio32,0xff1a0000
setenv fdtfile rockchip/rk3399-orangepi.dtb

if load ${devtype} ${devnum}:${bootpart} ${kernel_addr_r} /boot/Image; then
if load ${devtype} ${devnum}:${bootpart} ${fdt_addr_r} /boot/dtbs/${fdtfile}; then
fdt addr ${fdt_addr_r}
fdt resize
fdt set /ethernet@fe300000 local-mac-address "[${macaddr}]"
if load ${devtype} ${devnum}:${bootpart} ${ramdisk_addr_r} /boot/initramfs-linux.img; then
booti ${kernel_addr_r} ${ramdisk_addr_r}:${filesize} ${fdt_addr_r};
else
booti ${kernel_addr_r} - ${fdt_addr_r};
fi;
fi;
fi
9 changes: 9 additions & 0 deletions mkscr
Original file line number Diff line number Diff line change
@@ -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
26 changes: 26 additions & 0 deletions uboot-orangepi-rk3399.install
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
flash_uboot() {
echo "A new U-Boot version needs to be flashed onto /dev/mmcblk1."
echo "Do you want to do this now? [y|N]"
read -r shouldwe
if [[ $shouldwe =~ ^([yY][eE][sS]|[yY])$ ]]; then
dd if=/boot/idbloader.img of=/dev/mmcblk1 seek=64 conv=notrunc
dd if=/boot/uboot.img of=/dev/mmcblk1 seek=16384 conv=notrunc
dd if=/boot/trust.img of=/dev/mmcblk1 seek=24576 conv=notrunc
else
echo "You can do this later by running:"
echo "# dd if=/boot/idbloader.img of=/dev/mmcblk1 seek=64 conv=notrunc"
echo "# dd if=/boot/uboot.img of=/dev/mmcblk1 seek=16384 conv=notrunc"
echo "# dd if=/boot/trust.img of=/dev/mmcblk1 seek=24576 conv=notrunc"
fi
}

## arg 1: the new package version
post_install() {
flash_uboot
}

## arg 1: the new package version
## arg 2: the old package version
post_upgrade() {
flash_uboot
}

0 comments on commit f674f4b

Please sign in to comment.