summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Woudstra2023-02-21 13:52:12 +0100
committerEric Woudstra2023-02-21 13:52:12 +0100
commit51383140a59e9fd195fe7c4e683eb3decfa3229f (patch)
treecd356d0597c2089da8daa2a535e2e56ed2f50739
parentcb6ccb895fc4eb330205d69ce1e2df45d38fc34e (diff)
downloadaur-51383140a59e9fd195fe7c4e683eb3decfa3229f.tar.gz
Epoch 2, using my own atf fork, only for bpir64
-rw-r--r--.SRCINFO17
-rw-r--r--PKGBUILD92
-rw-r--r--bl31-inside-bl2-image.patch50
-rw-r--r--incr-fip-decomp-size.patch11
-rw-r--r--mmc-high-speed.patch11
-rw-r--r--move-bl33-base.patch8
-rw-r--r--no-uboot-bl2.patch67
-rw-r--r--no-uboot-bl31.patch17
8 files changed, 27 insertions, 246 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 126eea7f0776..a2596e95d0cb 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,7 +1,8 @@
pkgbase = bpir64-atf-git
pkgdesc = ATF bpir64 images including fiptool
- pkgver = r20210508214220.d2c75b2
- pkgrel = 2
+ pkgver = v2.8r12062.65943cb2c
+ pkgrel = 1
+ epoch = 2
url = https://github.com/mtk-openwrt/arm-trusted-firmware.git
install = bpir64-atf-git.install
arch = aarch64
@@ -9,21 +10,11 @@ pkgbase = bpir64-atf-git
makedepends = git
makedepends = bpir64-mkimage
depends = linux
- source = bl31-inside-bl2-image.patch
- source = mmc-high-speed.patch
- source = move-bl33-base.patch
- source = incr-fip-decomp-size.patch
- source = no-uboot-bl2.patch
- source = no-uboot-bl31.patch
+ source = git+https://github.com/ericwoud/arm-trusted-firmware.git#branch=bpir64
source = 95-atf.hook
source = bpir64-writefip
sha256sums = SKIP
sha256sums = SKIP
sha256sums = SKIP
- sha256sums = SKIP
- sha256sums = SKIP
- sha256sums = SKIP
- sha256sums = SKIP
- sha256sums = SKIP
pkgname = bpir64-atf-git
diff --git a/PKGBUILD b/PKGBUILD
index d84d107bbf78..90ad37532fa9 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,94 +1,55 @@
-# Maintainer: Eric Woudstra <ericwouds@gmail.com>
-
-# gsctool is only available in certein branches. It is not in the main/master branch.
-
+# Maintainer: Eric Woudstra ericwouds AT gmail DOT com
+
_gitname="arm-trusted-firmware"
-_gitroot="https://github.com/mtk-openwrt/${_gitname}"
-#_gitbranch="mtksoc" # v2.7 DOES NOT REBOOT!
-_gitbranch="mtksoc-20210508"
+_gitroot=https://github.com/ericwoud/${_gitname}
+_gitbranch="bpir64"
pkgname=bpir64-atf-git
-pkgver=r20210508214220.d2c75b2
-pkgrel=2
+epoch=2
+pkgver=v2.8r12062.65943cb2c
+pkgrel=1
pkgdesc='ATF bpir64 images including fiptool'
url='https://github.com/mtk-openwrt/arm-trusted-firmware.git'
arch=(aarch64)
depends=(linux)
makedepends=(git bpir64-mkimage)
license=(GPL)
-source=('bl31-inside-bl2-image.patch'
- 'mmc-high-speed.patch'
- 'move-bl33-base.patch'
- 'incr-fip-decomp-size.patch'
- 'no-uboot-bl2.patch'
- 'no-uboot-bl31.patch'
+source=("git+${_gitroot}.git#branch=${_gitbranch}"
'95-atf.hook'
'bpir64-writefip'
)
-sha256sums=(SKIP SKIP SKIP SKIP SKIP SKIP SKIP SKIP)
+sha256sums=(SKIP SKIP SKIP)
install=${pkgname}.install
-
+
pkgver() {
- cd "${srcdir}/${_gitname}/"
- printf "r%s.%s" "$(git show -s --format=%cd --date=format:%Y%m%d%H%M%S HEAD)" "$(git rev-parse --short HEAD)"
-
-}
-
-_patch () {
- patch -p1 -N -r - < "${srcdir}/bl31-inside-bl2-image.patch"
- patch -p1 -N -r - < "${srcdir}/mmc-high-speed.patch"
- patch -p1 -N -r - < "${srcdir}/move-bl33-base.patch"
- patch -p1 -N -r - < "${srcdir}/no-uboot-bl2.patch"
- patch -p1 -N -r - < "${srcdir}/no-uboot-bl31.patch"
- if [ ! -z "$(cat ${srcdir}/${_gitname}/plat/mediatek/mt7622/include/platform_def.h | \
- grep FIP_DECOMP_TEMP_SIZE)" ]; then
- patch -p1 -N -r - < "${srcdir}/incr-fip-decomp-size.patch"
- fi
-}
-
-prepare() {
- if [[ -d "${srcdir}/${_gitname}/" ]]; then
- cd "${srcdir}/${_gitname}/"
- git fetch
- echo "LOCAL HEAD: $(git rev-parse HEAD)"
- echo "REMOTE HEAD: $(git rev-parse @{u})"
- if [ "$(git rev-parse HEAD)" != "$(git rev-parse @{u})" ]; then
- git reset --hard
- git fetch --depth 1 origin "${_gitbranch}:${_gitbranch}"
- git checkout "${_gitbranch}"
- _patch
- fi
- echo
- else
- cd "${srcdir}/"
- git clone --branch "${_gitbranch}" --depth=1 "${_gitroot}" "${srcdir}/${_gitname}/"
- cd "${srcdir}/${_gitname}/"
- _patch
- echo
- fi
+ cd "${srcdir}/${_gitname}"
+ printf "v%s.%sr%s.%s" \
+ $(grep '^VERSION_MAJOR' Makefile | cut -b 19-) \
+ $(grep '^VERSION_MINOR' Makefile | cut -b 19-) \
+ "$(git rev-list --count HEAD)" \
+ "$(git rev-parse --short HEAD)"
}
-
+
build() {
cd "${srcdir}/${_gitname}/tools/fiptool"
sed -i '/-Werror/d' ./Makefile
make HOSTCCFLAGS+="-D'SHA256(x,y,z)=nop'" LDLIBS=""
cd "${srcdir}/${_gitname}"
- for _atfdev in sdmmc emmc; do
- _ATFBUILDARGS="PLAT=mt7622 BOOT_DEVICE=$_atfdev DDR3_FLYBY=1 LOG_LEVEL=40"
+ for _atfdev in sdmmc; do
+ _ATFBUILDARGS="PLAT=mt7622 BOOT_DEVICE=$_atfdev DDR3_FLYBY=1 LOG_LEVEL=40 MTK_BL33_IS_64BIT=1"
sed -i 's/.*entry = get_partition_entry.*/\tentry = get_partition_entry("bpir64-'${_atfdev}'-fip");/' \
plat/mediatek/mt7622/bl2_boot_mmc.c
_makeatf="make $_ATFBUILDARGS USE_MKIMAGE=1 MKIMAGE=$(which bpir64-mkimage) DEVICE_HEADER_OFFSET=0"
touch plat/mediatek/mt7622/platform.mk
- unset LDFLAGS
- unset CFLAGS
+ unset CFLAGS CXXFLAGS CPPFLAGS LDFLAGS
# PRELOADED_BL33_BASE is not being used in mt7622 atf code, so we use it as binairy flags:
# 0b0001 : incbin BL31.bin inside of BL2 image, disable it during BL31 build because of common code!
- $_makeatf PRELOADED_BL33_BASE=0b0000 bl31
- $_makeatf PRELOADED_BL33_BASE=0b0001 bl2 ${srcdir}/${_gitname}/build/mt7622/release/bl2.img
+ CFLAGS=-Wno-error $_makeatf PRELOADED_BL33_BASE=0b0000 bl31
+ CFLAGS=-Wno-error $_makeatf PRELOADED_BL33_BASE=0b0001 bl2 ${srcdir}/${_gitname}/build/mt7622/release/bl2.img
dd of=build/mt7622/release/bpir64-atf-${_atfdev}-header.bin bs=1 count=440 if=build/mt7622/release/bl2.img
dd of=build/mt7622/release/bpir64-atf-${_atfdev}-atf.bin skip=34 if=build/mt7622/release/bl2.img
done
}
-
+
package() {
cd "${srcdir}"
install -m755 -vDt "$pkgdir/usr/bin" bpir64-writefip
@@ -98,10 +59,3 @@ package() {
cd "${srcdir}/${_gitname}/build/mt7622/release"
install -Dt "$pkgdir/boot" -m644 bpir64-atf-*.bin
}
-
-# Writing:
-# _device="/dev/"$(lsblk -no pkname /dev/disk/by-partlabel/bpir64-${_atfdev}-atf)
-# _atfdev="/dev/disk/by-partlabel/bpir64-${_atfdev}-atf"
-# echo dd of="$atfdev" if=/dev/zero 2>/dev/null
-# echo dd of="${device}" bs=1 if=bpir64-atf-${_atfdev}-header
-# echo dd of="$atfdev" if=bpir64-atf-${_atfdev}-atf
diff --git a/bl31-inside-bl2-image.patch b/bl31-inside-bl2-image.patch
deleted file mode 100644
index 2c7ecc56cfc5..000000000000
--- a/bl31-inside-bl2-image.patch
+++ /dev/null
@@ -1,50 +0,0 @@
---- a/common/bl_common.c 2021-09-25 13:55:57.548234397 +0200
-+++ b/common/bl_common.c 2021-09-25 13:57:52.297025456 +0200
-@@ -82,6 +82,47 @@
-
- image_base = image_data->image_base;
-
-+#if (PRELOADED_BL33_BASE & 0b0001) != 0
-+ if (image_id == BL31_IMAGE_ID) {
-+ #pragma message "Compiling BL31 into BL2"
-+
-+ extern uint8_t _binary_FILENAME_start[];
-+ extern uint8_t _binary_FILENAME_end;
-+ __asm__(
-+ ".section \".rodata\", \"a\", @progbits\n"
-+ "_binary_FILENAME_start:\n"
-+ ".balign 16\n"
-+ ".incbin \"build/mt7622/release/bl31.bin\"\n"
-+ "_binary_FILENAME_end:\n"
-+ ".balign 16\n"
-+ ".previous\n"
-+ );
-+ image_data->image_size = (uint32_t)((uintptr_t)&_binary_FILENAME_end -
-+ (uintptr_t)&_binary_FILENAME_start);
-+
-+ if (image_data->image_size > image_data->image_max_size) {
-+ WARN("Image id=%u size out of bounds\n", image_id);
-+ return -EFBIG;
-+ }
-+
-+ memcpy((void *)image_base, &_binary_FILENAME_start, image_data->image_size);
-+
-+ INFO("Image id=%u copied: 0x%lx - 0x%lx\n", image_id, image_base,
-+ image_base + (uintptr_t)image_data->image_size);
-+
-+ return 0;
-+ }
-+#endif
-+ if (image_id == NT_FW_CONFIG_ID) {
-+ unsigned int * ptr = (unsigned int *) BL33_BASE;
-+ if (ptr[14] == 0x644d5241)
-+ INFO("Loaded BL33 image is linux kernel image, loading DTB\n");
-+ else {
-+ INFO("Loaded BL33 image is not linux kernel image, not loading DTB\n");
-+ return 0;
-+ }
-+ }
-+
- /* Obtain a reference to the image by querying the platform layer */
- io_result = plat_get_image_source(image_id, &dev_handle, &image_spec);
- if (io_result != 0) {
diff --git a/incr-fip-decomp-size.patch b/incr-fip-decomp-size.patch
deleted file mode 100644
index dbe0e56397e5..000000000000
--- a/incr-fip-decomp-size.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- ./plat/mediatek/mt7622/include/platform_def.h 2022-09-04 20:28:39.561486535 +0200
-+++ ./plat/mediatek/mt7622/include/platform_def.h 2022-08-26 21:06:11.192153274 +0200
-@@ -104,7 +104,7 @@
- * FIP decompression specific defines.
- ******************************************************************************/
- #define FIP_DECOMP_TEMP_BASE (0x42000000)
--#define FIP_DECOMP_TEMP_SIZE (0x400000)
-+#define FIP_DECOMP_TEMP_SIZE (0x4000000)
-
- /*******************************************************************************
- * Platform specific page table and MMU setup constants
diff --git a/mmc-high-speed.patch b/mmc-high-speed.patch
deleted file mode 100644
index fc67535b1714..000000000000
--- a/mmc-high-speed.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- ./plat/mediatek/common/drivers/mmc/mtk-sd.c 2021-09-17 21:09:07.279200581 +0200
-+++ ./plat/mediatek/common/drivers/mmc/mtk-sd.c 2021-09-17 21:09:26.723588254 +0200
-@@ -153,7 +153,7 @@
- * greater than 25MHz
- */
- #define INIT_CLK_FREQ 1000000
--#define DEFAULT_CLK_FREQ 25000000
-+#define DEFAULT_CLK_FREQ 48000000
-
- #define CMD_INTS_MASK \
- (MSDC_INT_CMDRDY | MSDC_INT_RSPCRCERR | MSDC_INT_CMDTMO)
diff --git a/move-bl33-base.patch b/move-bl33-base.patch
deleted file mode 100644
index 3d30a3fe9a58..000000000000
--- a/move-bl33-base.patch
+++ /dev/null
@@ -1,8 +0,0 @@
-diff -NarU 1 a/plat/mediatek/mt7622/include/platform_def.h b/plat/mediatek/mt7622/include/platform_def.h
---- a/plat/mediatek/mt7622/include/platform_def.h 2022-07-15 08:41:23.704138923 +0200
-+++ b/plat/mediatek/mt7622/include/platform_def.h 2022-07-15 08:37:57.905563753 +0200
-@@ -92,3 +92,3 @@
-
--#define BL33_BASE (0x41e00000)
-+#define BL33_BASE (0x44000000)
-
diff --git a/no-uboot-bl2.patch b/no-uboot-bl2.patch
deleted file mode 100644
index 53f419777535..000000000000
--- a/no-uboot-bl2.patch
+++ /dev/null
@@ -1,67 +0,0 @@
---- a/plat/mediatek/mt7622/bl2_plat_setup.c 2021-09-15 13:35:58.536925357 +0200
-+++ b/plat/mediatek/mt7622/bl2_plat_setup.c 2021-09-15 14:00:52.439937687 +0200
-@@ -72,7 +72,31 @@
- SET_STATIC_PARAM_HEAD(image_info, PARAM_EP, VERSION_2,
- image_info_t, 0),
- .image_info.image_base = BL33_BASE,
-- .image_info.image_max_size = 0x200000 /* 2MB */,
-+ .image_info.image_max_size = 0x4000000 /* 64MB */,
-+
-+ .next_handoff_image_id = BL32_EXTRA2_IMAGE_ID,
-+ },
-+ /* Fill BL32_EXTRA2_IMAGE_ID related information */
-+ {
-+ .image_id = BL32_EXTRA2_IMAGE_ID,
-+ SET_STATIC_PARAM_HEAD(ep_info, PARAM_IMAGE_BINARY,
-+ VERSION_2, entry_point_info_t, NON_SECURE | NON_EXECUTABLE),
-+ SET_STATIC_PARAM_HEAD(image_info, PARAM_IMAGE_BINARY,
-+ VERSION_2, image_info_t, 0),
-+ .image_info.image_base = BL33_BASE + 0x4000000,
-+ .image_info.image_max_size = 0x4000000,
-+
-+ .next_handoff_image_id = NT_FW_CONFIG_ID,
-+ },
-+ /* Fill NT_FW_CONFIG related information */
-+ {
-+ .image_id = NT_FW_CONFIG_ID,
-+ SET_STATIC_PARAM_HEAD(ep_info, PARAM_IMAGE_BINARY,
-+ VERSION_2, entry_point_info_t, NON_SECURE | NON_EXECUTABLE),
-+ SET_STATIC_PARAM_HEAD(image_info, PARAM_IMAGE_BINARY,
-+ VERSION_2, image_info_t, 0),
-+ .image_info.image_base = BL32_BASE,
-+ .image_info.image_max_size = BL32_LIMIT,
-
- .next_handoff_image_id = INVALID_IMAGE_ID,
- }
-@@ -126,6 +140,14 @@
- .uuid = UUID_EL3_RUNTIME_FIRMWARE_BL31,
- };
-
-+static const io_uuid_spec_t ntfwconf_uuid_spec = {
-+ .uuid = UUID_NT_FW_CONFIG,
-+};
-+
-+static const io_uuid_spec_t tosfwEXTRA2_uuid_spec = {
-+ .uuid = UUID_SECURE_PAYLOAD_BL32_EXTRA2,
-+};
-+
- static const io_uuid_spec_t bl32_uuid_spec = {
- .uuid = UUID_SECURE_PAYLOAD_BL32,
- };
-@@ -183,6 +201,16 @@
- (uintptr_t)&bl31_uuid_spec,
- check_fip
- },
-+ [NT_FW_CONFIG_ID] = {
-+ &fip_dev_handle,
-+ (uintptr_t)&ntfwconf_uuid_spec,
-+ check_fip
-+ },
-+ [BL32_EXTRA2_IMAGE_ID] = {
-+ &fip_dev_handle,
-+ (uintptr_t)&tosfwEXTRA2_uuid_spec,
-+ check_fip
-+ },
- [BL32_IMAGE_ID] = {
- &fip_dev_handle,
- (uintptr_t)&bl32_uuid_spec,
diff --git a/no-uboot-bl31.patch b/no-uboot-bl31.patch
deleted file mode 100644
index a50670e9e474..000000000000
--- a/no-uboot-bl31.patch
+++ /dev/null
@@ -1,17 +0,0 @@
---- a/plat/mediatek/mt7622/bl31_plat_setup.c 2021-09-15 13:35:58.536925357 +0200
-+++ b/plat/mediatek/mt7622/bl31_plat_setup.c 2021-09-15 13:54:41.122386656 +0200
-@@ -99,6 +99,14 @@
- bl33_ep_info.pc = BL33_BASE;
- bl33_ep_info.spsr = plat_get_spsr_for_bl33_entry();
- SET_SECURITY_STATE(bl33_ep_info.h.attr, NON_SECURE);
-+
-+ unsigned int * ptr = (unsigned int *) BL33_BASE; // Check if image
-+ if (ptr[14] == 0x644d5241) { // is linux kernel
-+ bl33_ep_info.args.arg0 = (u_register_t)BL32_BASE; // ptr to DTB
-+ bl33_ep_info.args.arg1 = 0U;
-+ bl33_ep_info.args.arg2 = 0U;
-+ bl33_ep_info.args.arg3 = 0U;
-+ }
- }
-
- /*******************************************************************************