166 lines
5.4 KiB
Plaintext
166 lines
5.4 KiB
Plaintext
#===============================================================================
|
|
# Common parameter configuration
|
|
#-------------------------------------------------------------------------------
|
|
|
|
earlycon=sbi
|
|
init=/init
|
|
# ramfs_dbg
|
|
# - 0: Don't stop in initramfs, normal boot to rootfs
|
|
# - 1: Stop in initramfs for debug
|
|
ramfs_dbg=0
|
|
bootdelay=0
|
|
baudrate=115200
|
|
preboot=
|
|
verify=no
|
|
#silent=no
|
|
|
|
# Set to yes to enable SPL Falcon mode
|
|
falcon_enable=yes
|
|
# Default should be set to 'no'
|
|
boot_os=no
|
|
|
|
knl_addr=0x41200000
|
|
dtb_addr=0x42200000
|
|
fdt_high=0xFFFFFFFFFFFFFFFF
|
|
|
|
# Kernel decompress working buffer and size
|
|
kernel_comp_addr_r=0x41200000
|
|
kernel_comp_size=0x1000000
|
|
|
|
# Common boot args
|
|
# Case 1: Mount initramfs, and then switch to rootfs
|
|
set_commonargs=setenv bootargs earlycon=${earlycon} earlyprintk rdinit=${init} initramfs_dbg=${ramfs_dbg}
|
|
# Case 2: Mount rootfs directly
|
|
# set_commonargs=setenv bootargs quiet earlycon=${earlycon} earlyprintk init=/linuxrc
|
|
|
|
|
|
#===============================================================================
|
|
# NAND boot configuration
|
|
#-------------------------------------------------------------------------------
|
|
|
|
# NAND flash rootfs, please use the correct ubi device
|
|
nand_root=ubi0:rootfs
|
|
nand_rootfstype=ubifs
|
|
# RootFS's mtd device number
|
|
ubi_rootfs_mtd=7
|
|
|
|
# Set the number of MTD partition that will be used during boot.
|
|
# It is used to filter-out MTD partitions not using during boot, so that u-boot
|
|
# no need to perform bad block checking for those partitions(big), and reduce
|
|
# boot time.
|
|
# Default it is set to 0, all partitions will be checked, but it will be updated
|
|
# in nand_boot script.
|
|
|
|
# Clear variable mtdparts, force u-boot get mtdparts in runtime from
|
|
# board_mtdparts_default()
|
|
set_nand_mtdargs=env delete mtdparts
|
|
|
|
set_nand_bootargs=run set_nand_mtdargs; \
|
|
run set_commonargs; \
|
|
setenv bootargs ${bootargs} mtdparts=${MTD} ubi.mtd=${ubi_rootfs_mtd} root=${nand_root} rootfstype=${nand_rootfstype}
|
|
|
|
nand_boot=echo "Try to boot from nand flash..."; \
|
|
run set_nand_bootargs; \
|
|
loadknl mtd kernel ${knl_addr}; \
|
|
if test ${falcon_enable} = yes; then \
|
|
spl export fdt ${knl_addr} \
|
|
mtd erase falcon; \
|
|
mtd write falcon ${fdtargsaddr} 0 ${fdtargslen}; \
|
|
setenv boot_os yes; \
|
|
saveenv; \
|
|
fi; \
|
|
bootm ${knl_addr};
|
|
|
|
|
|
#===============================================================================
|
|
# NOR boot configuration
|
|
#-------------------------------------------------------------------------------
|
|
|
|
# NOR flash rootfs device
|
|
nor_root=/dev/mtdblock7
|
|
nor_rootfstype=squashfs
|
|
|
|
set_nor_mtdargs=env delete mtdparts
|
|
|
|
set_nor_args=run set_nor_mtdargs; \
|
|
run set_commonargs; \
|
|
setenv bootargs ${bootargs} mtdparts=${MTD} root=${nor_root} rootfstype=${nor_rootfstype}
|
|
|
|
nor_boot=echo "Try to boot from nor flash..."; \
|
|
sf probe; \
|
|
run set_nor_args; \
|
|
loadknl mtd kernel ${knl_addr}; \
|
|
if test ${falcon_enable} = yes; then \
|
|
spl export fdt ${knl_addr} \
|
|
mtd erase falcon; \
|
|
mtd write falcon ${fdtargsaddr} 0 ${fdtargslen}; \
|
|
setenv boot_os yes; \
|
|
saveenv; \
|
|
fi; \
|
|
bootm ${knl_addr};
|
|
|
|
#===============================================================================
|
|
# SD/eMMC boot configuration
|
|
#-------------------------------------------------------------------------------
|
|
|
|
# eMMC/SDCard rootfs device
|
|
mmc_rootfstype=ext4
|
|
|
|
## Get "rootfs" partition number in decimal, and set var "mmc_root"
|
|
## Variable "boot_devnum" is set during board_lat_init()
|
|
set_mmc_root=part number mmc ${boot_devnum} rootfs rootfs_part; \
|
|
setexpr rootfs_part ${rootfs_part} + 0; \
|
|
setenv mmc_root "/dev/mmcblk${boot_devnum}p${rootfs_part}";
|
|
|
|
set_mmc_bootargs=run set_commonargs; \
|
|
run set_mmc_root; \
|
|
setenv bootargs "${bootargs}" root=${mmc_root} rootwait rootfstype=${mmc_rootfstype};
|
|
|
|
mmc_boot=echo "Try to boot from MMC..."; \
|
|
run set_mmc_bootargs; \
|
|
loadknl mmc ${boot_devnum} kernel ${knl_addr}; \
|
|
if test ${falcon_enable} = yes; then \
|
|
spl export fdt ${knl_addr} \
|
|
part start mmc ${boot_devnum} falcon falcon_lba; \
|
|
setexpr fdtargscnt ${fdtargslen} / 0x200; \
|
|
mmc write ${fdtargsaddr} ${falcon_lba} ${fdtargscnt}; \
|
|
setenv boot_os yes; \
|
|
saveenv; \
|
|
fi; \
|
|
bootm ${knl_addr};
|
|
|
|
#===============================================================================
|
|
# Boot script
|
|
#-------------------------------------------------------------------------------
|
|
|
|
# U-boot autoboot script: try to boot from device
|
|
# Variable "boot_device" is set in board_late_init()
|
|
|
|
boot_from_media=if test ${boot_device} = nand; then \
|
|
run nand_boot; \
|
|
elif test ${boot_device} = nor; then \
|
|
run nor_boot; \
|
|
elif test ${boot_device} = mmc; then \
|
|
run mmc_boot; \
|
|
fi;
|
|
|
|
autoboot=upg_detect; \
|
|
if test $? -eq 1; then \
|
|
if test ${upg_type} = usb; then \
|
|
echo "Run USB upgrade program"; \
|
|
aicupg usb 0; \
|
|
elif test ${upg_type} = sdcard; then \
|
|
echo "Run sdcard fat32 upgrade program"; \
|
|
aicupg fat mmc 1; \
|
|
elif test ${upg_type} = udisk; then \
|
|
echo "Run udisk fat32 upgrade program"; \
|
|
aicupg fat udisk 0; \
|
|
if test $? -eq 1; then \
|
|
run boot_from_media; \
|
|
fi; \
|
|
fi; \
|
|
else \
|
|
run boot_from_media; \
|
|
fi;
|
|
bootcmd=run autoboot;
|