[PATCH 1/4] mediatek: bpi-r64: use separate partition for emmc bootloader
Oskari Lemmela
oskari at lemmela.net
Mon Apr 5 18:53:14 BST 2021
emmc booloader is stored to separate partition.
fip size is increased to 2MB.
Signed-off-by: Oskari Lemmela <oskari at lemmela.net>
---
.../403-add-bananapi_bpi-r64_defconfigs.patch | 8 ++++----
target/linux/mediatek/image/mt7622.mk | 13 +++++++------
2 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/package/boot/uboot-mediatek/patches/403-add-bananapi_bpi-r64_defconfigs.patch b/package/boot/uboot-mediatek/patches/403-add-bananapi_bpi-r64_defconfigs.patch
index b550ae4156..0421392305 100644
--- a/package/boot/uboot-mediatek/patches/403-add-bananapi_bpi-r64_defconfigs.patch
+++ b/package/boot/uboot-mediatek/patches/403-add-bananapi_bpi-r64_defconfigs.patch
@@ -186,7 +186,7 @@
+boot_tftp=tftpboot $loadaddr $bootfile && bootm $loadaddr
+emmc_write_bl2=mmc dev 0 1 && mmc partconf 0 1 1 1 && mmc erase 0x0 0x400 && mmc write $loadaddr 0x0 0x100 ; mmc partconf 0 1 1 0
+emmc_write_hdr=mmc dev 0 0 && mmc erase 0x0 0x40 && mmc write $loadaddr 0x0 0x40
-+emmc_write_bl3=mmc dev 0 0 && mmc erase 0x1000 0x800 && mmc write $loadaddr 0x1000 0x800
++emmc_write_bl3=mmc dev 0 0 && mmc erase 0x1000 0x1000 && mmc write $loadaddr 0x1000 0x1000
+emmc_write_production=iminfo $loadaddr && mmc dev 0 && part start mmc 0 $part_default part_addr && part size mmc 0 $part_default part_size && run mmc_write_vol
+emmc_write_recovery=iminfo $loadaddr && mmc dev 0 && part start mmc 0 $part_recovery part_addr && part size mmc 0 $part_recovery part_size && run mmc_write_vol
+emmc_init_bl=run sdmmc_read_emmc_bl2 && run emmc_write_bl2 && run sdmmc_read_emmc_hdr && run emmc_write_hdr && run sdmmc_read_emmc_bl3 && run emmc_write_bl3
@@ -196,9 +196,9 @@
+sdmmc_write_recovery=iminfo $fileaddr && mmc dev 1 && part start mmc 1 $part_recovery part_addr && part size mmc 1 $part_recovery part_size && run mmc_write_vol
+sdmmc_read_production=mmc dev 1 && part start mmc 1 $part_default part_addr && part size mmc 1 $part_default part_size && run mmc_read_vol
+sdmmc_read_recovery=mmc dev 1 && part start mmc 1 $part_recovery part_addr && part size mmc 1 $part_recovery part_size && run mmc_read_vol
-+sdmmc_read_emmc_hdr=mmc dev 1 && mmc read $loadaddr 0x100 0x40
-+sdmmc_read_emmc_bl2=mmc dev 1 && mmc read $loadaddr 0x200 0x100
-+sdmmc_read_emmc_bl3=mmc dev 1 && mmc read $loadaddr 0x800 0x800
++sdmmc_read_emmc_hdr=mmc dev 1 && part start mmc 1 install part_addr && mmc read $loadaddr $part_addr 0x40
++sdmmc_read_emmc_bl2=mmc dev 1 && part start mmc 1 install part_addr && setexpr offset $part_addr + 0x400 && mmc read $loadaddr $offset 0x400
++sdmmc_read_emmc_bl3=mmc dev 1 && part start mmc 1 install part_addr && setexpr offset $part_addr + 0x1000 && mmc read $loadaddr $offset 0x1000
+mmc_write_vol=imszb $loadaddr image_size && test 0x$image_size -le 0x$part_size && mmc erase 0x$part_addr 0x$part_size && mmc write $loadaddr 0x$part_addr 0x$image_size
+mmc_read_vol=mmc read $loadaddr $part_addr 0x8 && imszb $loadaddr image_size && test 0x$image_size -le 0x$part_size && mmc read $loadaddr 0x$part_addr 0x$image_size
+part_default=production
diff --git a/target/linux/mediatek/image/mt7622.mk b/target/linux/mediatek/image/mt7622.mk
index 143db964db..176abed581 100644
--- a/target/linux/mediatek/image/mt7622.mk
+++ b/target/linux/mediatek/image/mt7622.mk
@@ -43,11 +43,12 @@ define Build/mt7622-gpt
-H \
-t 0x83 -N bl2 -r -p 512k at 512k \
) \
- -t 0xef -N fip -r -p 1M at 2M \
+ -t 0xef -N fip -r -p 2M at 2M \
-t 0x83 -N ubootenv -r -p 1M at 4M \
-N recovery -r -p 32M at 6M \
$(if $(findstring sdmmc,$1), \
- -t 0x2e -N production -p 216M at 40M \
+ -N install -r -p 7M at 38M \
+ -t 0x2e -N production -p 211M at 45M \
) \
$(if $(findstring emmc,$1), \
-t 0x2e -N production -p 980M at 40M \
@@ -79,13 +80,13 @@ define Device/bananapi_bpi-r64
IMAGES := sysupgrade.itb
KERNEL_INITRAMFS_SUFFIX := -recovery.itb
ARTIFACT/sdcard.img.gz := mt7622-gpt sdmmc |\
- pad-to 128k | mt7622-gpt emmc |\
- pad-to 256k | bl2 emmc-2ddr |\
pad-to 512k | bl2 sdmmc-2ddr |\
- pad-to 1024k | bl31-uboot bananapi_bpi-r64-emmc |\
pad-to 2048k | bl31-uboot bananapi_bpi-r64-sdmmc |\
pad-to 6144k | append-image initramfs-recovery.itb |\
- pad-to 40960k | append-image squashfs-sysupgrade.itb | gzip
+ pad-to 38912k | mt7622-gpt emmc |\
+ pad-to 39424k | bl2 emmc-2ddr |\
+ pad-to 40960k | bl31-uboot bananapi_bpi-r64-emmc |\
+ pad-to 46080k | append-image squashfs-sysupgrade.itb | gzip
KERNEL := kernel-bin | gzip
KERNEL_INITRAMFS := kernel-bin | lzma | fit lzma $$(DTS_DIR)/$$(DEVICE_DTS).dtb with-initrd | pad-to 128k
IMAGE/sysupgrade.itb := append-kernel | fit gzip $$(DTS_DIR)/$$(DEVICE_DTS).dtb external-static-with-rootfs | append-metadata
--
2.25.1
More information about the openwrt-devel
mailing list