summaryrefslogtreecommitdiff
path: root/libre
diff options
context:
space:
mode:
authorDenis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>2021-01-06 22:57:20 +0100
committerDenis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>2021-02-03 00:17:47 +0100
commit0a65e2a74db2ccc00dbf2c18f80f147ea29a99e6 (patch)
tree804a482227af970af5d30d4eb108f5ef6c193f3d /libre
parent1f2f68301569e4918d2d1da122ff241f93561ab8 (diff)
downloadabslibre-0a65e2a74db2ccc00dbf2c18f80f147ea29a99e6.tar.gz
abslibre-0a65e2a74db2ccc00dbf2c18f80f147ea29a99e6.tar.bz2
abslibre-0a65e2a74db2ccc00dbf2c18f80f147ea29a99e6.zip
[WIP] Enable cross build of u-boot
TODO: - Create a hook script - Finish the u-boot-sunxi-install script - Add dependencies for the install script (utils-linux) - Test on real hardware (lime2, pcduino-lite) Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
Diffstat (limited to 'libre')
-rw-r--r--libre/uboot4extlinux-sunxi/PKGBUILD298
-rwxr-xr-xlibre/uboot4extlinux-sunxi/install-uboot4extlinux.sh.in88
-rw-r--r--libre/uboot4extlinux-sunxi/uboot4extlinux-sunxi.hook12
3 files changed, 306 insertions, 92 deletions
diff --git a/libre/uboot4extlinux-sunxi/PKGBUILD b/libre/uboot4extlinux-sunxi/PKGBUILD
index f3d069855..a80a318d6 100644
--- a/libre/uboot4extlinux-sunxi/PKGBUILD
+++ b/libre/uboot4extlinux-sunxi/PKGBUILD
@@ -2,8 +2,11 @@
# Maintainer: Isaac David <isacdaavid@at@isacdaavid@dot@info>
# Contributor: André Silva <emulatorman@hyperbola.info>
# Contributor: Timothy Redaelli <timothy.redaelli@gmail.com>
+# Contributor: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
pkgbase=uboot4extlinux-sunxi
+pkgname=('uboot4extlinux-a10-olinuxino-lime')
+
pkgname=('uboot4extlinux-a10-olinuxino-lime'
'uboot4extlinux-a10s-olinuxino-m'
'uboot4extlinux-a13-olinuxino'
@@ -25,16 +28,23 @@ pkgname=('uboot4extlinux-a10-olinuxino-lime'
'uboot4extlinux-orangepi_one'
'uboot4extlinux-orangepi_pc'
'uboot4extlinux-orangepi_plus')
+
pkgver=2020.04
pkgrel=1
-arch=('armv7h')
+arch=('armv7h' 'i686' 'x86_64')
url="http://git.denx.de/u-boot.git/"
license=('GPL')
makedepends=('bc' 'dtc' 'python' 'python2' 'swig')
+makedepends_i686+=('arm-none-eabi-gcc')
+makedepends_x86_64+=('arm-none-eabi-gcc')
backup=(boot/extlinux/extlinux.conf)
source=("ftp://ftp.denx.de/pub/u-boot/u-boot-${pkgver}.tar.bz2"
- 'extlinux.conf')
+ 'extlinux.conf'
+ 'uboot4extlinux-sunxi.install'
+ 'install-uboot4extlinux.sh.in')
sha256sums=('fe732aaf037d9cc3c0909bad8362af366ae964bbdac6913a34081ff4ad565372'
+ 'SKIP'
+ 'SKIP'
'SKIP')
boards=('A10-OLinuXino-Lime'
@@ -59,32 +69,56 @@ boards=('A10-OLinuXino-Lime'
'orangepi_pc'
'orangepi_plus')
+# Offset at which to install u-boot
+u_boot_with_spl_offset=8192
+
+case "$CARCH" in
+ armv7h) ARCH=arm;;
+ i686) ARCH=arm;CROSS_COMPILE=arm-none-eabi-;;
+esac
+
build() {
+echo
cd u-boot-${pkgver}
unset CFLAGS CXXFLAGS LDFLAGS
+ # Used to store the result for each "board"
+ rm -rf build
+ install -d build
+
for i in ${boards[@]}; do
- mkdir -p ../bin_${i}
- make distclean
- make ${i}_defconfig
+ make "ARCH=${ARCH}" distclean
+ make "ARCH=${ARCH}" ${i}_defconfig
echo 'CONFIG_IDENT_STRING=" Parabola GNU/Linux-libre"' >> .config
- make EXTRAVERSION=-${pkgrel}
- mv -f u-boot-sunxi-with-spl.bin ../bin_${i}
+ if [ "$CARCH" = "i686" ]; then
+ make "ARCH=${ARCH}" "CROSS_COMPILE=${CROSS_COMPILE}" EXTRAVERSION=-${pkgrel}
+ else
+ make "ARCH=${ARCH}" EXTRAVERSION=-${pkgrel}
+ fi
+
+ _target_pkgname="uboot4extlinux-$(echo ${i} | awk '{print tolower($0)}')"
+ _destdir="build/${_target_pkgname}"
+ install -d ${_destdir}
+ mv -f u-boot-sunxi-with-spl.bin "${_destdir}"
done
}
package_uboot4extlinux-a10-olinuxino-lime() {
pkgdesc="U-Boot with Extlinux support for A10 OLinuXino Lime"
- install=${pkgbase}.install
provides=('uboot4extlinux-sunxi')
conflicts=('uboot-sunxi' 'uboot4extlinux-sunxi' 'uboot4grub-sunxi')
+ install=${pkgbase}.install
- install -d "${pkgdir}"/boot/extlinux
- install -d "${pkgdir}"/boot/u-boot/images/
- install -Dm644 bin_A10-OLinuXino-Lime/u-boot-sunxi-with-spl.bin "${pkgdir}"/boot/u-boot/images/
+ cd "u-boot-${pkgver}"
- install -Dm644 extlinux.conf "${pkgdir}"/boot/extlinux
+ install -d "${pkgdir}/usr/lib/u-boot/${pkgname}/"
+ install -Dm644 "build/${pkgname}/u-boot-sunxi-with-spl.bin" "${pkgdir}/usr/lib/u-boot/${pkgname}"
+ install -Dm644 "${srcdir}/extlinux.conf" "${pkgdir}/usr/lib/u-boot/${pkgname}"
+
+ sed < "$srcdir/install-uboot4extlinux.sh.in" > "${pkgdir}/usr/lib/u-boot/${pkgname}/install-uboot4extlinux.sh" \
+ -e "s|@u_boot_with_spl[@]|/usr/lib/u-boot/${pkgname}/u-boot-sunxi-with-spl.bin|g" \
+ -e "s|@u_boot_with_spl_offset[@]|${u_boot_with_spl_offset}|g"
}
package_uboot4extlinux-a10s-olinuxino-m() {
@@ -94,11 +128,15 @@ package_uboot4extlinux-a10s-olinuxino-m() {
conflicts=('uboot-sunxi' 'uboot4extlinux-sunxi' 'uboot4grub-sunxi')
replaces=('uboot4extlinux-a10s-olinuxino-micro')
- install -d "${pkgdir}"/boot/extlinux
- install -d "${pkgdir}"/boot/u-boot/images/
- install -Dm644 bin_A10s-OLinuXino-M/u-boot-sunxi-with-spl.bin "${pkgdir}"/boot/u-boot/images/
+ cd "u-boot-${pkgver}"
+
+ install -d "${pkgdir}/usr/lib/u-boot/${pkgname}/"
+ install -Dm644 "build/${pkgname}/u-boot-sunxi-with-spl.bin" "${pkgdir}/usr/lib/u-boot/${pkgname}"
+ install -Dm644 "${srcdir}/extlinux.conf" "${pkgdir}/usr/lib/u-boot/${pkgname}"
- install -Dm644 extlinux.conf "${pkgdir}"/boot/extlinux
+ sed < "$srcdir/install-uboot4extlinux.sh.in" > "${pkgdir}/usr/lib/u-boot/${pkgname}/install-uboot4extlinux.sh" \
+ -e "s|@u_boot_with_spl[@]|/usr/lib/u-boot/${pkgname}/u-boot-sunxi-with-spl.bin|g" \
+ -e "s|@u_boot_with_spl_offset[@]|${u_boot_with_spl_offset}|g"
}
package_uboot4extlinux-a13-olinuxino() {
@@ -107,11 +145,15 @@ package_uboot4extlinux-a13-olinuxino() {
provides=('uboot4extlinux-sunxi')
conflicts=('uboot-sunxi' 'uboot4extlinux-sunxi' 'uboot4grub-sunxi')
- install -d "${pkgdir}"/boot/extlinux
- install -d "${pkgdir}"/boot/u-boot/images/
- install -Dm644 bin_A13-OLinuXino/u-boot-sunxi-with-spl.bin "${pkgdir}"/boot/u-boot/images/
+ cd "u-boot-${pkgver}"
- install -Dm644 extlinux.conf "${pkgdir}"/boot/extlinux
+ install -d "${pkgdir}/usr/lib/u-boot/${pkgname}/"
+ install -Dm644 "build/${pkgname}/u-boot-sunxi-with-spl.bin" "${pkgdir}/usr/lib/u-boot/${pkgname}"
+ install -Dm644 "${srcdir}/extlinux.conf" "${pkgdir}/usr/lib/u-boot/${pkgname}"
+
+ sed < "$srcdir/install-uboot4extlinux.sh.in" > "${pkgdir}/usr/lib/u-boot/${pkgname}/install-uboot4extlinux.sh" \
+ -e "s|@u_boot_with_spl[@]|/usr/lib/u-boot/${pkgname}/u-boot-sunxi-with-spl.bin|g" \
+ -e "s|@u_boot_with_spl_offset[@]|${u_boot_with_spl_offset}|g"
}
package_uboot4extlinux-a13-olinuxinom() {
@@ -121,11 +163,15 @@ package_uboot4extlinux-a13-olinuxinom() {
conflicts=('uboot-sunxi' 'uboot4extlinux-sunxi' 'uboot4grub-sunxi')
replaces=('uboot4extlinux-a13-olinuxino-micro')
- install -d "${pkgdir}"/boot/extlinux
- install -d "${pkgdir}"/boot/u-boot/images/
- install -Dm644 bin_A13-OLinuXinoM/u-boot-sunxi-with-spl.bin "${pkgdir}"/boot/u-boot/images/
+ cd "u-boot-${pkgver}"
+
+ install -d "${pkgdir}/usr/lib/u-boot/${pkgname}/"
+ install -Dm644 "build/${pkgname}/u-boot-sunxi-with-spl.bin" "${pkgdir}/usr/lib/u-boot/${pkgname}"
+ install -Dm644 "${srcdir}/extlinux.conf" "${pkgdir}/usr/lib/u-boot/${pkgname}"
- install -Dm644 extlinux.conf "${pkgdir}"/boot/extlinux
+ sed < "$srcdir/install-uboot4extlinux.sh.in" > "${pkgdir}/usr/lib/u-boot/${pkgname}/install-uboot4extlinux.sh" \
+ -e "s|@u_boot_with_spl[@]|/usr/lib/u-boot/${pkgname}/u-boot-sunxi-with-spl.bin|g" \
+ -e "s|@u_boot_with_spl_offset[@]|${u_boot_with_spl_offset}|g"
}
package_uboot4extlinux-a20-olinuxino-lime() {
@@ -134,11 +180,15 @@ package_uboot4extlinux-a20-olinuxino-lime() {
provides=('uboot4extlinux-sunxi')
conflicts=('uboot-sunxi' 'uboot4extlinux-sunxi' 'uboot4grub-sunxi')
- install -d "${pkgdir}"/boot/extlinux
- install -d "${pkgdir}"/boot/u-boot/images/
- install -Dm644 bin_A20-OLinuXino-Lime/u-boot-sunxi-with-spl.bin "${pkgdir}"/boot/u-boot/images/
+ cd "u-boot-${pkgver}"
- install -Dm644 extlinux.conf "${pkgdir}"/boot/extlinux
+ install -d "${pkgdir}/usr/lib/u-boot/${pkgname}/"
+ install -Dm644 "build/${pkgname}/u-boot-sunxi-with-spl.bin" "${pkgdir}/usr/lib/u-boot/${pkgname}"
+ install -Dm644 "${srcdir}/extlinux.conf" "${pkgdir}/usr/lib/u-boot/${pkgname}"
+
+ sed < "$srcdir/install-uboot4extlinux.sh.in" > "${pkgdir}/usr/lib/u-boot/${pkgname}/install-uboot4extlinux.sh" \
+ -e "s|@u_boot_with_spl[@]|/usr/lib/u-boot/${pkgname}/u-boot-sunxi-with-spl.bin|g" \
+ -e "s|@u_boot_with_spl_offset[@]|${u_boot_with_spl_offset}|g"
}
package_uboot4extlinux-a20-olinuxino-lime2() {
@@ -147,11 +197,15 @@ package_uboot4extlinux-a20-olinuxino-lime2() {
provides=('uboot4extlinux-sunxi')
conflicts=('uboot-sunxi' 'uboot4extlinux-sunxi' 'uboot4grub-sunxi')
- install -d "${pkgdir}"/boot/extlinux
- install -d "${pkgdir}"/boot/u-boot/images/
- install -Dm644 bin_A20-OLinuXino-Lime2/u-boot-sunxi-with-spl.bin "${pkgdir}"/boot/u-boot/images/
+ cd "u-boot-${pkgver}"
+
+ install -d "${pkgdir}/usr/lib/u-boot/${pkgname}/"
+ install -Dm644 "build/${pkgname}/u-boot-sunxi-with-spl.bin" "${pkgdir}/usr/lib/u-boot/${pkgname}"
+ install -Dm644 "${srcdir}/extlinux.conf" "${pkgdir}/usr/lib/u-boot/${pkgname}"
- install -Dm644 extlinux.conf "${pkgdir}"/boot/extlinux
+ sed < "$srcdir/install-uboot4extlinux.sh.in" > "${pkgdir}/usr/lib/u-boot/${pkgname}/install-uboot4extlinux.sh" \
+ -e "s|@u_boot_with_spl[@]|/usr/lib/u-boot/${pkgname}/u-boot-sunxi-with-spl.bin|g" \
+ -e "s|@u_boot_with_spl_offset[@]|${u_boot_with_spl_offset}|g"
}
package_uboot4extlinux-a20-olinuxino-lime2-emmc() {
@@ -160,11 +214,15 @@ package_uboot4extlinux-a20-olinuxino-lime2-emmc() {
provides=('uboot4extlinux-sunxi')
conflicts=('uboot-sunxi' 'uboot4extlinux-sunxi' 'uboot4grub-sunxi')
- install -d "${pkgdir}"/boot/extlinux
- install -d "${pkgdir}"/boot/u-boot/images/
- install -Dm644 bin_A20-OLinuXino-Lime2-eMMC/u-boot-sunxi-with-spl.bin "${pkgdir}"/boot/u-boot/images/
+ cd "u-boot-${pkgver}"
+
+ install -d "${pkgdir}/usr/lib/u-boot/${pkgname}/"
+ install -Dm644 "build/${pkgname}/u-boot-sunxi-with-spl.bin" "${pkgdir}/usr/lib/u-boot/${pkgname}"
+ install -Dm644 "${srcdir}/extlinux.conf" "${pkgdir}/usr/lib/u-boot/${pkgname}"
- install -Dm644 extlinux.conf "${pkgdir}"/boot/extlinux
+ sed < "$srcdir/install-uboot4extlinux.sh.in" > "${pkgdir}/usr/lib/u-boot/${pkgname}/install-uboot4extlinux.sh" \
+ -e "s|@u_boot_with_spl[@]|/usr/lib/u-boot/${pkgname}/u-boot-sunxi-with-spl.bin|g" \
+ -e "s|@u_boot_with_spl_offset[@]|${u_boot_with_spl_offset}|g"
}
package_uboot4extlinux-a20-olinuxino_micro() {
@@ -174,11 +232,15 @@ package_uboot4extlinux-a20-olinuxino_micro() {
conflicts=('uboot-sunxi' 'uboot4extlinux-sunxi' 'uboot4grub-sunxi')
replaces=('uboot-a20-olinuxino-micro')
- install -d "${pkgdir}"/boot/extlinux
- install -d "${pkgdir}"/boot/u-boot/images/
- install -Dm644 bin_A20-OLinuXino_MICRO/u-boot-sunxi-with-spl.bin "${pkgdir}"/boot/u-boot/images/
+ cd "u-boot-${pkgver}"
- install -Dm644 extlinux.conf "${pkgdir}"/boot/extlinux
+ install -d "${pkgdir}/usr/lib/u-boot/${pkgname}/"
+ install -Dm644 "build/${pkgname}/u-boot-sunxi-with-spl.bin" "${pkgdir}/usr/lib/u-boot/${pkgname}"
+ install -Dm644 "${srcdir}/extlinux.conf" "${pkgdir}/usr/lib/u-boot/${pkgname}"
+
+ sed < "$srcdir/install-uboot4extlinux.sh.in" > "${pkgdir}/usr/lib/u-boot/${pkgname}/install-uboot4extlinux.sh" \
+ -e "s|@u_boot_with_spl[@]|/usr/lib/u-boot/${pkgname}/u-boot-sunxi-with-spl.bin|g" \
+ -e "s|@u_boot_with_spl_offset[@]|${u_boot_with_spl_offset}|g"
}
package_uboot4extlinux-bananapi() {
@@ -187,11 +249,15 @@ package_uboot4extlinux-bananapi() {
provides=('uboot4extlinux-sunxi')
conflicts=('uboot-sunxi' 'uboot4extlinux-sunxi' 'uboot4grub-sunxi')
- install -d "${pkgdir}"/boot/extlinux
- install -d "${pkgdir}"/boot/u-boot/images/
- install -Dm644 bin_Bananapi/u-boot-sunxi-with-spl.bin "${pkgdir}"/boot/u-boot/images/
+ cd "u-boot-${pkgver}"
+
+ install -d "${pkgdir}/usr/lib/u-boot/${pkgname}/"
+ install -Dm644 "build/${pkgname}/u-boot-sunxi-with-spl.bin" "${pkgdir}/usr/lib/u-boot/${pkgname}"
+ install -Dm644 "${srcdir}/extlinux.conf" "${pkgdir}/usr/lib/u-boot/${pkgname}"
- install -Dm644 extlinux.conf "${pkgdir}"/boot/extlinux
+ sed < "$srcdir/install-uboot4extlinux.sh.in" > "${pkgdir}/usr/lib/u-boot/${pkgname}/install-uboot4extlinux.sh" \
+ -e "s|@u_boot_with_spl[@]|/usr/lib/u-boot/${pkgname}/u-boot-sunxi-with-spl.bin|g" \
+ -e "s|@u_boot_with_spl_offset[@]|${u_boot_with_spl_offset}|g"
}
package_uboot4extlinux-bananapro() {
@@ -200,11 +266,15 @@ package_uboot4extlinux-bananapro() {
provides=('uboot4extlinux-sunxi')
conflicts=('uboot-sunxi' 'uboot4extlinux-sunxi' 'uboot4grub-sunxi')
- install -d "${pkgdir}"/boot/extlinux
- install -d "${pkgdir}"/boot/u-boot/images/
- install -Dm644 bin_Bananapro/u-boot-sunxi-with-spl.bin "${pkgdir}"/boot/u-boot/images/
+ cd "u-boot-${pkgver}"
- install -Dm644 extlinux.conf "${pkgdir}"/boot/extlinux
+ install -d "${pkgdir}/usr/lib/u-boot/${pkgname}/"
+ install -Dm644 "build/${pkgname}/u-boot-sunxi-with-spl.bin" "${pkgdir}/usr/lib/u-boot/${pkgname}"
+ install -Dm644 "${srcdir}/extlinux.conf" "${pkgdir}/usr/lib/u-boot/${pkgname}"
+
+ sed < "$srcdir/install-uboot4extlinux.sh.in" > "${pkgdir}/usr/lib/u-boot/${pkgname}/install-uboot4extlinux.sh" \
+ -e "s|@u_boot_with_spl[@]|/usr/lib/u-boot/${pkgname}/u-boot-sunxi-with-spl.bin|g" \
+ -e "s|@u_boot_with_spl_offset[@]|${u_boot_with_spl_offset}|g"
}
package_uboot4extlinux-chip() {
@@ -213,11 +283,15 @@ package_uboot4extlinux-chip() {
provides=('uboot4extlinux-sunxi')
conflicts=('uboot-sunxi' 'uboot4extlinux-sunxi' 'uboot4grub-sunxi')
- install -d "${pkgdir}"/boot/extlinux
- install -d "${pkgdir}"/boot/u-boot/images/
- install -Dm644 bin_CHIP/u-boot-sunxi-with-spl.bin "${pkgdir}"/boot/u-boot/images/
+ cd "u-boot-${pkgver}"
+
+ install -d "${pkgdir}/usr/lib/u-boot/${pkgname}/"
+ install -Dm644 "build/${pkgname}/u-boot-sunxi-with-spl.bin" "${pkgdir}/usr/lib/u-boot/${pkgname}"
+ install -Dm644 "${srcdir}/extlinux.conf" "${pkgdir}/usr/lib/u-boot/${pkgname}"
- install -Dm644 extlinux.conf "${pkgdir}"/boot/extlinux
+ sed < "$srcdir/install-uboot4extlinux.sh.in" > "${pkgdir}/usr/lib/u-boot/${pkgname}/install-uboot4extlinux.sh" \
+ -e "s|@u_boot_with_spl[@]|/usr/lib/u-boot/${pkgname}/u-boot-sunxi-with-spl.bin|g" \
+ -e "s|@u_boot_with_spl_offset[@]|${u_boot_with_spl_offset}|g"
}
package_uboot4extlinux-cubieboard() {
@@ -226,11 +300,15 @@ package_uboot4extlinux-cubieboard() {
provides=('uboot4extlinux-sunxi')
conflicts=('uboot-sunxi' 'uboot4extlinux-sunxi' 'uboot4grub-sunxi')
- install -d "${pkgdir}"/boot/extlinux
- install -d "${pkgdir}"/boot/u-boot/images/
- install -Dm644 bin_Cubieboard/u-boot-sunxi-with-spl.bin "${pkgdir}"/boot/u-boot/images/
+ cd "u-boot-${pkgver}"
- install -Dm644 extlinux.conf "${pkgdir}"/boot/extlinux
+ install -d "${pkgdir}/usr/lib/u-boot/${pkgname}/"
+ install -Dm644 "build/${pkgname}/u-boot-sunxi-with-spl.bin" "${pkgdir}/usr/lib/u-boot/${pkgname}"
+ install -Dm644 "${srcdir}/extlinux.conf" "${pkgdir}/usr/lib/u-boot/${pkgname}"
+
+ sed < "$srcdir/install-uboot4extlinux.sh.in" > "${pkgdir}/usr/lib/u-boot/${pkgname}/install-uboot4extlinux.sh" \
+ -e "s|@u_boot_with_spl[@]|/usr/lib/u-boot/${pkgname}/u-boot-sunxi-with-spl.bin|g" \
+ -e "s|@u_boot_with_spl_offset[@]|${u_boot_with_spl_offset}|g"
}
package_uboot4extlinux-cubieboard2() {
@@ -239,11 +317,15 @@ package_uboot4extlinux-cubieboard2() {
provides=('uboot4extlinux-sunxi')
conflicts=('uboot-sunxi' 'uboot4extlinux-sunxi' 'uboot4grub-sunxi')
- install -d "${pkgdir}"/boot/extlinux
- install -d "${pkgdir}"/boot/u-boot/images/
- install -Dm644 bin_Cubieboard2/u-boot-sunxi-with-spl.bin "${pkgdir}"/boot/u-boot/images/
+ cd "u-boot-${pkgver}"
+
+ install -d "${pkgdir}/usr/lib/u-boot/${pkgname}/"
+ install -Dm644 "build/${pkgname}/u-boot-sunxi-with-spl.bin" "${pkgdir}/usr/lib/u-boot/${pkgname}"
+ install -Dm644 "${srcdir}/extlinux.conf" "${pkgdir}/usr/lib/u-boot/${pkgname}"
- install -Dm644 extlinux.conf "${pkgdir}"/boot/extlinux
+ sed < "$srcdir/install-uboot4extlinux.sh.in" > "${pkgdir}/usr/lib/u-boot/${pkgname}/install-uboot4extlinux.sh" \
+ -e "s|@u_boot_with_spl[@]|/usr/lib/u-boot/${pkgname}/u-boot-sunxi-with-spl.bin|g" \
+ -e "s|@u_boot_with_spl_offset[@]|${u_boot_with_spl_offset}|g"
}
package_uboot4extlinux-cubietruck() {
@@ -252,11 +334,15 @@ package_uboot4extlinux-cubietruck() {
provides=('uboot4extlinux-sunxi')
conflicts=('uboot-sunxi' 'uboot4extlinux-sunxi' 'uboot4grub-sunxi')
- install -d "${pkgdir}"/boot/extlinux
- install -d "${pkgdir}"/boot/u-boot/images/
- install -Dm644 bin_Cubietruck/u-boot-sunxi-with-spl.bin "${pkgdir}"/boot/u-boot/images/
+ cd "u-boot-${pkgver}"
+
+ install -d "${pkgdir}/usr/lib/u-boot/${pkgname}/"
+ install -Dm644 "build/${pkgname}/u-boot-sunxi-with-spl.bin" "${pkgdir}/usr/lib/u-boot/${pkgname}"
+ install -Dm644 "${srcdir}/extlinux.conf" "${pkgdir}/usr/lib/u-boot/${pkgname}"
- install -Dm644 extlinux.conf "${pkgdir}"/boot/extlinux
+ sed < "$srcdir/install-uboot4extlinux.sh.in" > "${pkgdir}/usr/lib/u-boot/${pkgname}/install-uboot4extlinux.sh" \
+ -e "s|@u_boot_with_spl[@]|/usr/lib/u-boot/${pkgname}/u-boot-sunxi-with-spl.bin|g" \
+ -e "s|@u_boot_with_spl_offset[@]|${u_boot_with_spl_offset}|g"
}
package_uboot4extlinux-linksprite_pcduino() {
@@ -266,11 +352,15 @@ package_uboot4extlinux-linksprite_pcduino() {
conflicts=('uboot-sunxi' 'uboot4extlinux-sunxi' 'uboot4grub-sunxi')
replaces=('uboot4extlinux-pcduino')
- install -d "${pkgdir}"/boot/extlinux
- install -d "${pkgdir}"/boot/u-boot/images/
- install -Dm644 bin_Linksprite_pcDuino/u-boot-sunxi-with-spl.bin "${pkgdir}"/boot/u-boot/images/
+ cd "u-boot-${pkgver}"
- install -Dm644 extlinux.conf "${pkgdir}"/boot/extlinux
+ install -d "${pkgdir}/usr/lib/u-boot/${pkgname}/"
+ install -Dm644 "build/${pkgname}/u-boot-sunxi-with-spl.bin" "${pkgdir}/usr/lib/u-boot/${pkgname}"
+ install -Dm644 "${srcdir}/extlinux.conf" "${pkgdir}/usr/lib/u-boot/${pkgname}"
+
+ sed < "$srcdir/install-uboot4extlinux.sh.in" > "${pkgdir}/usr/lib/u-boot/${pkgname}/install-uboot4extlinux.sh" \
+ -e "s|@u_boot_with_spl[@]|/usr/lib/u-boot/${pkgname}/u-boot-sunxi-with-spl.bin|g" \
+ -e "s|@u_boot_with_spl_offset[@]|${u_boot_with_spl_offset}|g"
}
package_uboot4extlinux-linksprite_pcduino3() {
@@ -280,11 +370,15 @@ package_uboot4extlinux-linksprite_pcduino3() {
conflicts=('uboot-sunxi' 'uboot4extlinux-sunxi' 'uboot4grub-sunxi')
replaces=('uboot4extlinux-pcduino3')
- install -d "${pkgdir}"/boot/extlinux
- install -d "${pkgdir}"/boot/u-boot/images/
- install -Dm644 bin_Linksprite_pcDuino3/u-boot-sunxi-with-spl.bin "${pkgdir}"/boot/u-boot/images/
+ cd "u-boot-${pkgver}"
+
+ install -d "${pkgdir}/usr/lib/u-boot/${pkgname}/"
+ install -Dm644 "build/${pkgname}/u-boot-sunxi-with-spl.bin" "${pkgdir}/usr/lib/u-boot/${pkgname}"
+ install -Dm644 "${srcdir}/extlinux.conf" "${pkgdir}/usr/lib/u-boot/${pkgname}"
- install -Dm644 extlinux.conf "${pkgdir}"/boot/extlinux
+ sed < "$srcdir/install-uboot4extlinux.sh.in" > "${pkgdir}/usr/lib/u-boot/${pkgname}/install-uboot4extlinux.sh" \
+ -e "s|@u_boot_with_spl[@]|/usr/lib/u-boot/${pkgname}/u-boot-sunxi-with-spl.bin|g" \
+ -e "s|@u_boot_with_spl_offset[@]|${u_boot_with_spl_offset}|g"
}
package_uboot4extlinux-linksprite_pcduino3_nano() {
@@ -294,11 +388,15 @@ package_uboot4extlinux-linksprite_pcduino3_nano() {
conflicts=('uboot-sunxi' 'uboot4extlinux-sunxi' 'uboot4grub-sunxi')
replaces=('uboot4extlinux-pcduino3-nano')
- install -d "${pkgdir}"/boot/extlinux
- install -d "${pkgdir}"/boot/u-boot/images/
- install -Dm644 bin_Linksprite_pcDuino3_Nano/u-boot-sunxi-with-spl.bin "${pkgdir}"/boot/u-boot/images/
+ cd "u-boot-${pkgver}"
- install -Dm644 extlinux.conf "${pkgdir}"/boot/extlinux
+ install -d "${pkgdir}/usr/lib/u-boot/${pkgname}/"
+ install -Dm644 "build/${pkgname}/u-boot-sunxi-with-spl.bin" "${pkgdir}/usr/lib/u-boot/${pkgname}"
+ install -Dm644 "${srcdir}/extlinux.conf" "${pkgdir}/usr/lib/u-boot/${pkgname}"
+
+ sed < "$srcdir/install-uboot4extlinux.sh.in" > "${pkgdir}/usr/lib/u-boot/${pkgname}/install-uboot4extlinux.sh" \
+ -e "s|@u_boot_with_spl[@]|/usr/lib/u-boot/${pkgname}/u-boot-sunxi-with-spl.bin|g" \
+ -e "s|@u_boot_with_spl_offset[@]|${u_boot_with_spl_offset}|g"
}
package_uboot4extlinux-orangepi_2() {
@@ -307,11 +405,15 @@ package_uboot4extlinux-orangepi_2() {
provides=('uboot4extlinux-sunxi')
conflicts=('uboot-sunxi' 'uboot4extlinux-sunxi' 'uboot4grub-sunxi')
- install -d "${pkgdir}"/boot/extlinux
- install -d "${pkgdir}"/boot/u-boot/images/
- install -Dm644 bin_orangepi_2/u-boot-sunxi-with-spl.bin "${pkgdir}"/boot/u-boot/images/
+ cd "u-boot-${pkgver}"
+
+ install -d "${pkgdir}/usr/lib/u-boot/${pkgname}/"
+ install -Dm644 "build/${pkgname}/u-boot-sunxi-with-spl.bin" "${pkgdir}/usr/lib/u-boot/${pkgname}"
+ install -Dm644 "${srcdir}/extlinux.conf" "${pkgdir}/usr/lib/u-boot/${pkgname}"
- install -Dm644 extlinux.conf "${pkgdir}"/boot/extlinux
+ sed < "$srcdir/install-uboot4extlinux.sh.in" > "${pkgdir}/usr/lib/u-boot/${pkgname}/install-uboot4extlinux.sh" \
+ -e "s|@u_boot_with_spl[@]|/usr/lib/u-boot/${pkgname}/u-boot-sunxi-with-spl.bin|g" \
+ -e "s|@u_boot_with_spl_offset[@]|${u_boot_with_spl_offset}|g"
}
package_uboot4extlinux-orangepi_one() {
@@ -320,11 +422,15 @@ package_uboot4extlinux-orangepi_one() {
provides=('uboot4extlinux-sunxi')
conflicts=('uboot-sunxi' 'uboot4extlinux-sunxi' 'uboot4grub-sunxi')
- install -d "${pkgdir}"/boot/extlinux
- install -d "${pkgdir}"/boot/u-boot/images/
- install -Dm644 bin_orangepi_one/u-boot-sunxi-with-spl.bin "${pkgdir}"/boot/u-boot/images/
+ cd "u-boot-${pkgver}"
- install -Dm644 extlinux.conf "${pkgdir}"/boot/extlinux
+ install -d "${pkgdir}/usr/lib/u-boot/${pkgname}/"
+ install -Dm644 "build/${pkgname}/u-boot-sunxi-with-spl.bin" "${pkgdir}/usr/lib/u-boot/${pkgname}"
+ install -Dm644 "${srcdir}/extlinux.conf" "${pkgdir}/usr/lib/u-boot/${pkgname}"
+
+ sed < "$srcdir/install-uboot4extlinux.sh.in" > "${pkgdir}/usr/lib/u-boot/${pkgname}/install-uboot4extlinux.sh" \
+ -e "s|@u_boot_with_spl[@]|/usr/lib/u-boot/${pkgname}/u-boot-sunxi-with-spl.bin|g" \
+ -e "s|@u_boot_with_spl_offset[@]|${u_boot_with_spl_offset}|g"
}
package_uboot4extlinux-orangepi_pc() {
@@ -333,11 +439,15 @@ package_uboot4extlinux-orangepi_pc() {
provides=('uboot4extlinux-sunxi')
conflicts=('uboot-sunxi' 'uboot4extlinux-sunxi' 'uboot4grub-sunxi')
- install -d "${pkgdir}"/boot/extlinux
- install -d "${pkgdir}"/boot/u-boot/images/
- install -Dm644 bin_orangepi_pc/u-boot-sunxi-with-spl.bin "${pkgdir}"/boot/u-boot/images/
+ cd "u-boot-${pkgver}"
+
+ install -d "${pkgdir}/usr/lib/u-boot/${pkgname}/"
+ install -Dm644 "build/${pkgname}/u-boot-sunxi-with-spl.bin" "${pkgdir}/usr/lib/u-boot/${pkgname}"
+ install -Dm644 "${srcdir}/extlinux.conf" "${pkgdir}/usr/lib/u-boot/${pkgname}"
- install -Dm644 extlinux.conf "${pkgdir}"/boot/extlinux
+ sed < "$srcdir/install-uboot4extlinux.sh.in" > "${pkgdir}/usr/lib/u-boot/${pkgname}/install-uboot4extlinux.sh" \
+ -e "s|@u_boot_with_spl[@]|/usr/lib/u-boot/${pkgname}/u-boot-sunxi-with-spl.bin|g" \
+ -e "s|@u_boot_with_spl_offset[@]|${u_boot_with_spl_offset}|g"
}
package_uboot4extlinux-orangepi_plus() {
@@ -346,9 +456,13 @@ package_uboot4extlinux-orangepi_plus() {
provides=('uboot4extlinux-sunxi')
conflicts=('uboot-sunxi' 'uboot4extlinux-sunxi' 'uboot4grub-sunxi')
- install -d "${pkgdir}"/boot/extlinux
- install -d "${pkgdir}"/boot/u-boot/images/
- install -Dm644 bin_orangepi_plus/u-boot-sunxi-with-spl.bin "${pkgdir}"/boot/u-boot/images/
+ cd "u-boot-${pkgver}"
+
+ install -d "${pkgdir}/usr/lib/u-boot/${pkgname}/"
+ install -Dm644 "build/${pkgname}/u-boot-sunxi-with-spl.bin" "${pkgdir}/usr/lib/u-boot/${pkgname}"
+ install -Dm644 "${srcdir}/extlinux.conf" "${pkgdir}/usr/lib/u-boot/${pkgname}"
- install -Dm644 extlinux.conf "${pkgdir}"/boot/extlinux
+ sed < "$srcdir/install-uboot4extlinux.sh.in" > "${pkgdir}/usr/lib/u-boot/${pkgname}/install-uboot4extlinux.sh" \
+ -e "s|@u_boot_with_spl[@]|/usr/lib/u-boot/${pkgname}/u-boot-sunxi-with-spl.bin|g" \
+ -e "s|@u_boot_with_spl_offset[@]|${u_boot_with_spl_offset}|g"
}
diff --git a/libre/uboot4extlinux-sunxi/install-uboot4extlinux.sh.in b/libre/uboot4extlinux-sunxi/install-uboot4extlinux.sh.in
new file mode 100755
index 000000000..d12e6eedc
--- /dev/null
+++ b/libre/uboot4extlinux-sunxi/install-uboot4extlinux.sh.in
@@ -0,0 +1,88 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (C) 2020 Denis 'GNUtoo' Carikli
+
+progname="install-uboot4extlinux.sh"
+u_boot_with_spl="@u_boot_with_spl@"
+u_boot_with_spl_offset=@u_boot_with_spl_offset@
+
+usage()
+{
+ echo "Usage: ${progname} [INSTALL_DEVICE]"
+}
+
+install_image()
+{
+ install_device="$1"
+ offset="$2"
+ image="$3"
+
+ # We need root permissions for now:
+ # - blkid is used to bypass caching and it needs root access
+ if [ "$(id -u)" != 0 ] ; then
+ echo "Error: This script needs to be run as root"
+ exit 1
+ fi
+
+ # We only support MBR for now
+ # It will also catch errors like /dev/sdb1 and mmcbk0p1 as they
+ # don't have the PTTYPE tag
+ PTTYPE="$(blkid --probe --match-tag PTTYPE ${install_device} | \
+ awk '{print $2}' | sed 's#^PTTYPE="##' | sed 's#"$##')"
+ if [ -z "${PTTYPE}" ] ; then
+ echo "Error: Could not find an (MBR) formating inside " \
+ "${install_device}"
+ echo " Possible causes:"
+ echo " - Maybe {instal_device} is a partition"
+ echo " - or Maybe it's completelyor unformated"
+ exit 1
+ elif [ "${PTTYPE}" != "dos" ] ; then
+ echo "Error: ${install_device} is not in MBR format"
+ echo " Currently, only the MBR format is supported"
+ exit 1
+ fi
+
+ # Check if offset > MBR partition table part end
+ if [ ${offset} -lt 512 ] ; then
+ echo "Error: The offset (${offset}) is < 512"
+ echo " offsets < 512 aren't supported (yet)"
+ exit 1
+ fi
+
+ # Get the image size
+ image_size="$(du --block-size=1 ${image} | awk '{print $1}')"
+
+ # With MBR, most partitioning tools leave makes the first partition
+ # start at 1MiB. So we need to check if the bootloader doesn't end
+ # up overwriting the first partition.
+ if [ $(expr ${image_size} + {offset}) -gt $(expr 1024 * 1024) ] ; then
+ echo "Error: ${image} is too big:"
+ echo " offset: ${offset}"
+ echo " size: ${image_size}"
+ echo " By default, "\
+ "partitioing tools makes the first partition start at 1MiB"
+ echo " Instaling ${images} "\
+ "would overwrite that first partition (if it's present)."
+ echo " Please contact the Parabola developers " \
+ "so they could fix that issue"
+ exit 1
+ fi
+
+ # Copies with with a block size of 1 can be quite slow in practice
+ if [ "$(expr ${offset} % 512)" = 0] ; then
+ dd conv=notrunc "if=${image}" "of=${install_device}" \
+ bs=512 "seek=$(expr ${offset} / 512)"
+ else
+ echo "Warning: slow copy"
+ dd conv=notrunc "if=${image}" "of=${install_device}" \
+ bs=1 "seek=${offset}"
+ fi
+
+ sync "${install_device}"
+}
+
+if [ $# -ne 1 ] ; then
+ usage
+else
+ install_image "$1" "${u_boot_with_spl_offset}" "${u_boot_with_spl}"
+fi
diff --git a/libre/uboot4extlinux-sunxi/uboot4extlinux-sunxi.hook b/libre/uboot4extlinux-sunxi/uboot4extlinux-sunxi.hook
new file mode 100644
index 000000000..8f1ba29c2
--- /dev/null
+++ b/libre/uboot4extlinux-sunxi/uboot4extlinux-sunxi.hook
@@ -0,0 +1,12 @@
+[Trigger]
+Type = Package
+Operation = Install
+Operation = Upgrade
+Operation = Remove
+Target = *
+
+[Action]
+Description = Test
+When = PostTransaction
+Exec = /usr/share/libalpm/scripts/uboot4extlinux-sunxi.sh
+NeedsTargets