mediatek: mt7622: bpi-r64: simplify eMMC install procedure

Write everything needed for eMMC install into the gaps between
partitions on SD card. In that way, installation to eMMC only needs
the SD card, no additional files need to be loaded via TFTP any more.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
This commit is contained in:
Daniel Golle 2021-03-01 14:07:33 +00:00
parent 7a7b2fd809
commit ded54ae196
3 changed files with 18 additions and 11 deletions

View File

@ -27,6 +27,10 @@ define Build/append-kernel
dd if=$(IMAGE_KERNEL) >> $@
endef
define Build/append-image
dd if=$(BIN_DIR)/$(IMG_PREFIX)$(if $(PROFILE_SANITIZED),-$(PROFILE_SANITIZED))-$(1) >> $@
endef
compat_version=$(if $(DEVICE_COMPAT_VERSION),$(DEVICE_COMPAT_VERSION),1.0)
json_quote=$(subst ','\'',$(subst ",\",$(1)))
#")')

View File

@ -126,7 +126,7 @@
+CONFIG_USB_STORAGE=y
--- /dev/null
+++ b/bananapi_bpi-r64-sdmmc_env
@@ -0,0 +1,50 @@
@@ -0,0 +1,54 @@
+ipaddr=192.168.1.1
+serverip=192.168.1.254
+loadaddr=0x4007ff28
@ -160,15 +160,19 @@
+boot_tftp_production=tftpboot $loadaddr $bootfile_upg && run sdmmc_write_production ; if env exists noboot ; then else bootm $loadaddr ; fi
+boot_tftp_recovery=tftpboot $loadaddr $bootfile && iminfo $loadaddr && run sdmmc_write_recovery ; if env exists noboot ; then else bootm $loadaddr ; fi
+boot_tftp=tftpboot $loadaddr $bootfile && bootm $loadaddr
+emmc_init_bl3=mmc dev 0 0 && tftpboot $loadaddr $bootfile_emmcbl3 && mmc erase 0x0 0x3000 && mmc write $loadaddr 0x0 0x3000
+emmc_init_bl2=mmc dev 0 1 && tftpboot $loadaddr $bootfile_emmcbl2 && mmc partconf 0 1 1 1 && mmc erase 0x0 0x400 && mmc write ${loadaddr} 0x0 0x400 ; mmc partconf 0 1 1 0
+emmc_write_recovery=iminfo $fileaddr && 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=run emmc_init_bl2 ; run emmc_init_bl3 ; run sdmmc_read_recovery && run emmc_write_recovery
+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_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=run sdmmc_read_emmc_hdr && run emmc_write_hdr && run sdmmc_read_emmc_bl3 && run emmc_write_bl3 && run sdmmc_read_recovery && run emmc_write_recovery && run sdmmc_read_emmc_bl2 && run emmc_write_bl2
+sdmmc_write_production=iminfo $fileaddr && mmc dev 1 && part start mmc 1 $part_default part_addr && part size mmc 1 $part_default part_size && run mmc_write_vol
+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
+mmc_write_vol=imszb $fileaddr image_size && test 0x$image_size -le 0x$part_size && mmc erase 0x$part_addr 0x$part_size && mmc write $fileaddr 0x$part_addr 0x$image_size
+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
+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
+part_recovery=recovery

View File

@ -45,14 +45,13 @@ define Device/bananapi_bpi-r64
uboot-mt7622_bananapi_bpi-r64-sdmmc \
e2fsprogs mkf2fs f2fsck \
kmod-nls-cp437 kmod-nls-iso8859-1 kmod-vfat blockd
ARTIFACTS := boot-sdcard.img boot-emmc.img bl2-emmc.bin bl31-emmc.bin header-emmc.bin
ARTIFACTS := header-emmc.bin sdcard.img
IMAGES := sysupgrade.itb
KERNEL_INITRAMFS_SUFFIX := -recovery.itb
ARTIFACT/boot-sdcard.img := mt7622-gpt sdmmc | mmc-header sdmmc | pad-to 512k | bl2 sdmmc-2ddr | pad-to 2M | bl31-uboot bananapi_bpi-r64-sdmmc | pad-to 6M
ARTIFACT/boot-emmc.img := mt7622-gpt emmc | mmc-header emmc | pad-to 2M | bl31-uboot bananapi_bpi-r64-emmc | pad-to 6M
ARTIFACT/header-emmc.bin := mt7622-gpt emmc | mmc-header emmc
ARTIFACT/bl31-emmc.bin := bl31-uboot bananapi_bpi-r64-emmc
ARTIFACT/bl2-emmc.bin := bl2 emmc-2ddr
ARTIFACT/sdcard.img := mt7622-gpt sdmmc | mmc-header sdmmc | pad-to 128k | append-image header-emmc.bin | pad-to 256k |\
bl2 emmc-2ddr | pad-to 512k | bl2 sdmmc-2ddr | pad-to 1M | bl31-uboot bananapi_bpi-r64-emmc | pad-to 2M |\
bl31-uboot bananapi_bpi-r64-sdmmc | pad-to 6M
KERNEL := kernel-bin | gzip
KERNEL_INITRAMFS := kernel-bin | lzma | fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 128k
IMAGE/sysupgrade.itb := append-kernel | fit gzip $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb external-static-with-rootfs | append-metadata