U-boot 環境
 

==> printenv
boot_fstypes=ext2
boot_iter=for target in ${boot_targets}; do run init_${target} && run bootcmd_${target}; done
boot_modes=syslinux env script kernel
boot_prefixes=/ /boot/
boot_scripts=boot.scr.uimg boot.scr
boot_targets=scsi pxe
bootargs=console=ttyAMA0 root=LABEL=rootfs nosplash
bootcmd=run bootcmd0
bootcmd0=run boot_iter
bootcmd1=setenv boot_targets pxe; run boot_iter
bootcmd15=run bootcmd_setup; run bootcmd_mmc
bootcmd2=setenv boot_targets scsi; run boot_iter
bootcmd_pxe=dhcp; pxe get; pxe boot
bootcmd_scsi=run scan_disk
bootcount=1
bootdelay=2
bootdelaykey=d
bootretry=90
bootstopkey=s
devnum=0:auto
env_boot=echo Trying environment file...; ${fs}load ${devtype} ${devnum} ${script_addr} ${prefix}uEnv.txt && Executing ${prefix}uEnv.txt... && env import -t  ${script_addr} ${filesize}};
eth1addr=30:0e:d5:c7:58:58
ethact=xgmac0
ethaddr=30:0e:d5:c7:58:57
fdt_addr=0x1000
fdt_high=0xffffffff
init_pxe=setenv bootfile ""
init_scsi=scsi scan; setenv devtype scsi
initrd_high=0xffffffff
kernel_addr_r=0x02000000
kernel_boot=echo Trying kernel...; ${fs}load ${devtype} ${devnum} ${kernel_addr_r} ${prefix}vmlinuz && ${fs}load ${devtype} ${devnum} ${ramdisk_addr_r} ${prefix}initrd.img && bootz ${kernel_addr_r} ${ramdisk_addr_r}:${filesize} ${fdt_addr}
localcmd=run bootcmd2
netretry=once
pxefile_addr_r=0x700000
ramdisk_addr_r=0x04000000
scan_disk=echo Scanning ${devtype} ${devnum}...; for fs in ${boot_fstypes}; do for mode in ${boot_modes}; do for prefix in ${boot_prefixes}; do run ${mode}_boot; done; done; done;
script_addr=0x100000
script_boot=echo Trying script images...; for script in ${boot_scripts}; do ${fs}load ${devtype} ${devnum} ${script_addr} ${prefix}${script} && echo Executing ${prefix}${script}... && source ${script_addr}; done;
scsidevs=1
stderr=serial
stdin=serial
stdout=serial
syslinux_boot=echo Trying syslinux boot menu...; sysboot ${devtype} ${devnum} ${fs} ${script_addr} ${prefix}extlinux/extlinux.conf

Environment size: 2029/8188 bytes

 

選項1: pxe boot
 

==> dhcp
...
==> pxe get
...
==> pxe boot
...

 

LABEL Ubuntu xenial-netinstall
    KERNEL xenial/netinstall/vmlinuz
    initrd xenial/netinstall/generic/initrd.gz
    append console=ttyAMA0 DEBIAN_FRONTEND=text locale=en_US text priority=critical auto url=http://192.168.1.1/pub/ubuntu/trusty/u14-preseed.cfg interface=eth0

 

選項2: run bootcmd_pxe
 

==> run bootcmd_pxe
BOOTP broadcast 1
DHCP client bound to address 192.168.1.61
Using xgmac0 device
TFTP from server 192.168.1.1; our IP address is 192.168.1.61
Filename 'pxelinux.0'.
Load address: 0x800000
Loading: ##
         2.1 MiB/s
done
Bytes transferred = 26720 (6860 hex)
missing environment variable: pxeuuid
Retrieving file: pxelinux.cfg/01-30-0e-d5-c7-58-57
Using xgmac0 device
TFTP from server 192.168.1.1; our IP address is 192.168.1.61
Filename 'pxelinux.cfg/01-30-0e-d5-c7-58-57'.
Load address: 0x700000
Loading: #
         272.5 KiB/s
done
Bytes transferred = 279 (117 hex)
Config file found
Ignoring malformed menu command:  Ubuntu
1:      Ubuntu 15.10
Retrieving file: ubuntu/wily/armhf/generic/initrd.gz
Using xgmac0 device
TFTP from server 192.168.1.1; our IP address is 192.168.1.61
Filename 'ubuntu/wily/armhf/generic/initrd.gz'.
Load address: 0x4000000
Loading: #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         ###########
         2.5 MiB/s
done
Bytes transferred = 16374194 (f9d9b2 hex)
Retrieving file: ubuntu/wily/armhf/generic/vmlinuz
Using xgmac0 device
TFTP from server 192.168.1.1; our IP address is 192.168.1.61
Filename 'ubuntu/wily/armhf/generic/vmlinuz'.
Load address: 0x2000000
Loading: #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         ###########
         2.6 MiB/s
done
Bytes transferred = 6826952 (682bc8 hex)
append: console=ttyAMA0 DEBIAN_FRONTEND=text locale=en_US text priority=critical auto url=http://192.168.1.1/pub/ubuntu/trusty/u14-preseed.cfg
Wrong Image Format for  command
ERROR: can't get kernel image!
Kernel image @ 0x2000000 [ 0x000000 - 0x682bc8 ]
## Flattened Device Tree blob at 00001000
   Booting using the fdt blob at 0x001000
   reserving fdt memory region: addr=0 size=1000
   Using Device Tree in place at 00001000, end 00006581

Starting kernel ...

[    0.000000] Booting Linux on physical CPU 0x0
...

 

選項3: boot from ram
 

==> fdt addr ${fdt_addr} 0x1000

 

==> dhcp
...
==> tftp 0x2000000 ubuntu/wily/armhf/generic/vmlinuz
...
==> tftp 0x04000000 ubuntu/wily/armhf/generic/initrd.gz
...
==> bootz 0x02000000 0x04000000:${filesize} ${fdt_addr}
...

 

選項3: boot from sata
 

=> scsi scan
...
=> ext2load scsi 0:auto 0x02000000 /vmlinuz
...
=> ext2load scsi 0:auto 0x04000000 /initrd.gz
...
=> bootz 0x02000000 0x04000000:${filesize} 0x1000
...

 

選項4: boot from nfs
 

=> dhcp
...
=> setenv bootargs console=ttyAMA0 root=/dev/nfs rw init=/init nfsroot=${serverip}:/tftpboot/nfs/rootfs ip=${ipaddr}:${serverip}:${gateway}:${netmask}::eth0:off nosplash
=> tftp 0x2000000 nfs/vmlinuz
...
=> tftp 0x04000000 nfs/initrd.img
...
=> bootz 0x02000000 0x04000000:${filesize} ${fdt_addr}
...

 

=> setenv bootnfs 'dhcp ; setenv bootargs console=ttyAMA0 root=/dev/nfs rw init=/init nfsroot=${serverip}:/tftpboot/nfs/rootfs ip=${ipaddr}:${serverip}:${gateway}:${netmask}::eth0:off nosplash ; tftp 0x2000000 nfs/vmlinuz ; tftp 0x04000000 nfs/initrd.img ; bootz 0x02000000 0x04000000:${filesize} ${fdt_addr}'
run bootnfs

 

LABEL Ubuntu xenial-netboot
        KERNEL xenial/netboot/vmlinuz
        initrd xenial/netboot/initrd.img
        append console=ttyAMA0 root=/dev/nfs rw init=/init nfsroot=192.168.1.1:/tftpboot/xenial/netboot/rootfs ip=192.168.1.61:192.168.1.1:192.168.1.1:255.255.255.0::eth0:off nosplash

 

選項4: boot Script
 

編輯 netboot.script
 

# vi netboot.script

 

dhcp
setenv bootargs console=ttyAMA0 root=/dev/nfs rw init=/init nfsroot=${serverip}:/tftpboot/xenial/netboot/rootfs ip=${ipaddr}:${serverip}:${gateway}:${netmask}::eth0:off nosplash
tftp 0x2000000 xenial/netboot/vmlinuz
tftp 0x04000000 xenial/netboot/initrd.img
setenv bootnfs bootz 0x02000000 0x04000000:${filesize} ${fdt_addr}
run bootnfs

 

將 "netboot.script" mkimage 為 netboot.scr (boot.scr)
 

# mkimage -C none -A arm -T script -d netboot.script netboot.scr

 

download netboot.scr 至 0x800000
 

==> dhcp
...
==> tftp 0x800000 xenial/netboot/netboot.scr
...

 

執行
 

==> source 0x800000
..

 

 

 

z.png
Email: jasonc@mail2000.com.tw

 

 

 

 

 

arrow
arrow
    創作者介紹
    創作者 Lexra 的頭像
    Lexra

    Lexra Pixnet

    Lexra 發表在 痞客邦 留言(0) 人氣()