2 +++ b/configs/mt7988a_bananapi_bpi-r4-emmc_defconfig
5 +CONFIG_SYS_HAS_NONCACHED_MEMORY=y
6 +CONFIG_POSITION_INDEPENDENT=y
7 +CONFIG_ARCH_MEDIATEK=y
8 +CONFIG_TEXT_BASE=0x41e00000
9 +CONFIG_SYS_MALLOC_F_LEN=0x4000
10 +CONFIG_NR_DRAM_BANKS=1
11 +CONFIG_SYS_PROMPT="MT7988> "
12 +CONFIG_TARGET_MT7988=y
13 +CONFIG_DEBUG_UART_BASE=0x11000000
14 +CONFIG_DEBUG_UART_CLOCK=40000000
15 +CONFIG_SYS_LOAD_ADDR=0x50000000
17 +CONFIG_SYS_CBSIZE=512
18 +CONFIG_SYS_PBSIZE=1049
19 +CONFIG_DEFAULT_DEVICE_TREE="mt7988a-bananapi-bpi-r4-emmc"
20 +CONFIG_DEFAULT_ENV_FILE="bananapi_bpi-r4_emmc_env"
21 +CONFIG_DEFAULT_FDT_FILE="mediatek/mt7988a-bpi-r4-emmc.dtb"
22 +CONFIG_OF_LIBFDT_OVERLAY=y
23 +CONFIG_OF_SYSTEM_SETUP=y
24 +CONFIG_SMBIOS_PRODUCT_NAME=""
25 +CONFIG_AUTOBOOT_KEYED=y
27 +CONFIG_AUTOBOOT_MENU_SHOW=y
28 +CONFIG_CFB_CONSOLE_ANSI=y
29 +CONFIG_BOARD_LATE_INIT=y
33 +CONFIG_CMD_ENV_FLAGS=y
35 +CONFIG_FIT_ENABLE_SHA256_SUPPORT=y
41 +CONFIG_CMD_BOOTMENU=y
51 +CONFIG_CMD_ENV_READMEM=y
52 +CONFIG_CMD_ERASEENV=y
56 +CONFIG_CMD_FS_GENERIC=y
64 +CONFIG_CMD_LINK_LOCAL=y
65 +# CONFIG_CMD_MBR is not set
70 +CONFIG_CMD_PSTORE_MEM_ADDR=0x42ff0000
76 +CONFIG_CMD_TFTPBOOT=y
79 +CONFIG_CMD_UBI_RENAME=y
91 +CONFIG_DISPLAY_CPUINFO=y
94 +CONFIG_DM_REGULATOR=y
95 +CONFIG_DM_REGULATOR_FIXED=y
96 +CONFIG_DM_REGULATOR_GPIO=y
100 +CONFIG_HUSH_PARSER=y
101 +CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
102 +CONFIG_SYS_RELOC_GD_ENV_ADDR=y
103 +CONFIG_VERSION_VARIABLE=y
104 +CONFIG_PARTITION_UUIDS=y
114 +CONFIG_PHY_MTK_TPHY=y
118 +CONFIG_MTD_UBI_FASTMAP=y
120 +CONFIG_PCIE_MEDIATEK=y
121 +CONFIG_PRE_CONSOLE_BUFFER=y
122 +CONFIG_PRE_CON_BUF_ADDR=0x4007EF00
127 +CONFIG_MMC_DEFAULT_DEV=1
128 +CONFIG_MMC_SUPPORTS_TUNING=y
131 +CONFIG_MTK_SPI_NAND=y
132 +CONFIG_MTK_SPI_NAND_MTD=y
133 +CONFIG_SYSRESET_WATCHDOG=y
138 +CONFIG_RANDOM_UUID=y
142 +CONFIG_USB_XHCI_HCD=y
143 +CONFIG_USB_XHCI_MTK=y
144 +CONFIG_USB_STORAGE=y
146 +CONFIG_ENV_OVERWRITE=y
147 +CONFIG_ENV_IS_IN_MMC=y
148 +CONFIG_ENV_OFFSET=0x400000
149 +CONFIG_ENV_OFFSET_REDUND=0x440000
150 +CONFIG_ENV_SIZE=0x40000
151 +CONFIG_ENV_SIZE_REDUND=0x40000
152 +CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
153 +CONFIG_NET_RANDOM_ETHADDR=y
157 +CONFIG_SUPPORT_EMMC_BOOT=y
158 +CONFIG_MMC_HS200_SUPPORT=y
162 +CONFIG_MEDIATEK_ETH=y
165 +CONFIG_PINCTRL_MT7988=y
166 +CONFIG_POWER_DOMAIN=y
167 +CONFIG_MTK_POWER_DOMAIN=y
168 +CONFIG_USE_DEFAULT_ENV_FILE=y
169 +CONFIG_MTD_SPI_NAND=y
172 +CONFIG_DM_SPI_FLASH=y
173 +CONFIG_SPI_FLASH_MTD=y
174 +CONFIG_SPI_FLASH_WINBOND=y
175 +# CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
178 +CONFIG_CMD_NAND_TRIMFFS=y
179 +CONFIG_LMB_MAX_REGIONS=64
181 +CONFIG_IPADDR="192.168.1.1"
182 +CONFIG_USE_SERVERIP=y
183 +CONFIG_SERVERIP="192.168.1.254"
185 +++ b/configs/mt7988a_bananapi_bpi-r4-sdmmc_defconfig
188 +CONFIG_SYS_HAS_NONCACHED_MEMORY=y
189 +CONFIG_POSITION_INDEPENDENT=y
190 +CONFIG_ARCH_MEDIATEK=y
191 +CONFIG_TEXT_BASE=0x41e00000
192 +CONFIG_SYS_MALLOC_F_LEN=0x4000
193 +CONFIG_NR_DRAM_BANKS=1
194 +CONFIG_SYS_PROMPT="MT7988> "
195 +CONFIG_TARGET_MT7988=y
196 +CONFIG_DEBUG_UART_BASE=0x11000000
197 +CONFIG_DEBUG_UART_CLOCK=40000000
198 +CONFIG_SYS_LOAD_ADDR=0x50000000
200 +CONFIG_SYS_CBSIZE=512
201 +CONFIG_SYS_PBSIZE=1049
202 +CONFIG_DEFAULT_DEVICE_TREE="mt7988a-bananapi-bpi-r4-sd"
203 +CONFIG_DEFAULT_ENV_FILE="bananapi_bpi-r4_sdmmc_env"
204 +CONFIG_DEFAULT_FDT_FILE="mediatek/mt7988a-bpi-r4-sd.dtb"
205 +CONFIG_OF_LIBFDT_OVERLAY=y
206 +CONFIG_OF_SYSTEM_SETUP=y
207 +CONFIG_SMBIOS_PRODUCT_NAME=""
208 +CONFIG_AUTOBOOT_KEYED=y
210 +CONFIG_AUTOBOOT_MENU_SHOW=y
211 +CONFIG_CFB_CONSOLE_ANSI=y
212 +CONFIG_BOARD_LATE_INIT=y
214 +CONFIG_BUTTON_GPIO=y
216 +CONFIG_CMD_ENV_FLAGS=y
218 +CONFIG_FIT_ENABLE_SHA256_SUPPORT=y
224 +CONFIG_CMD_BOOTMENU=y
234 +CONFIG_CMD_ENV_READMEM=y
235 +CONFIG_CMD_ERASEENV=y
239 +CONFIG_CMD_FS_GENERIC=y
240 +CONFIG_CMD_FS_UUID=y
246 +CONFIG_CMD_LICENSE=y
247 +CONFIG_CMD_LINK_LOCAL=y
248 +# CONFIG_CMD_MBR is not set
253 +CONFIG_CMD_PSTORE_MEM_ADDR=0x42ff0000
254 +CONFIG_CMD_SF_TEST=y
259 +CONFIG_CMD_TFTPBOOT=y
260 +CONFIG_CMD_TFTPSRV=y
262 +CONFIG_CMD_UBI_RENAME=y
267 +CONFIG_CMD_SETEXPR=y
271 +CONFIG_CMD_STRINGS=y
274 +CONFIG_DISPLAY_CPUINFO=y
277 +CONFIG_DM_REGULATOR=y
278 +CONFIG_DM_REGULATOR_FIXED=y
279 +CONFIG_DM_REGULATOR_GPIO=y
283 +CONFIG_HUSH_PARSER=y
284 +CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
285 +CONFIG_SYS_RELOC_GD_ENV_ADDR=y
286 +CONFIG_VERSION_VARIABLE=y
287 +CONFIG_PARTITION_UUIDS=y
297 +CONFIG_PHY_MTK_TPHY=y
301 +CONFIG_MTD_UBI_FASTMAP=y
303 +CONFIG_PCIE_MEDIATEK=y
304 +CONFIG_PRE_CONSOLE_BUFFER=y
305 +CONFIG_PRE_CON_BUF_ADDR=0x4007EF00
310 +CONFIG_MMC_DEFAULT_DEV=1
311 +CONFIG_MMC_SUPPORTS_TUNING=y
314 +CONFIG_MTK_SPI_NAND=y
315 +CONFIG_MTK_SPI_NAND_MTD=y
316 +CONFIG_SYSRESET_WATCHDOG=y
321 +CONFIG_RANDOM_UUID=y
325 +CONFIG_USB_XHCI_HCD=y
326 +CONFIG_USB_XHCI_MTK=y
327 +CONFIG_USB_STORAGE=y
329 +CONFIG_ENV_OVERWRITE=y
330 +CONFIG_ENV_IS_IN_MMC=y
331 +CONFIG_ENV_OFFSET=0x400000
332 +CONFIG_ENV_OFFSET_REDUND=0x440000
333 +CONFIG_ENV_SIZE=0x40000
334 +CONFIG_ENV_SIZE_REDUND=0x40000
335 +CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
336 +CONFIG_NET_RANDOM_ETHADDR=y
340 +CONFIG_SUPPORT_EMMC_BOOT=y
341 +CONFIG_MMC_HS200_SUPPORT=y
345 +CONFIG_MEDIATEK_ETH=y
348 +CONFIG_PINCTRL_MT7988=y
349 +CONFIG_POWER_DOMAIN=y
350 +CONFIG_MTK_POWER_DOMAIN=y
351 +CONFIG_USE_DEFAULT_ENV_FILE=y
352 +CONFIG_MTD_SPI_NAND=y
355 +CONFIG_DM_SPI_FLASH=y
356 +CONFIG_SPI_FLASH_MTD=y
357 +CONFIG_SPI_FLASH_WINBOND=y
358 +# CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
361 +CONFIG_CMD_NAND_TRIMFFS=y
362 +CONFIG_LMB_MAX_REGIONS=64
364 +CONFIG_IPADDR="192.168.1.1"
365 +CONFIG_USE_SERVERIP=y
366 +CONFIG_SERVERIP="192.168.1.254"
368 +++ b/configs/mt7988a_bananapi_bpi-r4-snand_defconfig
371 +CONFIG_SYS_HAS_NONCACHED_MEMORY=y
372 +CONFIG_POSITION_INDEPENDENT=y
373 +CONFIG_ARCH_MEDIATEK=y
374 +CONFIG_TEXT_BASE=0x41e00000
375 +CONFIG_SYS_MALLOC_F_LEN=0x4000
376 +CONFIG_NR_DRAM_BANKS=1
377 +CONFIG_SYS_PROMPT="MT7988> "
378 +CONFIG_TARGET_MT7988=y
379 +CONFIG_DEBUG_UART_BASE=0x11000000
380 +CONFIG_DEBUG_UART_CLOCK=40000000
381 +CONFIG_SYS_LOAD_ADDR=0x50000000
383 +CONFIG_SYS_CBSIZE=512
384 +CONFIG_SYS_PBSIZE=1049
385 +CONFIG_DEFAULT_DEVICE_TREE="mt7988a-bananapi-bpi-r4-emmc"
386 +CONFIG_DEFAULT_ENV_FILE="bananapi_bpi-r4_snand_env"
387 +CONFIG_DEFAULT_FDT_FILE="mediatek/mt7988a-bpi-r4-emmc.dtb"
388 +CONFIG_OF_LIBFDT_OVERLAY=y
389 +CONFIG_OF_SYSTEM_SETUP=y
390 +CONFIG_SMBIOS_PRODUCT_NAME=""
391 +CONFIG_AUTOBOOT_KEYED=y
393 +CONFIG_AUTOBOOT_MENU_SHOW=y
394 +CONFIG_CFB_CONSOLE_ANSI=y
395 +CONFIG_BOARD_LATE_INIT=y
397 +CONFIG_BUTTON_GPIO=y
399 +CONFIG_CMD_ENV_FLAGS=y
401 +CONFIG_FIT_ENABLE_SHA256_SUPPORT=y
407 +CONFIG_CMD_BOOTMENU=y
417 +CONFIG_CMD_ENV_READMEM=y
418 +CONFIG_CMD_ERASEENV=y
422 +CONFIG_CMD_FS_GENERIC=y
423 +CONFIG_CMD_FS_UUID=y
429 +CONFIG_CMD_LICENSE=y
430 +CONFIG_CMD_LINK_LOCAL=y
431 +# CONFIG_CMD_MBR is not set
436 +CONFIG_CMD_PSTORE_MEM_ADDR=0x42ff0000
437 +CONFIG_CMD_SF_TEST=y
442 +CONFIG_CMD_TFTPBOOT=y
443 +CONFIG_CMD_TFTPSRV=y
445 +CONFIG_CMD_UBI_RENAME=y
450 +CONFIG_CMD_SETEXPR=y
454 +CONFIG_CMD_STRINGS=y
457 +CONFIG_DISPLAY_CPUINFO=y
460 +CONFIG_DM_REGULATOR=y
461 +CONFIG_DM_REGULATOR_FIXED=y
462 +CONFIG_DM_REGULATOR_GPIO=y
466 +CONFIG_HUSH_PARSER=y
467 +CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
468 +CONFIG_SYS_RELOC_GD_ENV_ADDR=y
469 +CONFIG_VERSION_VARIABLE=y
470 +CONFIG_PARTITION_UUIDS=y
480 +CONFIG_PHY_MTK_TPHY=y
484 +CONFIG_MTD_UBI_FASTMAP=y
486 +CONFIG_PCIE_MEDIATEK=y
487 +CONFIG_PINCTRL_MT7988=y
488 +CONFIG_PRE_CONSOLE_BUFFER=y
489 +CONFIG_PRE_CON_BUF_ADDR=0x4007EF00
494 +CONFIG_MMC_DEFAULT_DEV=1
495 +CONFIG_MMC_SUPPORTS_TUNING=y
498 +CONFIG_MTK_SPI_NAND=y
499 +CONFIG_MTK_SPI_NAND_MTD=y
500 +CONFIG_SYSRESET_WATCHDOG=y
505 +CONFIG_RANDOM_UUID=y
509 +CONFIG_USB_XHCI_HCD=y
510 +CONFIG_USB_XHCI_MTK=y
511 +CONFIG_USB_STORAGE=y
513 +CONFIG_ENV_OVERWRITE=y
514 +CONFIG_ENV_IS_IN_UBI=y
515 +CONFIG_ENV_UBI_PART="ubi"
516 +CONFIG_ENV_SIZE=0x1f000
517 +CONFIG_ENV_SIZE_REDUND=0x1f000
518 +CONFIG_ENV_UBI_VOLUME="ubootenv"
519 +CONFIG_ENV_UBI_VOLUME_REDUND="ubootenv2"
520 +CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
521 +CONFIG_NET_RANDOM_ETHADDR=y
525 +CONFIG_SUPPORT_EMMC_BOOT=y
526 +CONFIG_MMC_HS200_SUPPORT=y
530 +CONFIG_MEDIATEK_ETH=y
533 +CONFIG_PINCTRL_MT7988=y
534 +CONFIG_POWER_DOMAIN=y
535 +CONFIG_MTK_POWER_DOMAIN=y
536 +CONFIG_USE_DEFAULT_ENV_FILE=y
537 +CONFIG_MTD_SPI_NAND=y
540 +CONFIG_DM_SPI_FLASH=y
541 +CONFIG_SPI_FLASH_MTD=y
542 +CONFIG_SPI_FLASH_WINBOND=y
543 +# CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
546 +CONFIG_CMD_NAND_TRIMFFS=y
547 +CONFIG_LMB_MAX_REGIONS=64
549 +CONFIG_IPADDR="192.168.1.1"
550 +CONFIG_USE_SERVERIP=y
551 +CONFIG_SERVERIP="192.168.1.254"
553 +++ b/bananapi_bpi-r4_sdmmc_env
556 +serverip=192.168.1.254
558 +bootargs=console=ttyS0,115200n1 pci=pcie_bus_perf root=/dev/fit0
559 +bootcmd=if pstore check ; then run boot_recovery ; else run boot_sdmmc ; fi
560 +bootconf=config-mt7988a-bananapi-bpi-r4
561 +bootconf_sd=mt7988a-bananapi-bpi-r4-sd
562 +bootconf_emmc=mt7988a-bananapi-bpi-r4-emmc
565 +bootfile=openwrt-mediatek-filogic-bananapi_bpi-r4-initramfs-recovery.itb
566 +bootfile_upg=openwrt-mediatek-filogic-bananapi_bpi-r4-squashfs-sysupgrade.itb
567 +bootled_pwr=green:status
568 +bootled_rec=blue:status
569 +bootmenu_confirm_return=askenv - Press ENTER to return to menu ; bootmenu 60
572 +bootmenu_title=
\e[0;34m( ( (
\e[1;39mOpenWrt
\e[0;34m ) ) )
\e[0;36m[SD card]
\e[0m
573 +bootmenu_0=Initialize environment.=run _firstboot
574 +bootmenu_0d=Run default boot command.=run boot_default
575 +bootmenu_1=Boot system via TFTP.=run boot_tftp ; run bootmenu_confirm_return
576 +bootmenu_2=Boot production system from SD card.=run boot_production ; run bootmenu_confirm_return
577 +bootmenu_3=Boot recovery system from SD card.=run boot_recovery ; run bootmenu_confirm_return
578 +bootmenu_4=Load production system via TFTP then write to SD card.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_production ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return
579 +bootmenu_5=Load recovery system via TFTP then write to SD card.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_recovery ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return
580 +bootmenu_6=
\e[31mInstall bootloader, recovery and production to NAND.
\e[0m=if nand info ; then run ubi_init ; else echo "NAND not detected" ; fi ; run bootmenu_confirm_return
581 +bootmenu_7=Reboot.=reset
582 +bootmenu_8=Reset all settings to factory defaults.=run reset_factory ; reset
583 +boot_first=if button reset ; then led $bootled_rec on ; run boot_tftp_recovery ; setenv flag_recover 1 ; run boot_default ; fi ; bootmenu
584 +boot_default=if env exists flag_recover ; then else run bootcmd ; fi ; run boot_recovery ; setenv replacevol 1 ; run boot_tftp_forever
585 +boot_production=led $bootled_pwr on ; run sdmmc_read_production && bootm $loadaddr#$bootconf#$bootconf_sd#$bootconf_extra ; led $bootled_pwr off
586 +boot_recovery=led $bootled_rec on ; run sdmmc_read_recovery && bootm $loadaddr#$bootconf#$bootconf_emmc ; led $bootled_rec off
587 +boot_sdmmc=run boot_production ; run boot_recovery
588 +boot_tftp_forever=led $bootled_rec on ; while true ; do run boot_tftp_recovery ; sleep 1 ; done
589 +boot_tftp_production=tftpboot $loadaddr $bootfile_upg && env exists replacevol && iminfo $loadaddr && run sdmmc_write_production ; if env exists noboot ; then else bootm $loadaddr#$bootconf#$bootconf_sd#$bootconf_extra ; fi
590 +boot_tftp_recovery=tftpboot $loadaddr $bootfile && env exists replacevol && iminfo $loadaddr && run sdmmc_write_recovery ; if env exists noboot ; then else bootm $loadaddr#$bootconf#$bootconf_sd ; fi
591 +boot_tftp=tftpboot $loadaddr $bootfile && bootm $loadaddr#$bootconf#$bootconf_sd
592 +mmc_write_vol=imszb $loadaddr image_size && test 0x$image_size -le 0x$part_size && mmc erase 0x$part_addr 0x$image_size && mmc write $loadaddr 0x$part_addr 0x$image_size
593 +mmc_read_vol=mmc read $loadaddr $part_addr 0x100 && imszb $loadaddr image_size && test 0x$image_size -le 0x$part_size && mmc read $loadaddr 0x$part_addr 0x$image_size && setexpr filesize $image_size * 0x200
594 +part_default=production
595 +part_recovery=recovery
596 +reset_factory=eraseenv && reset
597 +sdmmc_read_production=part start mmc 0 $part_default part_addr && part size mmc 0 $part_default part_size && run mmc_read_vol
598 +sdmmc_read_recovery=part start mmc 0 $part_recovery part_addr && part size mmc 0 $part_recovery part_size && run mmc_read_vol
599 +sdmmc_read_snand_bl2=part start mmc 0 install part_addr && mmc read $loadaddr $part_addr 0x400
600 +sdmmc_read_snand_fip=part start mmc 0 install part_addr && setexpr offset $part_addr + 0x800 && mmc read $loadaddr $offset 0x1000
601 +sdmmc_read_emmc_install=part start mmc 0 install part_addr && setexpr offset $part_addr + 0x3800 && mmc read $loadaddr $offset 0x4000
602 +sdmmc_write_production=part start mmc 0 $part_default part_addr && part size mmc 0 $part_default part_size && run mmc_write_vol
603 +sdmmc_write_recovery=part start mmc 0 $part_recovery part_addr && part size mmc 0 $part_recovery part_size && run mmc_write_vol
604 +snand_write_bl2=mtd erase bl2 && mtd write bl2 $loadaddr 0x0 0x80000 && mtd write bl2 $loadaddr 0x80000 0x80000 && mtd write bl2 $loadaddr 0x100000 0x80000 && mtd write bl2 $loadaddr 0x180000 0x80000
605 +ubi_create_env=ubi create ubootenv 0x100000 dynamic 1 ; ubi create ubootenv2 0x100000 dynamic 2
606 +ubi_format=ubi detach ; mtd erase ubi && ubi part ubi
607 +ubi_init=run ubi_format && run ubi_init_bl && run ubi_create_env && run ubi_init_openwrt && run ubi_init_emmc_install
608 +ubi_init_openwrt=run sdmmc_read_recovery && iminfo $loadaddr && run ubi_write_recovery ; run sdmmc_read_production && iminfo $loadaddr && run ubi_write_production
609 +ubi_init_bl=run sdmmc_read_snand_bl2 && run snand_write_bl2 && run sdmmc_read_snand_fip && run ubi_write_fip
610 +ubi_init_emmc_install=run sdmmc_read_emmc_install && run ubi_write_emmc_install
611 +ubi_prepare_rootfs=if ubi check rootfs_data ; then else if env exists rootfs_data_max ; then ubi create rootfs_data $rootfs_data_max dynamic || ubi create rootfs_data - dynamic ; else ubi create rootfs_data - dynamic ; fi ; fi
612 +ubi_remove_rootfs=ubi check rootfs_data && ubi remove rootfs_data
613 +ubi_write_fip=run ubi_remove_rootfs ; ubi check fip && ubi remove fip ; ubi create fip 0x200000 static ; ubi write $loadaddr fip 0x200000
614 +ubi_write_emmc_install=ubi check emmc_install && ubi remove emmc_install ; ubi create emmc_install 0x800000 dynamic ; ubi write $loadaddr emmc_install 0x800000
615 +ubi_write_production=ubi check fit && ubi remove fit ; run ubi_remove_rootfs ; ubi create fit $filesize dynamic && ubi write $loadaddr fit $filesize
616 +ubi_write_recovery=ubi check recovery && ubi remove recovery ; run ubi_remove_rootfs ; ubi create recovery $filesize dynamic && ubi write $loadaddr recovery $filesize
617 +_init_env=setenv _init_env ; setenv _create_env ; saveenv ; saveenv
618 +_firstboot=setenv _firstboot ; run _switch_to_menu ; run _init_env ; run boot_first
619 +_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
620 +_bootmenu_update_title=setenv _bootmenu_update_title ; setenv bootmenu_title "$bootmenu_title
\e[33m$ver
\e[0m"
622 +++ b/bananapi_bpi-r4_snand_env
625 +serverip=192.168.1.254
627 +bootargs=console=ttyS0,115200n1 pci=pcie_bus_perf root=/dev/fit0 ubi.block=0,fit
628 +bootconf=config-mt7988a-bananapi-bpi-r4
629 +bootconf_extra=mt7988a-bananapi-bpi-r4-emmc
630 +bootcmd=if pstore check ; then run boot_recovery ; else run boot_ubi ; fi
632 +bootfile=openwrt-mediatek-filogic-bananapi_bpi-r4-initramfs-recovery.itb
633 +bootfile_bl2=openwrt-mediatek-filogic-bananapi_bpi-r4-snand-preloader.bin
634 +bootfile_fip=openwrt-mediatek-filogic-bananapi_bpi-r4-snand-bl31-uboot.fip
635 +bootfile_upg=openwrt-mediatek-filogic-bananapi_bpi-r4-squashfs-sysupgrade.itb
636 +bootled_pwr=green:status
637 +bootled_rec=blue:status
638 +bootmenu_confirm_return=askenv - Press ENTER to return to menu ; bootmenu 60
641 +bootmenu_title=
\e[0;34m( ( (
\e[1;39mOpenWrt
\e[0;34m ) ) )
\e[0;36m[SPI-NAND]
\e[0m
642 +bootmenu_0=Initialize environment.=run _firstboot
643 +bootmenu_0d=Run default boot command.=run boot_default
644 +bootmenu_1=Boot system via TFTP.=run boot_tftp ; run bootmenu_confirm_return
645 +bootmenu_2=Boot production system from NAND.=run boot_production ; run bootmenu_confirm_return
646 +bootmenu_3=Boot recovery system from NAND.=run boot_recovery ; run bootmenu_confirm_return
647 +bootmenu_4=Load production system via TFTP then write to NAND.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_production ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return
648 +bootmenu_5=Load recovery system via TFTP then write to NAND.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_recovery ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return
649 +bootmenu_6=
\e[31mLoad BL31+U-Boot FIP via TFTP then write to NAND.
\e[0m=run boot_tftp_write_fip ; run bootmenu_confirm_return
650 +bootmenu_7=
\e[31mLoad BL2 preloader via TFTP then write to NAND.
\e[0m=run boot_tftp_write_bl2 ; run bootmenu_confirm_return
651 +bootmenu_8=
\e[31mInstall bootloader, recovery and production to eMMC.
\e[0m=if mmc partconf 0 ; then run emmc_init ; else echo "eMMC not detected" ; fi ; run bootmenu_confirm_return
652 +bootmenu_9=Reboot.=reset
653 +bootmenu_10=Reset all settings to factory defaults.=run reset_factory ; reset
654 +boot_first=if button reset ; then led $bootled_rec on ; run boot_tftp_recovery ; setenv flag_recover 1 ; run boot_default ; fi ; bootmenu
655 +boot_default=if env exists flag_recover ; then else run bootcmd ; fi ; run boot_recovery ; setenv replacevol 1 ; run boot_tftp_forever
656 +boot_production=led $bootled_pwr on ; run ubi_read_production && bootm $loadaddr#$bootconf#$bootconf_extra ; led $bootled_pwr off
657 +boot_recovery=led $bootled_rec on ; run ubi_read_recovery && bootm $loadaddr#$bootconf ; led $bootled_rec off
658 +boot_ubi=run boot_production ; run boot_recovery
659 +boot_tftp_forever=led $bootled_rec on ; while true ; do run boot_tftp_recovery ; sleep 1 ; done
660 +boot_tftp_production=tftpboot $loadaddr $bootfile_upg && env exists replacevol && iminfo $loadaddr && run ubi_write_production ; if env exists noboot ; then else bootm $loadaddr#$bootconf#$bootconf_extra ; fi
661 +boot_tftp_recovery=tftpboot $loadaddr $bootfile && env exists replacevol && iminfo $loadaddr && run ubi_write_recovery ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi
662 +boot_tftp=tftpboot $loadaddr $bootfile && bootm $loadaddr#$bootconf
663 +boot_tftp_write_fip=tftpboot $loadaddr $bootfile_fip && run ubi_write_fip && run reset_factory
664 +boot_tftp_write_bl2=tftpboot $loadaddr $bootfile_bl2 && run snand_write_bl2
665 +part_default=production
666 +part_recovery=recovery
667 +reset_factory=ubi part ubi ; mw $loadaddr 0x0 0x800 ; ubi write $loadaddr ubootenv 0x800 ; ubi write $loadaddr ubootenv2 0x800
668 +snand_write_bl2=mtd erase bl2 && mtd write bl2 $loadaddr 0x0 0x80000 && mtd write bl2 $loadaddr 0x80000 0x80000 && mtd write bl2 $loadaddr 0x100000 0x80000 && mtd write bl2 $loadaddr 0x180000 0x80000
669 +ubi_create_env=ubi check ubootenv || ubi create ubootenv 0x100000 dynamic 1 ; ubi check ubootenv2 || ubi create ubootenv2 0x100000 dynamic 2
670 +ubi_prepare_rootfs=if ubi check rootfs_data ; then else if env exists rootfs_data_max ; then ubi create rootfs_data $rootfs_data_max dynamic || ubi create rootfs_data - dynamic ; else ubi create rootfs_data - dynamic ; fi ; fi
671 +ubi_read_production=ubi read $loadaddr fit && iminfo $loadaddr && run ubi_prepare_rootfs
672 +ubi_read_recovery=ubi check recovery && ubi read $loadaddr recovery
673 +ubi_read_emmc_install=ubi check emmc_install && ubi read $loadaddr emmc_install
674 +ubi_remove_rootfs=ubi check rootfs_data && ubi remove rootfs_data
675 +ubi_write_fip=run ubi_remove_rootfs ; ubi check fip && ubi remove fip ; ubi create fip 0x200000 static ; ubi write $loadaddr fip 0x200000
676 +ubi_write_production=ubi check fit && ubi remove fit ; run ubi_remove_rootfs ; ubi create fit $filesize dynamic && ubi write $loadaddr fit $filesize
677 +ubi_write_recovery=ubi check recovery && ubi remove recovery ; run ubi_remove_rootfs ; ubi create recovery $filesize dynamic && ubi write $loadaddr recovery $filesize
678 +mmc_write_vol=imszb $loadaddr image_size && test 0x$image_size -le 0x$part_size && mmc erase 0x$part_addr 0x$image_size && mmc write $loadaddr 0x$part_addr 0x$image_size
679 +emmc_init=mmc dev 0 && mmc bootbus 0 0 0 0 && run emmc_init_bl && run emmc_init_openwrt ; env default bootcmd ; saveenv ; saveenv
680 +emmc_init_bl=run ubi_read_emmc_install && setenv fileaddr $loadaddr && run emmc_write_bl2 && setexpr fileaddr $loadaddr + 0x100000 && run emmc_write_fip && setexpr fileaddr $loadaddr + 0x500000 && run emmc_write_hdr
681 +emmc_init_openwrt=run ubi_read_recovery && iminfo $loadaddr && run emmc_write_recovery ; run ubi_read_production && iminfo $loadaddr && run emmc_write_production
682 +emmc_write_bl2=mmc partconf 0 1 1 1 && mmc erase 0x0 0x400 && mmc write $fileaddr 0x0 0x400 ; mmc partconf 0 1 1 0
683 +emmc_write_fip=mmc erase 0x3400 0x2000 && mmc write $fileaddr 0x3400 0x2000 && mmc erase 0x2000 0x800
684 +emmc_write_hdr=mmc erase 0x0 0x40 && mmc write $fileaddr 0x0 0x40
685 +emmc_write_production=part start mmc 0 $part_default part_addr && part size mmc 0 $part_default part_size && run mmc_write_vol
686 +emmc_write_recovery=part start mmc 0 $part_recovery part_addr && part size mmc 0 $part_recovery part_size && run mmc_write_vol
687 +_init_env=setenv _init_env ; run ubi_create_env ; saveenv ; saveenv
688 +_firstboot=setenv _firstboot ; run _switch_to_menu ; run _init_env ; run boot_first
689 +_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
690 +_bootmenu_update_title=setenv _bootmenu_update_title ; setenv bootmenu_title "$bootmenu_title
\e[33m$ver
\e[0m"
692 +++ b/bananapi_bpi-r4_emmc_env
695 +serverip=192.168.1.254
697 +bootargs=console=ttyS0,115200n1 pci=pcie_bus_perf root=/dev/fit0
698 +bootcmd=if pstore check ; then run boot_recovery ; else run boot_emmc ; fi
699 +bootconf=config-mt7988a-bananapi-bpi-r4
700 +bootconf_base=config-mt7988a-bananapi-bpi-r4
701 +bootconf_emmc=mt7988a-bananapi-bpi-r4-emmc
704 +bootfile=openwrt-mediatek-filogic-bananapi_bpi-r4-initramfs-recovery.itb
705 +bootfile_bl2=openwrt-mediatek-filogic-bananapi_bpi-r4-emmc-preloader.bin
706 +bootfile_fip=openwrt-mediatek-filogic-bananapi_bpi-r4-emmc-bl31-uboot.fip
707 +bootfile_upg=openwrt-mediatek-filogic-bananapi_bpi-r4-squashfs-sysupgrade.itb
708 +bootled_pwr=green:status
709 +bootled_rec=blue:status
710 +bootmenu_confirm_return=askenv - Press ENTER to return to menu ; bootmenu 60
713 +bootmenu_title=
\e[0;34m( ( (
\e[1;39mOpenWrt
\e[0;34m ) ) )
\e[0;36m[eMMC]
\e[0m
714 +bootmenu_0=Initialize environment.=run _firstboot
715 +bootmenu_0d=Run default boot command.=run boot_default
716 +bootmenu_1=Boot system via TFTP.=run boot_tftp ; run bootmenu_confirm_return
717 +bootmenu_2=Boot production system from eMMC.=run boot_production ; run bootmenu_confirm_return
718 +bootmenu_3=Boot recovery system from eMMC.=run boot_recovery ; run bootmenu_confirm_return
719 +bootmenu_4=Load production system via TFTP then write to eMMC.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_production ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return
720 +bootmenu_5=Load recovery system via TFTP then write to eMMC.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_recovery ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return
721 +bootmenu_6=
\e[31mLoad BL31+U-Boot FIP via TFTP then write to eMMC.
\e[0m=run boot_tftp_write_fip ; run bootmenu_confirm_return
722 +bootmenu_7=
\e[31mLoad BL2 preloader via TFTP then write to eMMC.
\e[0m=run boot_tftp_write_bl2 ; run bootmenu_confirm_return
723 +bootmenu_8=Reboot.=reset
724 +bootmenu_9=Reset all settings to factory defaults.=run reset_factory ; reset
725 +boot_first=if button reset ; then led $bootled_rec on ; run boot_tftp_recovery ; setenv flag_recover 1 ; run boot_default ; fi ; bootmenu
726 +boot_default=if env exists flag_recover ; then else run bootcmd ; fi ; run boot_recovery ; setenv replacevol 1 ; run boot_tftp_forever
727 +boot_production=led $bootled_pwr on ; run emmc_read_production && bootm $loadaddr#$bootconf#$bootconf_emmc#$bootconf_extra ; led $bootled_pwr off
728 +boot_recovery=led $bootled_rec on ; run emmc_read_recovery && bootm $loadaddr#$bootconf#$bootconf_emmc#$bootconf_extra ; led $bootled_rec off
729 +boot_emmc=run boot_production ; run boot_recovery
730 +boot_tftp_forever=led $bootled_rec on ; while true ; do run boot_tftp_recovery ; sleep 1 ; done
731 +boot_tftp_production=tftpboot $loadaddr $bootfile_upg && env exists replacevol && iminfo $loadaddr && run emmc_write_production ; if env exists noboot ; then else bootm $loadaddr#$bootconf#$bootconf_emmc#$bootconf_extra ; fi
732 +boot_tftp_recovery=tftpboot $loadaddr $bootfile && env exists replacevol && iminfo $loadaddr && run emmc_write_recovery ; if env exists noboot ; then else bootm $loadaddr#$bootconf#$bootconf_emmc ; fi
733 +boot_tftp_write_fip=tftpboot $loadaddr $bootfile_fip && run emmc_write_fip
734 +boot_tftp_write_bl2=tftpboot $loadaddr $bootfile_bl2 && run emmc_write_bl2
735 +boot_tftp=tftpboot $loadaddr $bootfile && bootm $loadaddr#$bootconf
736 +mmc_write_vol=imszb $loadaddr image_size && test 0x$image_size -le 0x$part_size && mmc erase 0x$part_addr 0x$image_size && mmc write $loadaddr 0x$part_addr 0x$image_size
737 +mmc_read_vol=mmc read $loadaddr $part_addr 0x100 && imszb $loadaddr image_size && test 0x$image_size -le 0x$part_size && mmc read $loadaddr 0x$part_addr 0x$image_size && setexpr filesize $image_size * 0x200
738 +part_default=production
739 +part_recovery=recovery
740 +reset_factory=eraseenv && reset
741 +emmc_read_production=part start mmc 0 $part_default part_addr && part size mmc 0 $part_default part_size && run mmc_read_vol
742 +emmc_read_recovery=part start mmc 0 $part_recovery part_addr && part size mmc 0 $part_recovery part_size && run mmc_read_vol
743 +emmc_write_bl2=mmc partconf 0 1 1 1 && mmc erase 0x0 0x400 && mmc write $fileaddr 0x0 0x400 ; mmc partconf 0 1 1 0
744 +emmc_write_fip=mmc erase 0x3400 0x2000 && mmc write $fileaddr 0x3400 0x2000 && mmc erase 0x2000 0x800
745 +emmc_write_production=part start mmc 0 $part_default part_addr && part size mmc 0 $part_default part_size && run mmc_write_vol
746 +emmc_write_recovery=part start mmc 0 $part_recovery part_addr && part size mmc 0 $part_recovery part_size && run mmc_write_vol
747 +_init_env=setenv _init_env ; setenv _create_env ; saveenv ; saveenv
748 +_firstboot=setenv _firstboot ; run _switch_to_menu ; run _init_env ; run boot_first
749 +_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
750 +_bootmenu_update_title=setenv _bootmenu_update_title ; setenv bootmenu_title "$bootmenu_title
\e[33m$ver
\e[0m"
752 +++ b/arch/arm/dts/mt7988a-bananapi-bpi-r4.dtsi
754 +// SPDX-License-Identifier: GPL-2.0
756 + * Copyright (c) 2022 MediaTek Inc.
757 + * Author: Sam Shih <sam.shih@mediatek.com>
761 +#include "mt7988.dtsi"
762 +#include <dt-bindings/gpio/gpio.h>
763 +#include <dt-bindings/input/linux-event-codes.h>
766 + model = "Bananapi BPI-R4";
767 + compatible = "bananapi,bpi-r4", "mediatek,mt7988";
770 + stdout-path = &uart0;
774 + device_type = "memory";
775 + reg = <0 0x40000000 0 0x10000000>;
778 + reg_3p3v: regulator-3p3v {
779 + compatible = "regulator-fixed";
780 + regulator-name = "fixed-3.3V";
781 + regulator-min-microvolt = <3300000>;
782 + regulator-max-microvolt = <3300000>;
784 + regulator-always-on;
787 + reg_1p8v: regulator-1p8v {
788 + compatible = "regulator-fixed";
789 + regulator-name = "fixed-1.8V";
790 + regulator-min-microvolt = <1800000>;
791 + regulator-max-microvolt = <1800000>;
793 + regulator-always-on;
797 + compatible = "gpio-keys";
801 + linux,code = <KEY_RESTART>;
802 + gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
807 + compatible = "gpio-leds";
809 + led_status_green: led-green {
810 + label = "green:status";
811 + gpios = <&gpio 79 GPIO_ACTIVE_HIGH>;
814 + led_status_blue: led-blue {
815 + label = "blue:status";
816 + gpios = <&gpio 63 GPIO_ACTIVE_HIGH>;
826 + pinctrl-names = "default";
827 + pinctrl-0 = <&i2c1_pins>;
833 + mediatek,gmac-id = <0>;
834 + phy-mode = "usxgmii";
835 + mediatek,switch = "mt7988";
845 + i2c1_pins: i2c1-pins {
852 + pwm_pins: pwm-pins {
855 + groups = "pwm0", "pwm1", "pwm2", "pwm3", "pwm4",
856 + "pwm5", "pwm6", "pwm7";
860 + spi0_pins: spi0-pins {
863 + groups = "spi0", "spi0_wp_hold";
867 + mmc0_pins_default: mmc0default {
869 + function = "flash";
870 + groups = "emmc_51";
874 + pins = "EMMC_DATA_0", "EMMC_DATA_1", "EMMC_DATA_2",
875 + "EMMC_DATA_3", "EMMC_DATA_4", "EMMC_DATA_5",
876 + "EMMC_DATA_6", "EMMC_DATA_7", "EMMC_CMD";
889 + pins = "EMMC_RSTB";
893 + mmc1_pins_default: mmc1default {
895 + function = "flash";
896 + groups = "emmc_45";
900 + pins = "SPI2_CSB", "SPI2_MISO", "SPI2_MOSI",
901 + "SPI2_CLK", "SPI2_HOLD";
912 + pinctrl-names = "default";
913 + pinctrl-0 = <&pwm_pins>;
918 + pinctrl-names = "default";
919 + pinctrl-0 = <&spi0_pins>;
920 + #address-cells = <1>;
932 + compatible = "spi-nand";
934 + spi-max-frequency = <52000000>;
936 + compatible = "fixed-partitions";
937 + #address-cells = <1>;
942 + reg = <0x0 0x200000>;
947 + reg = <0x200000 0x7e00000>;
948 + compatible = "linux,ubi";
954 +++ b/arch/arm/dts/mt7988a-bananapi-bpi-r4-sd.dts
956 +// SPDX-License-Identifier: GPL-2.0
958 + * Copyright (c) 2022 MediaTek Inc.
959 + * Author: Sam Shih <sam.shih@mediatek.com>
963 +#include "mt7988a-bananapi-bpi-r4.dtsi"
966 + pinctrl-names = "default";
967 + pinctrl-0 = <&mmc1_pins_default>;
968 + max-frequency = <52000000>;
971 + vmmc-supply = <®_3p3v>;
972 + vqmmc-supply = <®_3p3v>;
976 +++ b/arch/arm/dts/mt7988a-bananapi-bpi-r4-emmc.dts
978 +// SPDX-License-Identifier: GPL-2.0
980 + * Copyright (c) 2022 MediaTek Inc.
981 + * Author: Sam Shih <sam.shih@mediatek.com>
985 +#include "mt7988a-bananapi-bpi-r4.dtsi"
988 + pinctrl-names = "default";
989 + pinctrl-0 = <&mmc0_pins_default>;
990 + max-frequency = <52000000>;
994 + vmmc-supply = <®_3p3v>;
995 + vqmmc-supply = <®_1p8v>;