diff options
Diffstat (limited to 'recipes-bsp/u-boot')
-rw-r--r-- | recipes-bsp/u-boot/u-boot-distro-boot/boot.cmd.in | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/recipes-bsp/u-boot/u-boot-distro-boot/boot.cmd.in b/recipes-bsp/u-boot/u-boot-distro-boot/boot.cmd.in index 21d298c..fa9b378 100644 --- a/recipes-bsp/u-boot/u-boot-distro-boot/boot.cmd.in +++ b/recipes-bsp/u-boot/u-boot-distro-boot/boot.cmd.in @@ -9,7 +9,7 @@ # - boot device type: boot_devtype := {mmc, usb, tftp, dhcp} # - boot device num (for mmc, usb types): boot_devnum := {0 .. MAX_DEV_NUM} # - boot partition (for mmc, usb types): boot_part := {1 .. MAX_PART_NUM} -# - root device type: root_devtype := {mmc, usb} +# - root device type: root_devtype := {mmc, usb, nfs-dhcp, nfs-static} # - root device num (for mmc, usb types): root_devnum := {0 .. MAX_DEV_NUM} # - root partition (for mmc, usb types): root_part := {1 .. MAX_PART_NUM} # @@ -23,9 +23,7 @@ # - Static/dynamic IP mode: ip_dyn := {yes, no} # - Static IP-address of TFTP/NFS server: serverip := {legal IPv4 address} # - Static IP-address of the module: ipaddr := {legal IPv4 address} -# -# TODO: -# - support NFS in root_devtype +# - Root-path on NFS-server: rootpath := {legal path, exported by an NFS-server} if test ${devtype} = "ubi"; then echo "This script is not meant to distro boot from raw NAND flash." @@ -40,7 +38,6 @@ test -n ${boot_devnum} || env set boot_devnum ${devnum} test -n ${root_devnum} || env set root_devnum ${devnum} test -n ${kernel_image} || env set kernel_image @@KERNEL_IMAGETYPE@@ test -n ${boot_devtype} || env set boot_devtype ${devtype} -test -n ${root_devtype} || env set root_devtype ${devtype} test -n ${overlays_file} || env set overlays_file "overlays.txt" test ${boot_devtype} = "mmc" && env set load_cmd 'load ${boot_devtype} ${boot_devnum}:${boot_part}' @@ -48,6 +45,21 @@ test ${boot_devtype} = "usb" && env set load_cmd 'load ${boot_devtype} ${boot_de test ${boot_devtype} = "tftp" && env set load_cmd 'tftp' test ${boot_devtype} = "dhcp" && env set load_cmd 'dhcp' +# Set Root source type properly. +# devtype tftp => nfs-static +# devtype ghcp => nfs-dhcp +if test "${root_devtype}" = ""; then + if test ${devtype} = "tftp"; then + env set root_devtype "nfs-static" + else + if test ${devtype} = "dhcp"; then + env set root_devtype "nfs-dhcp" + else + env set root_devtype ${devtype} + fi + fi +fi + if test -n ${setup}; then run setup else @@ -70,11 +82,15 @@ env set set_load_overlays_file 'env set load_overlays_file "${load_cmd} \\${load env set set_apply_overlays 'env set apply_overlays "for overlay_file in \\${fdt_overlays}; do echo Applying Overlay: \\${overlay_file} && ${load_cmd} \\${loadaddr} \\${overlay_file} && fdt apply \\${loadaddr}; env set overlay_file; done; true"' # Set static commands -if test ${root_devtype} = "dhcp"; then +if test ${root_devtype} = "nfs-dhcp"; then env set rootfsargs_set 'env set rootfsargs "root=/dev/nfs ip=dhcp nfsroot=${rootpath}"' else - env set uuid_set 'part uuid ${root_devtype} ${root_devnum}:${root_part} uuid' - env set rootfsargs_set 'run uuid_set && env set rootfsargs root=PARTUUID=${uuid} ro rootwait' + if test ${root_devtype} = "nfs-static"; then + env set rootfsargs_set 'env set rootfsargs "root=/dev/nfs nfsroot=${serverip}:${rootpath}"' + else + env set uuid_set 'part uuid ${root_devtype} ${root_devnum}:${root_part} uuid' + env set rootfsargs_set 'run uuid_set && env set rootfsargs root=PARTUUID=${uuid} ro rootwait' + fi fi env set bootcmd_args 'run rootfsargs_set && env set bootargs ${defargs} ${rootfsargs} ${setupargs} ${vidargs} ${tdxargs}' |