U-BOOT-STM32MP-EXTLINUX: update for v2.0.0
Change-Id: Iae892ccf630ff290ee337bead4d36e753e24db15
This commit is contained in:
parent
6f08519d2c
commit
c3ccf68bd4
|
|
@ -8,7 +8,7 @@ PACKAGE_ARCH = "${MACHINE_ARCH}"
|
|||
|
||||
SRC_URI = "file://boot.scr.cmd"
|
||||
|
||||
PV = "2.6"
|
||||
PV = "3.1"
|
||||
|
||||
inherit kernel-arch extlinuxconf-stm32mp
|
||||
|
||||
|
|
@ -20,8 +20,28 @@ UBOOT_EXTLINUX_BOOTSCR_IMG = "${B}/boot.scr.uimg"
|
|||
UBOOT_EXTLINUX_INSTALL_DIR ?= "/boot"
|
||||
|
||||
do_compile() {
|
||||
# Generate boot script only when multiple extlinux subdirs are set
|
||||
if [ "$(find ${B}/* -maxdepth 0 -type d | wc -w)" -gt 1 ]; then
|
||||
# If there is only one configuration, we try to figure out if we can cleanup
|
||||
# to have a single exlinux.conf file on extlinux folder (to avoid using boot.scr script).
|
||||
if [ "$(find ${B}/* -maxdepth 0 -type d | wc -w)" -eq 1 ] ; then
|
||||
subdir=$(find ${B}/* -maxdepth 0 -type d)
|
||||
bbnote "Only one subdir found for extlinux.conf files: ${subdir}"
|
||||
# If there is the <DEVICETREE>_extlinux.conf file, then rename it to 'extlinux.conf'
|
||||
# and use also default subdir name for u-boot (i.e. 'extlinux')
|
||||
if [ "$(echo ${STM32MP_DEVICETREE} | wc -w)" -eq 1 ] ; then
|
||||
dvtree=$(echo ${STM32MP_DEVICETREE})
|
||||
bbnote "Only one devicetree defined: ${dvtree}"
|
||||
if [ -f ${subdir}/${dvtree}_extlinux.conf ]; then
|
||||
bbnote "Moving ${dvtree}_extlinux.conf to extlinux.conf file"
|
||||
mv -f ${subdir}/${dvtree}_extlinux.conf ${subdir}/extlinux.conf
|
||||
fi
|
||||
if [ "$(basename ${subdir})" != "extlinux" ]; then
|
||||
bbnote "Moving $(basename ${subdir}) to extlinux subdir"
|
||||
mv -f ${subdir} ${B}/extlinux
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
# Generate boot script only when multiple extlinux.conf file are set
|
||||
if [ "$(find ${B}/* -name '*extlinux.conf' | wc -w)" -gt 1 ]; then
|
||||
mkimage -C none -A ${UBOOT_ARCH} -T script -d ${UBOOT_EXTLINUX_BOOTSCR} ${UBOOT_EXTLINUX_BOOTSCR_IMG}
|
||||
fi
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,45 +1,71 @@
|
|||
# Generate boot.scr.uimg:
|
||||
# ./tools/mkimage -C none -A arm -T script -d boot.src.cmd boot.scr.uimg
|
||||
#
|
||||
#########################################################################
|
||||
# SAMPLE BOOT SCRIPT: PLEASE DON'T USE this SCRIPT in REAL PRODUCT
|
||||
#########################################################################
|
||||
# this script is only a OpenSTLinux helper to manage multiple target with the
|
||||
# same bootfs, for real product with only one supported configuration change the
|
||||
# bootcmd in U-boot or use the normal path for extlinux.conf to use DISTRO
|
||||
# boocmd (generic distibution); U-Boot searches with boot_prefixes="/ /boot/":
|
||||
# - /extlinux/extlinux.conf
|
||||
# - /boot/extlinux/extlinux.conf
|
||||
#########################################################################
|
||||
|
||||
echo "Executing SCRIPT on target=${target}"
|
||||
|
||||
# M4 Firmware load
|
||||
env set m4fw_name "rproc-m4-fw.elf"
|
||||
env set m4fw_addr ${kernel_addr_r}
|
||||
env set boot_m4fw 'rproc init; rproc load 0 ${m4fw_addr} ${filesize}; rproc load_rsc 0 ${m4fw_addr} ${filesize}; rproc start 0'
|
||||
env set boot_m4fw 'rproc init; rproc load 0 ${m4fw_addr} ${filesize}; rproc start 0'
|
||||
|
||||
# boot M4 Firmware when available
|
||||
env set scan_m4fw 'if test -e ${devtype} ${devnum}:${distro_bootpart} ${m4fw_name};then echo Found M4 FW $m4fw_name; if load ${devtype} ${devnum}:${distro_bootpart} ${m4fw_addr} ${m4fw_name}; then run boot_m4fw; fi; fi;'
|
||||
|
||||
# Update DISTRO command= search in sub-directory and load M4 firmware
|
||||
env set boot_prefixes "/${boot_device}${boot_instance}_${board_name}_"
|
||||
# Update the DISTRO command to search in sub-directory and load M4 firmware
|
||||
env set boot_prefixes "/${boot_device}${boot_instance}_"
|
||||
env set boot_extlinux "run scan_m4fw;${boot_extlinux}"
|
||||
|
||||
if test ${boot_device} = mmc; then
|
||||
if test ${distro_bootpart} > 4; then
|
||||
env set boot_prefixes "/mmc${boot_instance}_${board_name}-optee_"
|
||||
# save the boot config for the 2nd boot
|
||||
env set boot_targets ${target}
|
||||
|
||||
# when {boot_device} = nor, use ${target} = the location of U-Boot
|
||||
# script boot.scr.img found in DISTRO script
|
||||
# value can be "mmc0" (SD Card), "mmc1" (eMMC) or "ubifs0" (NAND)
|
||||
|
||||
if test ${target} = mmc0; then
|
||||
if test -d ${devtype} ${devnum}:${distro_bootpart} /mmc0_extlinux; then
|
||||
env set boot_prefixes "/mmc0_"
|
||||
fi
|
||||
elif test ${target} = mmc1; then
|
||||
if test -d ${devtype} ${devnum}:${distro_bootpart} /mmc1_extlinux; then
|
||||
env set boot_prefixes "/mmc1_"
|
||||
fi
|
||||
elif test ${target} = ubifs0; then
|
||||
if test -d ${devtype} ${devnum}:${distro_bootpart} /nand0_extlinux; then
|
||||
env set boot_prefixes "/nand0_"
|
||||
fi
|
||||
|
||||
#start the correct exlinux.conf
|
||||
run scan_dev_for_boot_part
|
||||
|
||||
elif test ${boot_device} = nand; then
|
||||
|
||||
#start the correct exlinux.conf without remount UBI
|
||||
run scan_dev_for_boot
|
||||
|
||||
elif test ${boot_device} = nor; then
|
||||
|
||||
#EMMC boot
|
||||
env set boot_prefixes "/${boot_device}${boot_instance}-mmc1_${board_name}_"
|
||||
run bootcmd_mmc1
|
||||
|
||||
#NAND boot
|
||||
env set boot_prefixes "/nand0_${board_name}_"
|
||||
run bootcmd_ubifs0
|
||||
|
||||
#SDCARD boot
|
||||
env set boot_prefixes "/${boot_device}${boot_instance}_${board_name}_"
|
||||
run bootcmd_mmc0
|
||||
fi
|
||||
|
||||
echo SCRIPT FAILED... ${boot_prefixes}extlinux/extlinux.conf not found !
|
||||
if test -e ${devtype} ${devnum}:${distro_bootpart} ${boot_prefixes}extlinux/${board_name}_extlinux.conf; then
|
||||
echo FOUND ${boot_prefixes}extlinux/${board_name}_extlinux.conf
|
||||
env set boot_syslinux_conf "extlinux/${board_name}_extlinux.conf"
|
||||
fi
|
||||
|
||||
# don't save the updated content of bootfile variable to avoid conflict
|
||||
env delete bootfile
|
||||
|
||||
# save the boot config the 2nd boot (boot_prefixes/boot_extlinux)
|
||||
env save
|
||||
|
||||
# start the correct exlinux.conf
|
||||
run bootcmd_${target}
|
||||
|
||||
echo SCRIPT FAILED... ${boot_prefixes}${boot_syslinux_conf} not found !
|
||||
|
||||
# restore environment to default value when failed
|
||||
env default boot_targets
|
||||
env default boot_prefixes
|
||||
env default boot_extlinux
|
||||
env default boot_syslinux_conf
|
||||
env save
|
||||
|
|
|
|||
Loading…
Reference in New Issue