Welcome! Log In Create A New Profile

Advanced

uboot env analysis uboot.2013.10-tld-5.ox820.environment

Posted by youxiaojie 
uboot env analysis uboot.2013.10-tld-5.ox820.environment
March 17, 2017 11:29PM
uboot.2013.10-tld-5.ox820.environment



bootdelay=10

ethaddr=52:3b:20:9c:11:51
ethact=mii0

ipaddr=192.168.0.222
#pogo’s ip
serverip=192.168.0.220
# ip of pc running nc or Hercules SETUP utility
if_netconsole=ping $serverip
start_netconsole=setenv ncip $serverip; setenv bootdelay 10; setenv stdin nc; setenv stdout nc; setenv stderr nc; version;
preboot_nc=run if_netconsole start_netconsole
# wihout judge whether pc running nc or Hercules ready or not, start net-console directly

preboot_nc = setenv nc_ready 0; for pingstat in 1 2 3 4 5; do; sleep 1; if run if_netconsole; then setenv nc_ready 1; fi; done; if test $nc_ready -eq 1; then run start_netconsole; fi
# Wait 5 seconds  countdown, which can be broken.And enter net-console when pc running nc or Hercules ready.
preboot = run preboot_nc
# preboot called by uboot 





dtb_file=/boot/dts/ox820-pogoplug-pro.dtb
load_dtb=echo loading DTB $dtb_file ...; ext2load $bootdev $device 0x62c00000 $dtb_file
load_initrd=echo loading uInitrd ...; ext2load $bootdev $device 0x60e00000 /boot/uInitrd
load_uimage=echo loading uImage ...; ext2load $bootdev $device 0x60500000 /boot/uImage




devices=usb ide
# usb ide mmc different types of boot device by sequence
disks=0 1 2 3
# multi disks connected for each usb ide or mmc, eg. usb0 to usb3 when multi usb disk plugged
bootdev=usb
# boot device usb
device=0:1
# boot disk:partition default disk0 partition1

scan_disk=echo running scan_disk ...; scan_done=0; setenv scan_usb "usb start";  setenv scan_ide "ide reset";  setenv scan_mmc "mmc rescan"; for dev in $devices; do if test $scan_done -eq 0; then echo Scan device $dev; run scan_$dev; for disknum in $disks; do if test $scan_done -eq 0; then echo device $dev $disknum:1; if ext2load $dev $disknum:1 0x60500000 /boot/uImage 1; then scan_done=1; echo Found bootable drive on $dev $disknum; setenv device $disknum:1; setenv bootdev $dev; fi; fi; done; fi; done

#scan each  disks and load uImage from first partition. eg: usb [0-3]:1 ide 0:1 mmc 0:1,set bootdev to (usb)|(ide)|(mmc) device to [0-3]:1


uenv_init_devices=setenv init_usb "usb start";  setenv init_ide "ide reset";  setenv init_mmc "mmc rescan"; for devtype in $devices; do run init_$devtype; done;

# init usb, ide or mmc to read uEnv.txt


uenv_read=echo loading envs from $devtype $disknum ...; if load $devtype $disknum:1 0x60500000 /boot/uEnv.txt; then setenv uenv_loaded 1; fi
#load uEnv.txt from first partition of usb [0-3] ide 0 mmc0

uenv_read_disk=if test $devtype -eq mmc; then if $devtype part; then run uenv_read;  fi; else if $devtype part $disknum; then run uenv_read; fi;  fi
#what is the functionn? whatever the result of if,run  uenv_read both?
uenv_load=run uenv_init_devices; setenv uenv_loaded 0; for devtype in $devices;  do for disknum in 0; do run uenv_read_disk; done; done;
#??for disknum in 0?for sentence is for loop but only 0?

uenv_import=echo importing envs ...; env import -t 0x60500000

bootcmd_uenv=run uenv_load; if test $uenv_loaded -eq 1; then run uenv_import; fi

mtdids=nand0=41000000.nand
mtdparts=mtdparts=41000000.nand:14m(boot),-(data)
set_bootargs=setenv bootargs console=ttyS0,115200 root=LABEL=rootfs rootdelay=10 $mtdparts $custom_params
# cusom_params no defination

bootcmd_exec=run load_uimage; if run load_initrd; then if run load_dtb; then bootm 0x60500000 0x60e00000 0x62c00000; else bootm 0x60500000 0x60e00000; fi; else if run load_dtb; then bootm 0x60500000 - 0x62c00000; else bootm 0x60500000; fi; fi

# according to uimage initrd and dtb,run bootm uimage initrd dtb or bootm uimage initrd or  bootm uimage – dtb or bootm uimage

bootcmd=run bootcmd_uenv; run scan_disk; run set_bootargs; run bootcmd_exec; reset
# load uenv,then boot



usb_custom_params=zswap.enabled=1
# definition  but not use



mainlineLinux=yes
usb_ready_retry=15
# definition  but not use

stderr=serial
stdin=serial
stdout=serial

blue comment is not clear,please help me,
red is another version to enable net-console with judgment, what about this sentence?



Edited 3 time(s). Last edit at 03/18/2017 07:07AM by youxiaojie.
Re: uboot env analysis uboot.2013.10-tld-5.ox820.environment
March 17, 2017 11:57PM
youxiaojie,

Quote

preboot_nc=run if_netconsole start_netconsole
# wihout judge whether pc running nc or Hercules ready or not?

u-boot netconsole is always running. That preboot_nc, which is executed by preboot, is just to check for netconsole server by pinging it, and then route the stdin/stdout/stderr to nc console.

Quote

preboot_nc = setenv nc_ready 0; for pingstat in 1 2 3 4 5; do; sleep 1; if run if_netconsole; then setenv nc_ready 1; fi; done; if test $nc_ready -eq 1; then run start_netconsole; fi
# judge whether pc running nc or Hercules ready or not?
preboot = run preboot_nc
# what is the preboot ?

preboot env is executed automatically by u-boot before you see the countdown. This is where netconsole input/output can be activated (so you can interrupt it at countdown).

Quote

uenv_read_disk=if test $devtype -eq mmc; then if $devtype part; then run uenv_read; fi; else if $devtype part $disknum; then run uenv_read; fi; fi
#what is the functionn? whatever the result of if,run uenv_read both?
uenv_load=run uenv_init_devices; setenv uenv_loaded 0; for devtype in $devices; do for disknum in 0; do run uenv_read_disk; done; done;
#??for disknum in 0?for sentence is for loop but only 0?

Please u-boot instruction for the explanation of uEnv.txt

Quote

# cusom_params no defination

When it's empty, then nothing executed. This is where extra bootargs can be added nicely.

Quote

usb_ready_retry=15
# definition but not use

This user defined timeout period can help u-boot to wait longer when a certain USB drive is slow coming up. Define it at how many seconds you want u-boot to wait for the USB drive to power up.

-bodhi
===========================
Wiki
latest Kirkwood kernel builds and rootfs
latest u-boot-kirkwood builds
latest Oxnas kernel builds and rootfs
latest u-boot-oxnas builds
latest MVEBU Armada kernel builds and rootfs
U-Boot & Kernel Booting process
bodhi's u-boot GitHub
bodhi's corner
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: