From 1b5461665920e8ec460314657689021fbfd62257 Mon Sep 17 00:00:00 2001 From: nxshock Date: Fri, 5 Nov 2021 16:35:44 +0500 Subject: [PATCH] Initial commit --- .gitattributes | 2 ++ PKGBUILD | 49 ++++++++++++++++++++++++++++++++++++++++ extlinux.conf | 9 ++++++++ uboot-nanopi-r2s.install | 23 +++++++++++++++++++ 4 files changed, 83 insertions(+) create mode 100644 .gitattributes create mode 100644 PKGBUILD create mode 100644 extlinux.conf create mode 100644 uboot-nanopi-r2s.install diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..dfe0770 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# Auto detect text files and perform LF normalization +* text=auto diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 0000000..eff124c --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,49 @@ +# U-Boot: NanoPi R2S/R2C + +buildarch=8 + +pkgname=uboot-nanopi-r2s +pkgver=2021.10 +pkgrel=1 +pkgdesc="U-Boot for NanoPi R2S/R2C" +arch=('aarch64') +url='http://www.denx.de/wiki/U-Boot/WebHome' +license=('GPL') +backup=('boot/extlinux/extlinux.conf') +makedepends=('bc' 'git' 'python' 'swig' 'dtc') +install=${pkgname}.install +source=("ftp://ftp.denx.de/pub/u-boot/u-boot-${pkgver}.tar.bz2" + "https://github.com/ARM-software/arm-trusted-firmware/archive/v2.5.tar.gz" + "extlinux.conf") +md5sums=('f1392080facf59dd2c34096a5fd95d4c' + 'a3c01d2a73d5171e3f1c0737ff5321d9' + 'faf2b85206cb66c31f7c97da7b2b281d') + +prepare() { + cd ${srcdir}/arm-trusted-firmware-2.5 + make PLAT=rk3328 + + cd ${srcdir}/u-boot-${pkgver} + + cd ${srcdir}/u-boot-${pkgver}/configs + echo 'CONFIG_IDENT_STRING=" Arch Linux ARM"' >> nanopi-r2s-rk3328_defconfig +} + +build() { + cd ${srcdir}/u-boot-${pkgver} + + unset CLFAGS CXXFLAGS CPPFLAGS LDFLAGS + export BL31=../arm-trusted-firmware-2.5/build/rk3328/release/bl31/bl31.elf + + make nanopi-r2s-rk3328_defconfig + make +} + +package() { + cd u-boot-${pkgver} + + mkdir -p "${pkgdir}/boot/extlinux" + + cp ./u-boot-rockchip.bin "${pkgdir}/boot/u-boot-rockchip.bin" + cp ${srcdir}/extlinux.conf "${pkgdir}/boot/extlinux/extlinux.conf" +} diff --git a/extlinux.conf b/extlinux.conf new file mode 100644 index 0000000..5505ed5 --- /dev/null +++ b/extlinux.conf @@ -0,0 +1,9 @@ +timeout 3 + +default Arch + +label Arch + linux /Image + fdt /dtbs/rockchip/rk3328-nanopi-r2s.dtb + append console=ttyS2,1500000 root=/dev/mmcblk0p1 rw rootwait earlycon=uart8250,mmio32,0xff130000 + initrd /initramfs-linux.img diff --git a/uboot-nanopi-r2s.install b/uboot-nanopi-r2s.install new file mode 100644 index 0000000..5e469a2 --- /dev/null +++ b/uboot-nanopi-r2s.install @@ -0,0 +1,23 @@ +flash_uboot() { + echo "A new U-Boot version needs to be flashed onto /dev/mmcblk0." + echo "Do you want to do this now? [y|N]" + read -r shouldwe + if [[ $shouldwe =~ ^([yY][eE][sS]|[yY])$ ]]; then + dd if=/boot/u-boot-rockchip.bin of=/dev/mmcblk0 seek=64 conv=notrunc + else + echo "You can do this later by running:" + echo "# dd if=/boot/u-boot-rockchip.bin of=/dev/mmcblk0 seek=64 conv=notrunc" + echo "# if you are using the emmc interface, take care to use the correct device identifier! (probably mmcblk1)" + 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 +}