summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Woudstra2023-03-11 12:05:47 +0100
committerEric Woudstra2023-03-11 12:05:47 +0100
commit47e11f74184293717c6170711e65737915985de5 (patch)
treea48758fe10124f4ed10f6528580fbabeecc7e8a1
parent528a1f255fe61867d85f8beb4b1407cc0b6f73ec (diff)
downloadaur-47e11f74184293717c6170711e65737915985de5.tar.gz
build mkimage in this package
-rw-r--r--.SRCINFO8
-rw-r--r--PKGBUILD34
-rw-r--r--mtkimage-gpt-expand.patch28
3 files changed, 63 insertions, 7 deletions
diff --git a/.SRCINFO b/.SRCINFO
index fd63679db355..987fc8ece608 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,18 +1,22 @@
pkgbase = bpir64-atf-git
pkgdesc = ATF BPI-R64 & BPI-R3 images including fiptool
pkgver = v2.8r12166.296bf7500
- pkgrel = 1
+ pkgrel = 2
epoch = 2
url = https://github.com/mtk-openwrt/arm-trusted-firmware.git
install = bpir64-atf-git.install
arch = aarch64
license = GPL
makedepends = git
- makedepends = bpir64-mkimage
depends = linux
+ replaces = bpir64-mkimage
source = git+https://github.com/ericwoud/arm-trusted-firmware.git#branch=bpir
+ source = uboot2023.01::https://github.com/u-boot/u-boot/archive/refs/tags/v2023.01.tar.gz
source = 95-atf.hook
source = bpir-writefip
+ source = mtkimage-gpt-expand.patch
+ sha256sums = SKIP
+ sha256sums = SKIP
sha256sums = SKIP
sha256sums = SKIP
sha256sums = SKIP
diff --git a/PKGBUILD b/PKGBUILD
index fc32d50ebb46..4b2caa1818d5 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -9,18 +9,22 @@ _gitbranch="bpir"
pkgname=bpir64-atf-git
epoch=2
pkgver=v2.8r12166.296bf7500
-pkgrel=1
+pkgrel=2
pkgdesc='ATF BPI-R64 & BPI-R3 images including fiptool'
+_ubootpkgver=2023.01
url='https://github.com/mtk-openwrt/arm-trusted-firmware.git'
arch=(aarch64)
depends=(linux)
-makedepends=(git bpir64-mkimage)
+makedepends=(git)
+replaces=(bpir64-mkimage)
license=(GPL)
source=("git+${_gitroot}.git#branch=${_gitbranch}"
+ "uboot${_ubootpkgver}::https://github.com/u-boot/u-boot/archive/refs/tags/v${_ubootpkgver}.tar.gz"
'95-atf.hook'
'bpir-writefip'
+ 'mtkimage-gpt-expand.patch'
)
-sha256sums=(SKIP SKIP SKIP)
+sha256sums=(SKIP SKIP SKIP SKIP SKIP)
install=${pkgname}.install
pkgver() {
@@ -43,6 +47,23 @@ prepare() {
# git am --ignore-space-change --ignore-whitespace "${startdir}/"*.patch
}
+_buildmkimage() {
+ cd "${srcdir}/u-boot-${_ubootpkgver}"
+ cp -vf configs/mt7622_rfb_defconfig configs/my_defconfig
+ # No libcrypto (openssl)
+ echo "CONFIG_TOOLS_LIBCRYPTO=n" | tee -a configs/my_defconfig
+ # kwbimage needs libcrypto, so remove it from build
+ sed -i '/kwbimage.o \\/d' ./tools/Makefile
+ sed -i 's/FIT_OBJS-y :=.*/FIT_OBJS-y := fit_common.o boot\/image-fit.o/' ./tools/Makefile
+ ARCH=arm64 make clean
+ ARCH=arm64 make my_defconfig
+ ARCH=arm64 make tools-only
+ mv -vf tools/mkimage bpir3-mkimage
+ patch -p1 -N -r - < "${srcdir}/mtkimage-gpt-expand.patch"
+ ARCH=arm64 make tools-only
+ mv -vf tools/mkimage bpir64-mkimage
+}
+
_buildimage() {
_plat=$1; _bpir=$2; _atfdev=$3; _rest="${@:4}"
sed -i 's/.*entry = get_partition_entry.*/\tentry = get_partition_entry("'${_bpir}'-'${_atfdev}'-fip");/' \
@@ -50,8 +71,8 @@ _buildimage() {
touch plat/mediatek/${_plat}/platform.mk
unset CXXFLAGS CPPFLAGS LDFLAGS
export CFLAGS=-Wno-error
- make PLAT=${_plat} BOOT_DEVICE=$_atfdev LOG_LEVEL=40 \
- USE_MKIMAGE=1 MKIMAGE=$(which ${_bpir}-mkimage) ${_rest} all # MTK_BL33_IS_64BIT=1
+ make PLAT=${_plat} BOOT_DEVICE=$_atfdev LOG_LEVEL=40 USE_MKIMAGE=1 \
+ MKIMAGE="${srcdir}/u-boot-${_ubootpkgver}/${_bpir}-mkimage" ${_rest} all # MTK_BL33_IS_64BIT=1
if [[ "${_bpir}" == "bpir64" ]]; then
dd of=build/${_plat}/release/${_bpir}-atf-${_atfdev}-header.bin bs=1 count=440 if=build/${_plat}/release/bl2.img
dd of=build/${_plat}/release/${_bpir}-atf-${_atfdev}-atf.bin skip=34 if=build/${_plat}/release/bl2.img
@@ -69,6 +90,9 @@ _installimage() {
}
build() {
+ if [ ! -f "${srcdir}/u-boot-${_ubootpkgver}/bpir3-mkimage" ] || \
+ [ ! -f "${srcdir}/u-boot-${_ubootpkgver}/bpir64-mkimage" ]; then _buildmkimage
+ fi
cd "${srcdir}/${_gitname}/tools/fiptool"
sed -i '/-Werror/d' ./Makefile
make HOSTCCFLAGS+="-D'SHA256(x,y,z)=nop'" LDLIBS=""
diff --git a/mtkimage-gpt-expand.patch b/mtkimage-gpt-expand.patch
new file mode 100644
index 000000000000..a1819a469d14
--- /dev/null
+++ b/mtkimage-gpt-expand.patch
@@ -0,0 +1,28 @@
+diff -NarU 6 a/tools/mtk_image.h b/tools/mtk_image.h
+Create empty space for sectors 1 to 34.
+--- a/tools/mtk_image.h 2021-06-10 20:32:04.156559289 +0200
++++ b/tools/mtk_image.h 2021-06-10 20:32:36.964722097 +0200
+@@ -16,13 +16,13 @@
+ struct {
+ char name[12];
+ uint32_t version;
+ uint32_t size;
+ };
+
+- uint8_t pad[0x200];
++ uint8_t pad[34*512];
+ };
+
+ #define EMMC_BOOT_NAME "EMMC_BOOT"
+ #define SF_BOOT_NAME "SF_BOOT"
+ #define SDMMC_BOOT_NAME "SDMMC_BOOT"
+
+diff -NarU 1 a/tools/mtk_image.c b/tools/mtk_image.c
+Increase memory buffer size.
+--- a/tools/mtk_image.c 2021-06-11 13:26:11.580666817 +0200
++++ b/tools/mtk_image.c 2021-06-11 13:29:14.024018325 +0200
+@@ -63,3 +63,3 @@
+ /* GFH header + 2 * 4KB pages of NAND */
+-static char hdr_tmp[sizeof(struct gfh_header) + 0x2000];
++static char hdr_tmp[sizeof(struct gfh_header) + 0x2000 + 0x10000];
+