On Tue, 4 Aug 2015 01:26:45 +0200 Bernhard Nortmann <[email protected]> wrote:
Hi, thanks for the patch. However currently the usb-boot script is primarily intended to work with the the legacy https://github.com/linux-sunxi/u-boot-sunxi and this is documented at http://linux-sunxi.org/FEL/USBBoot (albeit not in a very obvious way). If we change the script to use the "fel uboot" command, then the legacy u-boot-sunxi will stop working properly. It would be nice to switch to the mainline u-boot and drop support of the legacy u-boot-sunxi bootloader eventually, but not all the boards are supported by the mainline u-boot yet. It may be a better idea to just remove this script altogether. And update the wiki to suggest using an old sunxi-tools tag with the legacy u-boot-sunxi bootloader. And also update the README file. So that the page at https://github.com/linux-sunxi/sunxi-tools does not mention 'usb-boot', but refers to http://linux-sunxi.org/FEL/USBBoot from the 'fel' section. Now the command line interface of the 'fel' tool got much easier to use with the addition of the "uboot" command. I'm not even sure if we still want to use the wrapper script with the mainline U-Boot. > Signed-off-by: Bernhard Nortmann <[email protected]> > --- > usb-boot | 116 > +++++++++++++++++++++++++++++++++------------------------------ > 1 file changed, 61 insertions(+), 55 deletions(-) > > diff --git a/usb-boot b/usb-boot > index 3881d29..be34004 100755 > --- a/usb-boot > +++ b/usb-boot > @@ -20,72 +20,78 @@ > # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN > # THE SOFTWARE. > > -top=`dirname $0` > -if [ $# -lt 2 ]; then > - echo "Usage: $0 u-boot-spl.bin u-boot.bin [boot.scr] [kernel script.bin > [initramfs]]" > +# default (write) addresses, normally should match your U-Boot version > +kernel_addr_r=0x42000000 # kernel > +fdt_addr_r=0x43000000 # .dtb or script.bin > +scriptaddr=0x43100000 # boot script (.scr) > +ramdisk_addr_r=0x43300000 # initramfs > + > +usage() { > + echo > + echo "Usage:" > + echo "$0 <spl> [<boot.scr> [<kernel> <devicefile> [<initramfs>]]]" > + echo > + echo "<spl> is typically u-boot-sunxi-with-spl.bin," > + echo "<devicefile> is script.bin (for older 3.4.x kernel)," > + echo "or a .dtb file for newer (mainline) kernel using device tree" > + echo > exit 1 > -fi > -board=$1; shift || (echo "ERROR: u-boot-spl.bin must be specified"; exit 1;) > -uboot=$1; shift || (echo "ERROR: u-boot.bin must be specified"; exit 1;) > -bootscr=$top/felboot/ramboot.scr > -if [ ! -f $bootscr ]; then > - bootscr=$top/bin/ramboot.scr > -fi > -case "$1" in > -*.scr) bootscr="$1"; shift > - ;; > -esac > -if [ $# -ge 1 ]; then > - kernel=$1; shift || true > -fi > -if [ $# -ge 1 ]; then > - scriptbin=$1; shift || true > -fi > -if [ $# -ge 1 ]; then > - initramfs=$1; shift || true > -fi > +} > + > +top=`dirname $0` > fel() { > + # echo fel command (args) to console, then execute it > echo fel "$@" > $top/fel $@ > } > -case $board in > -*/*) felboot=$board > - ;; > -*) > - felboot=$top/felboot/fel-boot-${board}.bin > - if [ ! -f $felboot ]; then > - felboot=$top/bin/fel-boot-${board}.bin > +felfile() { > + # (optionally) expand a filename ($2) with default directory, > + # and ensure a corresponding file exists > + # returns (possibly modified) filename as environment var specified by > $1 > + fname=$2 > + case ${fname} in > + */*) ;; # use any filename with slashes 'as-is' > + *) fname="${top}/felboot/$2" # prefix with standard dir > + if [ ! -f ${fname} ]; then > + fname="${top}/bin/$2" # try "bin" dir instead > + fi > + ;; > + esac > + if [ ! -f ${fname} ]; then > + echo "ERROR: ($1) file ${fname} not found" > + exit 1 > fi > - ;; > -esac > -if [ ! -f $felboot ]; then > - echo "ERROR: Can't find SPL FEL binary ${board}" > - exit 1 > + export $1="${fname}" > +} > + > +if [ $# -lt 1 ]; then usage; fi > + > +felfile "spl" $1; shift || (echo "ERROR: <spl> must be specified"; usage;) > + > +if [ $# -ge 1 ]; then > + felfile "bootscr" $1; shift > fi > -if [ `wc -c $felboot | cut '-d ' -f1` -gt 15616 ]; then > - echo "ERROR: SPL FEL binary too large. Must be the FEL version of SPL" > - exit 1 > +if [ $# -ge 1 ]; then > + felfile "kernel" $1; shift > fi > -if [ ! -f $bootscr ]; then > - echo "ERROR: Can't find boot script '${bootscr}'" > - exit 1 > +if [ $# -ge 1 ]; then > + felfile "scriptbin" $1; shift > fi > -fel write 0x2000 $felboot > -fel exe 0x2000 > -sleep 1 # Wait for DRAM initialization to complete > -if [ -n "$uboot" ]; then > - fel write 0x4a000000 $uboot > +if [ $# -ge 1 ]; then > + felfile "initramfs" $1; shift > fi > + > +FEL_ARGS="uboot $spl" # use "-v uboot $spl" for more verbose output > if [ -n "$bootscr" ]; then > - fel write 0x41000000 $bootscr > + FEL_ARGS+=" write $scriptaddr $bootscr" > fi > if [ -n "$kernel" ]; then > - if [ -n "$scriptbin" ]; then > - fel write 0x43000000 $scriptbin > - fi > - fel write 0x44000000 $kernel > - if [ -n "$initramfs" ]; then > - fel write 0x4c000000 $initramfs > - fi > + if [ -n "$scriptbin" ]; then > + FEL_ARGS+=" write $fdt_addr_r $scriptbin" > + fi > + FEL_ARGS+=" write $kernel_addr_r $kernel" > + if [ -n "$initramfs" ]; then > + FEL_ARGS+=" write $ramdisk_addr_r $initramfs" > + fi > fi > -fel exe 0x4a000000 > +fel ${FEL_ARGS} # execute actual fel command -- Best regards, Siarhei Siamashka -- You received this message because you are subscribed to the Google Groups "linux-sunxi" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
