diff options
author | Daniel Golle <daniel@makrotopia.org> | 2021-02-27 15:14:02 +0000 |
---|---|---|
committer | Daniel Golle <daniel@makrotopia.org> | 2021-02-28 03:40:35 +0000 |
commit | 03948995abd0c03e8fb6628e2368b6c9f5785eae (patch) | |
tree | 30f0773be9bf2fc64389bc27b994a1a3d8abe661 /package/boot/uboot-mediatek | |
parent | 049ac36b2fdd9866e317282ea517851c0c190206 (diff) | |
download | upstream-03948995abd0c03e8fb6628e2368b6c9f5785eae.tar.gz upstream-03948995abd0c03e8fb6628e2368b6c9f5785eae.tar.bz2 upstream-03948995abd0c03e8fb6628e2368b6c9f5785eae.zip |
uboot-mediatek: rework support for Bananapi BPi-R64 board
Provide U-Boot variants for SD-card as well as eMMC boot, so we can
generate whole-disk images for the device.
While at it, rename 'mt7622' to 'mt7622-rfb1' to make it less confusing
now that more boards are being added.
Thanks to Frank Wunderlich (@frank-w) for making that nice SVG image
explaining the MMC boot process[1] and for providing the necessary
binary header blobs.
[1]: https://github.com/frank-w/BPI-R64-ATF
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Diffstat (limited to 'package/boot/uboot-mediatek')
4 files changed, 608 insertions, 3 deletions
diff --git a/package/boot/uboot-mediatek/Makefile b/package/boot/uboot-mediatek/Makefile index b61f432644..6904b39938 100644 --- a/package/boot/uboot-mediatek/Makefile +++ b/package/boot/uboot-mediatek/Makefile @@ -15,8 +15,8 @@ define U-Boot/Default DEFAULT:=y endef -define U-Boot/mt7622 - NAME:=MT7622 +define U-Boot/mt7622_rfb1 + NAME:=MT7622 Reference Board 1 BUILD_SUBTARGET:=mt7622 UBOOT_CONFIG:=mt7622_rfb endef @@ -31,6 +31,26 @@ define U-Boot/mt7622_linksys_e8450 DEPENDS:=+trusted-firmware-a-mt7622-snand-1ddr endef +define U-Boot/mt7622_bananapi_bpi-r64-emmc + NAME:=BananaPi R64 (eMMC) + BUILD_SUBTARGET:=mt7622 + UBOOT_CONFIG:=mt7622_bananapi_bpi-r64-emmc + UBOOT_IMAGE:=u-boot.fip + BL2_BOOTDEV:=emmc + BL2_DDRBLOB:=2 + DEPENDS:=+trusted-firmware-a-mt7622-emmc-2ddr +endef + +define U-Boot/mt7622_bananapi_bpi-r64-sdmmc + NAME:=BananaPi R64 (SDMMC) + BUILD_SUBTARGET:=mt7622 + UBOOT_CONFIG:=mt7622_bananapi_bpi-r64-sdmmc + UBOOT_IMAGE:=u-boot.fip + BL2_BOOTDEV:=sdmmc + BL2_DDRBLOB:=2 + DEPENDS:=+trusted-firmware-a-mt7622-sdmmc-2ddr +endef + define U-Boot/mt7623a_unielec_u7623 NAME:=UniElec U7623 (mt7623) BUILD_SUBTARGET:=mt7623 @@ -50,7 +70,14 @@ define U-Boot/mt7629 UBOOT_CONFIG:=mt7629_rfb endef -UBOOT_TARGETS := mt7629 mt7622 mt7622_linksys_e8450 mt7623n_bpir2 mt7623a_unielec_u7623 +UBOOT_TARGETS := \ + mt7629 \ + mt7622_bananapi_bpi-r64-emmc \ + mt7622_bananapi_bpi-r64-sdmmc \ + mt7622_linksys_e8450 \ + mt7622_rfb1 \ + mt7623n_bpir2 \ + mt7623a_unielec_u7623 UBOOT_MAKE_FLAGS += $(UBOOT_IMAGE:.fip=.bin) diff --git a/package/boot/uboot-mediatek/patches/015-update-bananapi-bpi-r64-device-tree.patch b/package/boot/uboot-mediatek/patches/015-update-bananapi-bpi-r64-device-tree.patch new file mode 100644 index 0000000000..8010107a65 --- /dev/null +++ b/package/boot/uboot-mediatek/patches/015-update-bananapi-bpi-r64-device-tree.patch @@ -0,0 +1,95 @@ +--- a/arch/arm/dts/mt7622-bananapi-bpi-r64.dts ++++ b/arch/arm/dts/mt7622-bananapi-bpi-r64.dts +@@ -27,6 +27,42 @@ + reg = <0x40000000 0x40000000>; + }; + ++ gpio-keys { ++ compatible = "gpio-keys"; ++ ++ reset { ++ label = "reset"; ++ gpios = <&gpio 0 GPIO_ACTIVE_LOW>; ++ }; ++ ++ wps { ++ label = "wps"; ++ gpios = <&gpio 102 GPIO_ACTIVE_LOW>; ++ }; ++ }; ++ ++ leds { ++ compatible = "gpio-leds"; ++/* ++ * red { ++ * label = "bpi-r64:pio:red"; ++ * gpios = <&gpio 88 GPIO_ACTIVE_HIGH>; ++ * default-state = "off"; ++ * }; ++ */ ++ green { ++ label = "bpi-r64:pio:green"; ++ gpios = <&gpio 89 GPIO_ACTIVE_HIGH>; ++ default-state = "off"; ++ }; ++ ++ blue { ++ label = "bpi-r64:pio:blue"; ++ gpios = <&gpio 85 GPIO_ACTIVE_LOW>; ++ default-state = "off"; ++ }; ++ }; ++ + reg_1p8v: regulator-1p8v { + compatible = "regulator-fixed"; + regulator-name = "fixed-1.8V"; +@@ -139,11 +163,12 @@ + + }; + +- mmc1_pins_default: mmc1default { ++ sd0_pins_default: sd0-pins-default { + mux { + function = "sd"; +- groups = "sd_0"; ++ groups = "sd_0"; + }; ++ + /* "I2S2_OUT, "I2S4_IN"", "I2S3_IN", "I2S2_IN", + * "I2S4_OUT", "I2S3_OUT" are used as DAT0, DAT1, + * DAT2, DAT3, CMD, CLK for SD respectively. +@@ -164,7 +189,6 @@ + pins = "TXD3"; + bias-pull-up; + }; +- + }; + }; + +@@ -199,7 +223,7 @@ + status = "okay"; + bus-width = <8>; + max-frequency = <50000000>; +- cap-sd-highspeed; ++ cap-mmc-highspeed; + vmmc-supply = <®_3p3v>; + vqmmc-supply = <®_3p3v>; + non-removable; +@@ -207,14 +231,15 @@ + + &mmc1 { + pinctrl-names = "default"; +- pinctrl-0 = <&mmc1_pins_default>; ++ pinctrl-0 = <&sd0_pins_default>; + status = "okay"; + bus-width = <4>; +- max-frequency = <50000000>; ++ max-frequency = <20000000>; + cap-sd-highspeed; + r_smpl = <1>; + vmmc-supply = <®_3p3v>; + vqmmc-supply = <®_3p3v>; ++ cd-gpios = <&gpio 81 GPIO_ACTIVE_LOW>; + }; + + &watchdog { diff --git a/package/boot/uboot-mediatek/patches/016-fit-totalsize.patch b/package/boot/uboot-mediatek/patches/016-fit-totalsize.patch new file mode 100644 index 0000000000..72fb4ac516 --- /dev/null +++ b/package/boot/uboot-mediatek/patches/016-fit-totalsize.patch @@ -0,0 +1,132 @@ +--- a/cmd/bootm.c ++++ b/cmd/bootm.c +@@ -227,6 +227,65 @@ U_BOOT_CMD( + /* iminfo - print header info for a requested image */ + /*******************************************************************/ + #if defined(CONFIG_CMD_IMI) ++#define SECTOR_SHIFT 9 ++static int image_totalsize(struct cmd_tbl *cmdtp, int flag, int argc, ++ char *const argv[], short int in_blocks) ++{ ++ ulong addr; ++ void *fit; ++ int bsize, tsize, maxhdrsize; ++ char buf[16]; ++ ++ if (argc >= 2) ++ addr = simple_strtoul(argv[1], NULL, 16); ++ else ++ addr = image_load_addr; ++ ++ fit = (void *)map_sysmem(addr, 0); ++ tsize = fit_get_totalsize(fit); ++ unmap_sysmem(fit); ++ if (tsize == 0) ++ return 1; ++ ++ bsize = (tsize >> SECTOR_SHIFT) + ((tsize & ((1 << SECTOR_SHIFT) - 1))?1:0); ++ ++ if (!in_blocks) ++ snprintf(buf, sizeof(buf), "%x", tsize); ++ else ++ snprintf(buf, sizeof(buf), "%x", bsize); ++ ++ if (argc >= 3) ++ return env_set(argv[2], buf); ++ else ++ printf("%s\n", buf); ++ ++ return 0; ++} ++ ++static int do_imsz(struct cmd_tbl *cmdtp, int flag, int argc, ++ char *const argv[]) ++{ ++ return image_totalsize(cmdtp, flag, argc, argv, 0); ++} ++ ++static int do_imszb(struct cmd_tbl *cmdtp, int flag, int argc, ++ char *const argv[]) ++{ ++ return image_totalsize(cmdtp, flag, argc, argv, 1); ++} ++ ++U_BOOT_CMD( ++ imsz, CONFIG_SYS_MAXARGS, 1, do_imsz, ++ "get image total size (in bytes)", ++ "addr [maxhdrlen] [varname]\n" ++); ++ ++U_BOOT_CMD( ++ imszb, CONFIG_SYS_MAXARGS, 1, do_imszb, ++ "get image total size (in blocks)", ++ "addr [maxhdrlen] [varname]\n" ++); ++ + static int do_iminfo(struct cmd_tbl *cmdtp, int flag, int argc, + char *const argv[]) + { +--- a/common/image-fit.c ++++ b/common/image-fit.c +@@ -1878,6 +1878,51 @@ static const char *fit_get_image_type_pr + return "unknown"; + } + ++size_t fit_get_totalsize(const void *fit) ++{ ++ int ret, ndepth, noffset, images_noffset; ++ size_t data_size, hdrsize, img_total, max_size = 0; ++ const void *data; ++ ++ ret = fdt_check_header(fit); ++ if (ret) { ++ debug("Wrong FIT format: not a flattened device tree (err=%d)\n", ++ ret); ++ return 0; ++ } ++ ++ hdrsize = fdt_totalsize(fit); ++ ++ /* simple FIT with internal images */ ++ if (hdrsize > 0x1000) ++ return hdrsize; ++ ++ images_noffset = fdt_path_offset(fit, FIT_IMAGES_PATH); ++ if (images_noffset < 0) { ++ printf("Can't find images parent node '%s' (%s)\n", ++ FIT_IMAGES_PATH, fdt_strerror(images_noffset)); ++ return 0; ++ } ++ ++ for (ndepth = 0, ++ noffset = fdt_next_node(fit, images_noffset, &ndepth); ++ (noffset >= 0) && (ndepth > 0); ++ noffset = fdt_next_node(fit, noffset, &ndepth)) { ++ if (ndepth == 1) { ++ ret = fit_image_get_data_and_size(fit, noffset, &data, &data_size); ++ if (ret) ++ return 0; ++ ++ img_total = data_size + (data - fit); ++ ++ max_size = (max_size > img_total) ? max_size : img_total; ++ } ++ } ++ ++ return max_size; ++} ++ ++ + int fit_image_load(bootm_headers_t *images, ulong addr, + const char **fit_unamep, const char **fit_uname_configp, + int arch, int image_type, int bootstage_id, +--- a/include/image.h ++++ b/include/image.h +@@ -1027,6 +1027,7 @@ int fit_parse_subimage(const char *spec, + ulong *addr, const char **image_name); + + int fit_get_subimage_count(const void *fit, int images_noffset); ++size_t fit_get_totalsize(const void *fit); + void fit_print_contents(const void *fit); + void fit_image_print(const void *fit, int noffset, const char *p); + diff --git a/package/boot/uboot-mediatek/patches/017-add-bananapi_bpi-r64_defconfigs.patch b/package/boot/uboot-mediatek/patches/017-add-bananapi_bpi-r64_defconfigs.patch new file mode 100644 index 0000000000..22609404cf --- /dev/null +++ b/package/boot/uboot-mediatek/patches/017-add-bananapi_bpi-r64_defconfigs.patch @@ -0,0 +1,351 @@ +--- /dev/null ++++ b/configs/mt7622_bananapi_bpi-r64-sdmmc_defconfig +@@ -0,0 +1,123 @@ ++CONFIG_ARM=y ++CONFIG_POSITION_INDEPENDENT=y ++CONFIG_ARCH_MEDIATEK=y ++CONFIG_SYS_TEXT_BASE=0x41e00000 ++CONFIG_SYS_MALLOC_F_LEN=0x4000 ++CONFIG_USE_DEFAULT_ENV_FILE=y ++CONFIG_BOARD_LATE_INIT=y ++CONFIG_BOOTP_SEND_HOSTNAME=y ++CONFIG_NR_DRAM_BANKS=1 ++CONFIG_DEFAULT_DEVICE_TREE="mt7622-bananapi-bpi-r64" ++CONFIG_DEFAULT_ENV_FILE="bananapi_bpi-r64-sdmmc_env" ++CONFIG_NET_RANDOM_ETHADDR=y ++CONFIG_SMBIOS_PRODUCT_NAME="" ++CONFIG_AUTOBOOT_KEYED=y ++CONFIG_BOOTDELAY=30 ++CONFIG_AUTOBOOT_MENU_SHOW=y ++CONFIG_CFB_CONSOLE_ANSI=y ++CONFIG_BUTTON=y ++CONFIG_BUTTON_GPIO=y ++CONFIG_CMD_ENV_FLAGS=y ++CONFIG_FIT=y ++CONFIG_FIT_ENABLE_SHA256_SUPPORT=y ++CONFIG_LED=y ++CONFIG_LED_BLINK=y ++CONFIG_LED_GPIO=y ++CONFIG_LOGLEVEL=7 ++CONFIG_LOG=y ++CONFIG_DEFAULT_FDT_FILE="mt7622-bananapi-bpi-r64" ++CONFIG_SYS_PROMPT="MT7622> " ++CONFIG_CMD_BOOTMENU=y ++CONFIG_CMD_BOOTP=y ++CONFIG_CMD_BUTTON=y ++CONFIG_CMD_CDP=y ++CONFIG_CMD_DHCP=y ++CONFIG_CMD_DNS=y ++CONFIG_CMD_ECHO=y ++CONFIG_CMD_ENV_READMEM=y ++CONFIG_CMD_ERASEENV=y ++CONFIG_CMD_EXT4=y ++CONFIG_CMD_FAT=y ++CONFIG_CMD_FS_GENERIC=y ++CONFIG_CMD_FS_UUID=y ++CONFIG_CMD_GPIO=y ++CONFIG_CMD_GPT=y ++CONFIG_CMD_HASH=y ++CONFIG_CMD_ITEST=y ++CONFIG_CMD_LED=y ++CONFIG_CMD_LICENSE=y ++CONFIG_CMD_LINK_LOCAL=y ++CONFIG_CMD_MBR=y ++CONFIG_CMD_MMC=y ++CONFIG_CMD_PCI=y ++CONFIG_CMD_SF_TEST=y ++CONFIG_CMD_PING=y ++CONFIG_CMD_PXE=y ++CONFIG_CMD_SMC=y ++CONFIG_CMD_TFTPBOOT=y ++CONFIG_CMD_TFTPSRV=y ++CONFIG_CMD_ASKENV=y ++CONFIG_CMD_PART=y ++CONFIG_CMD_PSTORE=y ++CONFIG_CMD_RARP=y ++CONFIG_CMD_SETEXPR=y ++CONFIG_CMD_SLEEP=y ++CONFIG_CMD_SNTP=y ++CONFIG_CMD_SOURCE=y ++CONFIG_CMD_USB=y ++CONFIG_CMD_UUID=y ++CONFIG_DISPLAY_CPUINFO=y ++CONFIG_DM_MMC=y ++CONFIG_DM_REGULATOR=y ++CONFIG_DM_REGULATOR_FIXED=y ++CONFIG_DM_REGULATOR_GPIO=y ++CONFIG_DM_USB=y ++CONFIG_HUSH_PARSER=y ++CONFIG_SYS_REDUNDAND_ENVIRONMENT=y ++CONFIG_SYS_RELOC_GD_ENV_ADDR=y ++CONFIG_ENV_IS_IN_MMC=y ++CONFIG_SYS_MMC_ENV_DEV=1 ++CONFIG_ENV_OFFSET=0x400000 ++CONFIG_ENV_OFFSET_REDUND=0x480000 ++CONFIG_ENV_SIZE=0x80000 ++CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y ++CONFIG_VERSION_VARIABLE=y ++CONFIG_PARTITION_UUIDS=y ++CONFIG_NETCONSOLE=y ++CONFIG_REGMAP=y ++CONFIG_SYSCON=y ++CONFIG_CLK=y ++CONFIG_PHY_FIXED=y ++CONFIG_DM_ETH=y ++CONFIG_MEDIATEK_ETH=y ++CONFIG_PCI=y ++CONFIG_DM_PCI=y ++CONFIG_PCIE_MEDIATEK=y ++CONFIG_PINCTRL=y ++CONFIG_PINCONF=y ++CONFIG_PINCTRL_MT7622=y ++CONFIG_POWER_DOMAIN=y ++CONFIG_PRE_CONSOLE_BUFFER=y ++CONFIG_PRE_CON_BUF_ADDR=0x4007EF00 ++CONFIG_MTK_POWER_DOMAIN=y ++CONFIG_RAM=y ++CONFIG_DM_SERIAL=y ++CONFIG_MTK_SERIAL=y ++CONFIG_MMC=y ++CONFIG_MMC_DEFAULT_DEV=1 ++CONFIG_MMC_MTK=y ++CONFIG_SUPPORT_EMMC_BOOT=y ++CONFIG_SYSRESET_WATCHDOG=y ++CONFIG_TIMER=y ++CONFIG_MTK_TIMER=y ++CONFIG_WDT_MTK=y ++CONFIG_LZO=y ++CONFIG_ZSTD=y ++CONFIG_HEXDUMP=y ++CONFIG_RANDOM_UUID=y ++CONFIG_REGEX=y ++CONFIG_USB=y ++CONFIG_USB_HOST=y ++CONFIG_USB_XHCI_HCD=y ++CONFIG_USB_XHCI_MTK=y ++CONFIG_USB_STORAGE=y +--- /dev/null ++++ b/bananapi_bpi-r64-sdmmc_env +@@ -0,0 +1,50 @@ ++ipaddr=192.168.1.1 ++serverip=192.168.1.254 ++loadaddr=0x4007ff28 ++bootcmd=run boot_sdmmc ++bootargs=earlycon=uart8250,mmio32,0x11002000 console=ttyS0,115200n1 swiotlb=512 root=/dev/mmcblk1p6 ++bootdelay=0 ++bootfile=openwrt-mediatek-mt7622-bananapi_bpi-r64-initramfs-recovery.itb ++bootfile_upg=openwrt-mediatek-mt7622-bananapi_bpi-r64-squashfs-sysupgrade.itb ++bootfile_emmcbl3=openwrt-mediatek-mt7622-bananapi_bpi-r64-boot-emmc.img ++bootfile_emmcbl2=openwrt-mediatek-mt7622-bananapi_bpi-r64-bl2-emmc.bin ++bootmenu_confirm_return=askenv - Press ENTER to return to menu ; bootmenu ++bootmenu_default=0 ++bootmenu_delay=0 ++bootmenu_title= [0;34m( ( ( [1;39mOpenWrt[0;34m ) ) ) [0;36m[SD card][0m ++bootmenu_0=0. Initialize environment.=run _firstboot ++bootmenu_0d=0. Run default boot command.=run boot_default ++bootmenu_1=1. Boot system via TFTP.=run boot_tftp ; run bootmenu_confirm_return ++bootmenu_2=2. Boot production system from SD card.=run boot_production ; run bootmenu_confirm_return ++bootmenu_3=3. Boot recovery system from SD card.=run boot_recovery ; run bootmenu_confirm_return ++bootmenu_4=4. Load production system via TFTP then write to SD card.=setenv noboot 1 ; run boot_tftp_production ; setenv noboot ; run bootmenu_confirm_return ++bootmenu_5=5. Load recovery system via TFTP then write to SD card.=setenv noboot 1 ; run boot_tftp_recovery ; setenv noboot ; run bootmenu_confirm_return ++bootmenu_6=[31m6. Load bootloader via TFTP then write to eMMC.[0m=run emmc_init ; run bootmenu_confirm_return ++bootmenu_7=7. Reboot.=reset ++bootmenu_8=8. Reset all settings to factory defaults.=run reset_factory ; reset ++boot_default=if env exists flag_recover ; then else run bootcmd ; fi ; run boot_recovery ; run boot_tftp_forever ++boot_first=if button reset ; then run boot_tftp_forever ; fi ; setenv flag_recover 1 ; bootmenu ++boot_production=led bpi-r64:pio:green on ; run sdmmc_read_production && bootm $loadaddr ++boot_recovery=led bpi-r64:pio:green off ; run sdmmc_read_recovery && bootm $loadaddr ++boot_sdmmc=run boot_production ; run boot_recovery ++boot_tftp_forever=led bpi-r64:pio:blue on ; while true ; do run boot_tftp_recovery ; sleep 1 ; done ++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 ++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 ++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 ++reset_factory=mmc dev 1 && mmc erase 0x2000 0x800 && reset ++_init_env=setenv _init_env ; setenv _create_env ; saveenv ; saveenv ++_firstboot=setenv _firstboot ; led bpi-r64:pio:blue on ; run _switch_to_menu ; run _init_env ; run boot_first ++_switch_to_menu=setenv _switch_to_menu ; setenv bootdelay 3 ; setenv bootmenu_delay 3 ; setenv bootmenu_0 $bootmenu_0d ; setenv bootmenu_0d ; run _bootmenu_update_title ++_bootmenu_update_title=setenv _bootmenu_update_title ; setenv bootmenu_title "$bootmenu_title [33m$ver[0m" +--- /dev/null ++++ b/configs/mt7622_bananapi_bpi-r64-emmc_defconfig +@@ -0,0 +1,123 @@ ++CONFIG_ARM=y ++CONFIG_POSITION_INDEPENDENT=y ++CONFIG_ARCH_MEDIATEK=y ++CONFIG_SYS_TEXT_BASE=0x41e00000 ++CONFIG_SYS_MALLOC_F_LEN=0x4000 ++CONFIG_USE_DEFAULT_ENV_FILE=y ++CONFIG_BOARD_LATE_INIT=y ++CONFIG_BOOTP_SEND_HOSTNAME=y ++CONFIG_NR_DRAM_BANKS=1 ++CONFIG_DEFAULT_DEVICE_TREE="mt7622-bananapi-bpi-r64" ++CONFIG_DEFAULT_ENV_FILE="bananapi_bpi-r64-emmc_env" ++CONFIG_NET_RANDOM_ETHADDR=y ++CONFIG_SMBIOS_PRODUCT_NAME="" ++CONFIG_AUTOBOOT_KEYED=y ++CONFIG_BOOTDELAY=30 ++CONFIG_AUTOBOOT_MENU_SHOW=y ++CONFIG_CFB_CONSOLE_ANSI=y ++CONFIG_BUTTON=y ++CONFIG_BUTTON_GPIO=y ++CONFIG_CMD_ENV_FLAGS=y ++CONFIG_FIT=y ++CONFIG_FIT_ENABLE_SHA256_SUPPORT=y ++CONFIG_LED=y ++CONFIG_LED_BLINK=y ++CONFIG_LED_GPIO=y ++CONFIG_LOGLEVEL=7 ++CONFIG_LOG=y ++CONFIG_DEFAULT_FDT_FILE="mt7622-bananapi-bpi-r64" ++CONFIG_SYS_PROMPT="MT7622> " ++CONFIG_CMD_BOOTMENU=y ++CONFIG_CMD_BOOTP=y ++CONFIG_CMD_BUTTON=y ++CONFIG_CMD_CDP=y ++CONFIG_CMD_DHCP=y ++CONFIG_CMD_DNS=y ++CONFIG_CMD_ECHO=y ++CONFIG_CMD_ENV_READMEM=y ++CONFIG_CMD_ERASEENV=y ++CONFIG_CMD_EXT4=y ++CONFIG_CMD_FAT=y ++CONFIG_CMD_FS_GENERIC=y ++CONFIG_CMD_FS_UUID=y ++CONFIG_CMD_GPIO=y ++CONFIG_CMD_GPT=y ++CONFIG_CMD_HASH=y ++CONFIG_CMD_ITEST=y ++CONFIG_CMD_LED=y ++CONFIG_CMD_LICENSE=y ++CONFIG_CMD_LINK_LOCAL=y ++CONFIG_CMD_MBR=y ++CONFIG_CMD_MMC=y ++CONFIG_CMD_PCI=y ++CONFIG_CMD_SF_TEST=y ++CONFIG_CMD_PING=y ++CONFIG_CMD_PXE=y ++CONFIG_CMD_SMC=y ++CONFIG_CMD_TFTPBOOT=y ++CONFIG_CMD_TFTPSRV=y ++CONFIG_CMD_ASKENV=y ++CONFIG_CMD_PART=y ++CONFIG_CMD_PSTORE=y ++CONFIG_CMD_RARP=y ++CONFIG_CMD_SETEXPR=y ++CONFIG_CMD_SLEEP=y ++CONFIG_CMD_SNTP=y ++CONFIG_CMD_SOURCE=y ++CONFIG_CMD_USB=y ++CONFIG_CMD_UUID=y ++CONFIG_DISPLAY_CPUINFO=y ++CONFIG_DM_MMC=y ++CONFIG_DM_REGULATOR=y ++CONFIG_DM_REGULATOR_FIXED=y ++CONFIG_DM_REGULATOR_GPIO=y ++CONFIG_DM_USB=y ++CONFIG_HUSH_PARSER=y ++CONFIG_SYS_REDUNDAND_ENVIRONMENT=y ++CONFIG_SYS_RELOC_GD_ENV_ADDR=y ++CONFIG_ENV_IS_IN_MMC=y ++CONFIG_SYS_MMC_ENV_DEV=0 ++CONFIG_ENV_OFFSET=0x400000 ++CONFIG_ENV_OFFSET_REDUND=0x480000 ++CONFIG_ENV_SIZE=0x80000 ++CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y ++CONFIG_VERSION_VARIABLE=y ++CONFIG_PARTITION_UUIDS=y ++CONFIG_NETCONSOLE=y ++CONFIG_REGMAP=y ++CONFIG_SYSCON=y ++CONFIG_CLK=y ++CONFIG_PHY_FIXED=y ++CONFIG_DM_ETH=y ++CONFIG_MEDIATEK_ETH=y ++CONFIG_PCI=y ++CONFIG_DM_PCI=y ++CONFIG_PCIE_MEDIATEK=y ++CONFIG_PINCTRL=y ++CONFIG_PINCONF=y ++CONFIG_PINCTRL_MT7622=y ++CONFIG_POWER_DOMAIN=y ++CONFIG_PRE_CONSOLE_BUFFER=y ++CONFIG_PRE_CON_BUF_ADDR=0x4007EF00 ++CONFIG_MTK_POWER_DOMAIN=y ++CONFIG_RAM=y ++CONFIG_DM_SERIAL=y ++CONFIG_MTK_SERIAL=y ++CONFIG_MMC=y ++CONFIG_MMC_DEFAULT_DEV=0 ++CONFIG_MMC_MTK=y ++CONFIG_SUPPORT_EMMC_BOOT=y ++CONFIG_SYSRESET_WATCHDOG=y ++CONFIG_TIMER=y ++CONFIG_MTK_TIMER=y ++CONFIG_WDT_MTK=y ++CONFIG_LZO=y ++CONFIG_ZSTD=y ++CONFIG_HEXDUMP=y ++CONFIG_RANDOM_UUID=y ++CONFIG_REGEX=y ++CONFIG_USB=y ++CONFIG_USB_HOST=y ++CONFIG_USB_XHCI_HCD=y ++CONFIG_USB_XHCI_MTK=y ++CONFIG_USB_STORAGE=y +--- /dev/null ++++ b/bananapi_bpi-r64-emmc_env +@@ -0,0 +1,43 @@ ++ipaddr=192.168.1.1 ++serverip=192.168.1.254 ++loadaddr=0x4007ff28 ++bootcmd=run boot_emmc ++bootargs=earlycon=uart8250,mmio32,0x11002000 console=ttyS0,115200n1 swiotlb=512 root=/dev/mmcblk0p5 ++bootdelay=0 ++bootfile=openwrt-mediatek-mt7622-bananapi_bpi-r64-initramfs-recovery.itb ++bootfile_upg=openwrt-mediatek-mt7622-bananapi_bpi-r64-squashfs-sysupgrade.itb ++bootmenu_confirm_return=askenv - Press ENTER to return to menu ; bootmenu ++bootmenu_default=0 ++bootmenu_delay=0 ++bootmenu_title= [0;34m( ( ( [1;39mOpenWrt[0;34m ) ) ) [0;36m[eMMC][0m ++bootmenu_0=0. Initialize environment.=run _firstboot ++bootmenu_0d=0. Run default boot command.=run boot_default ++bootmenu_1=1. Boot system via TFTP.=run boot_tftp ; run bootmenu_confirm_return ++bootmenu_2=2. Boot production system from eMMC.=run boot_production ; run bootmenu_confirm_return ++bootmenu_3=3. Boot recovery system from eMMC.=run boot_recovery ; run bootmenu_confirm_return ++bootmenu_4=4. Load production system via TFTP then write to eMMC.=setenv noboot 1 ; run boot_tftp_production ; setenv noboot ; run bootmenu_confirm_return ++bootmenu_5=5. Load recovery system via TFTP then write to eMMC.=setenv noboot 1 ; run boot_tftp_recovery ; setenv noboot ; run bootmenu_confirm_return ++bootmenu_6=6. Reboot.=reset ++bootmenu_7=7. Reset all settings to factory defaults.=run reset_factory ; reset ++boot_default=if env exists flag_recover ; then else run bootcmd ; fi ; run boot_recovery ; run boot_tftp_forever ++boot_first=if button reset ; then run boot_tftp_forever ; fi ; setenv flag_recover 1 ; bootmenu ++boot_production=led bpi-r64:pio:green on ; run emmc_read_production && bootm $loadaddr ++boot_recovery=led bpi-r64:pio:green off ; run emmc_read_recovery && bootm $loadaddr ++boot_emmc=run boot_production ; run boot_recovery ++boot_tftp_forever=led bpi-r64:pio:blue on ; while true ; do run boot_tftp_recovery ; sleep 1 ; done ++boot_tftp_production=tftpboot $loadaddr $bootfile_upg && run emmc_write_production ; if env exists noboot ; then else bootm $loadaddr ; fi ++boot_tftp_recovery=tftpboot $loadaddr $bootfile && iminfo $loadaddr && run emmc_write_recovery ; if env exists noboot ; then else bootm $loadaddr ; fi ++boot_tftp=tftpboot $loadaddr $bootfile && bootm $loadaddr ++emmc_write_production=iminfo $fileaddr && 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 $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_read_production=mmc dev 0 && part start mmc 0 $part_default part_addr && part size mmc 0 $part_default part_size && run mmc_read_vol ++emmc_read_recovery=mmc dev 0 && part start mmc 0 $part_recovery part_addr && part size mmc 0 $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 ++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 ++reset_factory=mmc dev 0 && mmc erase 0x2000 0x800 && reset ++_init_env=setenv _init_env ; setenv _create_env ; saveenv ; saveenv ++_firstboot=setenv _firstboot ; led bpi-r64:pio:blue on ; run _switch_to_menu ; run _init_env ; run boot_first ++_switch_to_menu=setenv _switch_to_menu ; setenv bootdelay 3 ; setenv bootmenu_delay 3 ; setenv bootmenu_0 $bootmenu_0d ; setenv bootmenu_0d ; run _bootmenu_update_title ++_bootmenu_update_title=setenv _bootmenu_update_title ; setenv bootmenu_title "$bootmenu_title [33m$ver[0m" |