Standalone boot (BELK/BXELK)

From DAVE Developer's Wiki
Revision as of 15:45, 1 March 2019 by U0001 (talk | contribs) (History)

Jump to: navigation, search
Info Box
Bora5-small.jpg Applies to Bora
BORA Xpress.png Applies to BORA Xpress

History[edit | edit source]

Version Date Notes
1.0.0 December 2016 Initial release
2.0.0 March 2019 Added use case #2

Introduction[edit | edit source]

This document shows some examples related to configuring Bora/BoraX for standalone operativity.

We'll explain how to program and configure a to boot in standalone mode, without the need of a system microSD card or an NFS server. Only the flash memories available on the SoM itself will be used to store persistently all the software required.


Use case #1[edit | edit source]

This configuration makes use of one of the most common partitioning schemes, that is:

  • The NOR flash acts as boot memory; as such, it contains
    • U-Boot SPL
    • U-Boot
    • U-Boot redundant environment
    • Linux kernel image
    • Linux Device Tree Blob (DTB)
  • The NAND flash contains the UBIFS root filesystem (read/write).


In essence, the bootstrap sequence looks like this:

  • U-Boot fetches and programs the PL bitstream
  • Then it fetches the Linux kernel binary images (kernel and DTB) from the on-board NOR flash memory
  • Once started, the Linux kernel mount the root filesystem from a NAND partition.

This configuration was tested with the following testbed:

  • SOM: DBXF4110D2R
  • carrier board: EVBBX0000C0R
  • software: BXELK 1.0.0

Program the root filesystem in NAND flash[edit | edit source]

This is a common step for both booting options.

  • Boot the system via SD or NFS as described into the System boot and recovery via microSD card and Booting the system via NFS
  • By default, the NAND is already partitioned to allow booting from NAND-only (see next section) and, thus, some partitions are reserved for FSBL, U-boot and kernel images. Here we won't modify this default configuration. The MTD partitions can be dumped with /proc/mtd (the partition's name should be self-explanatory)


root@bora:~# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00080000 00020000 "nand-SPL"
mtd1: 00080000 00020000 "nand-uboot"
mtd2: 00040000 00020000 "nand-uboot-env1"
mtd3: 00040000 00020000 "nand-uboot-env2"
mtd4: 00440000 00020000 "nand-bitstream"
mtd5: 00040000 00020000 "nand-device-tree"
mtd6: 00400000 00020000 "nand-linux"
mtd7: 1f600000 00020000 "nand-rootfs"


200px-Emblem-important.svg.png

Please note that MTD partition index may change depending on flash device availability, flash device size, u-boot environment variables or kernel device driver load order. Always take care of looking inside /proc/mtd to match your specific layout


  • Format and initialize nand-ubi partition, which in our case is mtd7, using UBI with:
ubiformat /dev/mtd7
ubiattach -m 7
ubimkvol /dev/ubi0 -N rootfs -m

E.g.

root@bora:~# ubiformat /dev/mtd7
ubiformat: mtd7 (nand), size 526385152 bytes (502.0 MiB), 4016 eraseblocks of 131072 bytes (128.0 KiB), min. I/O size 2048 bytes
libscan: scanning eraseblock 4015 -- 100 % complete
ubiformat: 4016 eraseblocks have valid erase counter, mean value is 2
ubiformat: formatting eraseblock 4015 -- 100 % complete
root@bora:~# ubiattach -m 7
[   95.732434] UBI: attaching mtd7 to ubi0
[  100.930047] UBI: scanning is finished
[  100.954932] UBI: attached mtd7 (name "nand-rootfs", size 502 MiB) to ubi0
[  100.961772] UBI: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes
[  100.968534] UBI: min./max. I/O unit sizes: 2048/2048, sub-page size 2048
[  100.975248] UBI: VID header offset: 2048 (aligned 2048), data offset: 4096
[  100.982129] UBI: good PEBs: 4016, bad PEBs: 0, corrupted PEBs: 0
[  100.988100] UBI: user volume: 0, internal volumes: 1, max. volumes count: 128
[  100.995271] UBI: max/mean erase counter: 4/3, WL threshold: 4096, image sequence number: 1955579947
[  101.004308] UBI: available PEBs: 3852, total reserved PEBs: 164, PEBs reserved for bad PEB handling: 160
[  101.013959] UBI: background thread "ubi_bgt0d" started, PID 913
UBI device number 0, total 4016 LEBs (509935616 bytes, 486.3 MiB), available 3852 LEBs (489111552 bytes, 466.5 MiB), LEB size 126976 bytes (124.0 KiB)
root@bora:~# ubimkvol /dev/ubi0 -N rootfs -m
Set volume size to 489111552
Volume ID 0, size 3852 LEBs (489111552 bytes, 466.5 MiB), LEB size 126976 bytes (124.0 KiB), dynamic, name "rootfs", alignment 1
  • Now mount the UBI volume using UBIFS in a temporary directory
mkdir -p /mnt/nand
mount -t ubifs ubi0_0 /mnt/nand

E.g.:

root@bora:~# mkdir -p /mnt/nand
root@bora:~# mount -t ubifs ubi0_0 /mnt/nand
[  151.397013] UBIFS: default file-system created
[  151.402858] UBIFS: background thread "ubifs_bgt0_0" started, PID 918
[  151.529438] UBIFS: mounted UBI device 0, volume 0, name "rootfs"
[  151.535395] UBIFS: LEB size: 126976 bytes (124 KiB), min./max. I/O unit sizes: 2048 bytes/2048 bytes
[  151.544507] UBIFS: FS size: 487079936 bytes (464 MiB, 3836 LEBs), journal size 24379392 bytes (23 MiB, 192 LEBs)
[  151.554646] UBIFS: reserved for root: 4952683 bytes (4836 KiB)
[  151.560452] UBIFS: media format: w4/r0 (latest is w4/r0), UUID 447F1480-E173-4BE9-B5BE-A3EC1267F99E, small LPT model
  • you can now extract the root file system into that directory
tar zxvf belk-3.0.1_bora-image-devel-bora.tar.gz -C /mnt/nand
  • finally, you need to cleanly umount and detach the MTD partition
umount /mnt/nand/
ubidetach -m 7

E.g.

root@bora:~# umount /mnt/nand/
[  385.604146] UBIFS: un-mount UBI device 0, volume 0
[  385.608892] UBIFS: background thread "ubifs_bgt0_0" stops
root@bora:~# ubidetach -m 7
[  387.671411] UBI: detaching mtd7 from ubi0
[  387.677554] UBI: mtd7 is detached from ubi0
root@bora:~#

You can now safely reboot or turn off the system.

Program the boot images in NOR flash[edit | edit source]

It is assumed that the following U-Boot's environment variables are defined:

fdt_base=0x00780000
fpga_base=0x00180000
kernel_base=0x00800000
loadk=tftpboot ${loadaddr} ${bootfile}
loadfdt=tftpboot ${fdtaddr} ${fdtfile}
loadfpga=tftpboot ${loadaddr} ${fpgafile}
updatek=sf probe 0 0 0;sf erase ${kernel_base} +${filesize};sf write ${loadaddr} ${kernel_base} ${filesize}
updatefdt=sf probe 0 0 0;sf erase ${fdt_base} +${filesize};sf write ${fdtaddr} ${fdt_base} ${filesize}
updatefpga=sf probe 0 0 0;sf erase ${fpga_base} +${filesize};sf write ${loadaddr} ${fpga_base} ${filesize}
spi_loadk=sf read ${loadaddr} ${kernel_base} 0x800000
spi_loadfdt=sf read ${fdtaddr} ${fdt_base} 0x80000
spi_loadfpga=sf read ${loadaddr} ${fpga_base} 0x600000
program_fpga=run spi_loadfpga;fpga load 0 ${loadaddr} 0x5b3f0c
  • Update the bootfile, fdtfile and fpgafile environment variables to fit the filename as found inside the TFTP server.
  • Program kernel and device tree on NOR flash with the following U-Boot command
zynq-uboot> sf probe; run loadfpga updatefpga loadk updatek loadfdt updatefdt

E.g.:

zynq-uboot> sf probe; run loadfpga updatefpga loadk updatek loadfdt updatefdt
SF: Detected S25FL128S_64K with page size 256 Bytes, erase size 64 KiB, total 16 MiB
Using Gem.e000b000 device
TFTP from server 192.168.0.23; our IP address is 192.168.0.209
Filename 'bora/borax-BELK-3.0.0-fpga.bin'.
Load address: 0x2080000
Loading: T #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         ###############################################################
         823.2 KiB/s
done
Bytes transferred = 5979916 (5b3f0c hex)
SF: Detected S25FL128S_64K with page size 256 Bytes, erase size 64 KiB, total 16 MiB
SF: 6029312 bytes @ 0x180000 Erased: OK
SF: 5979916 bytes @ 0x180000 Written: OK
Using Gem.e000b000 device
TFTP from server 192.168.0.23; our IP address is 192.168.0.209
Filename 'bora/linux/belk-3.0.0_uImage'.
Load address: 0x2080000
Loading: T #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         ##############################
         545.9 KiB/s
done
Bytes transferred = 3477184 (350ec0 hex)
SF: Detected S25FL128S_64K with page size 256 Bytes, erase size 64 KiB, total 16 MiB
SF: 3538944 bytes @ 0x800000 Erased: OK
SF: 3477184 bytes @ 0x800000 Written: OK
Using Gem.e000b000 device
TFTP from server 192.168.0.23; our IP address is 192.168.0.209
Filename 'bora/linux/belk-3.0.0_bora.dtb'.
Load address: 0x2000000
Loading: T ##
         2 KiB/s
done
Bytes transferred = 10019 (2723 hex)
SF: Detected S25FL128S_64K with page size 256 Bytes, erase size 64 KiB, total 16 MiB
SF: 65536 bytes @ 0x780000 Erased: OK
SF: 10019 bytes @ 0x780000 Written: OK


In U-Boot environment please set the following variables in order to be able to boot from NOR + NAND

nandargs=setenv bootargs ubi.mtd=7 root=ubi0_0 rootfstype=ubifs rw
spi_nand=sf probe; run program_fpga spi_loadk spi_loadfdt nandargs addcons addmisc; bootm ${loadaddr} - ${fdtaddr}


Reboot the system and configure U-Boot to apply the new configuration

=> setenv bootcmd run spi_nand
=> saveenv

Use case #2[edit | edit source]

llandre@linuxserver2:/tftpboot/borax/elt$ python /devel/dave/bora-DBRx/fpga/fpga-bit-to-bin.py -f bitstream.bit bitstream.bin
Design name: TOP_LEVEL;UserID=0XFFFFFFFF;Version=2017.4
Partname 7z030sbg485
Date 2019/02/01
Time 16:38:59
found binary data: 5979916


Bora> nand info

Device 0: nand0, sector size 128 KiB
  Page size       2048 b
  OOB size          64 b
  Erase size    131072 b
  subpagesize      512 b
  options     0x       0
  bbt options 0x   20000
Bora> nand erase 0 3000000

NAND erase: device 0 offset 0x0, size 0x3000000
Erasing at 0x2fe0000 -- 100% complete.
OK
Bora> nand write ${loadaddr} 0 <INTERRUPT>
Bora> print ${filesize}
## Error: "8fc790" not defined
Bora> print
DBXx_test_result=test_passed
addcons=setenv bootargs ${bootargs} console=${console},115200n8 debug earlyprintk
addip=setenv bootargs ${bootargs} ip=${ipaddr}:${serverip}:${gateway}:${netmask}:${hostname}:${ethdev}
addmisc=setenv bootargs ${bootargs} cma=16M ${mtdparts}
baudrate=115200
bootaddr=0x101100
bootcmd=run net_nfs
bootdelay=3
bootfile=bora/linux/belk-4.0.0_uImage
bootscript=echo Running bootscript from ${recoverydev} ...; source ${loadaddr}
cb_configid#=ffffffff
cb_uniqueid#=00000000:00000000
configid_fixupfdt=if configid checkfdt ${fdtaddr} som_configid ${som_configid#}; then configid fdt_uniqueid ${fdtaddr}; fi
console=ttyPS0
ethact=ethernet@e000b000
ethaddr=00:50:C2:1E:AF:B3
ethdev=eth0
fdt_base=0x00780000
fdt_high=0x1F000000
fdtaddr=2000000
fdtcontroladdr=3ffa0a90
fdtfile=bora/linux/belk-4.0.0_bora.dtb
fileaddr=2080000
filesize=8fc790
fpga_base=0x00180000
fpgafile=bora/bora.bin
fsbl_base=0x40000
gateway=192.168.0.254
header_base=0
hostname=bora
ipaddr=192.168.0.81
jtag_vx=run vxargs; bootvx 0x200000
kernel_base=0x00800000
load=tftpboot ${loadaddr} bora/u-boot.bin
loadaddr=0x02080000
loadbootscript=fatload ${recoverydev} 0:1 ${loadaddr} ${script};
loadfdt=tftpboot ${fdtaddr} ${fdtfile}
loadfpga=tftpboot ${loadaddr} ${fpgafile}
loadfsbl=tftpboot ${loadaddr} bora/bora_fsbl.bin
loadhdr=tftpboot ${loadaddr} bora/boot_header
loadk=tftpboot ${loadaddr} ${bootfile}
loadvx=tftpboot ${loadaddr} ${vxfile}
mmcargs=setenv bootargs root=/dev/mmcblk0p${mmcpart} rootwait rw
mmcdev=0
mmcpart=2
mmcrecovery=mmc dev 0; mmc rescan; setenv recoverydev mmc; run recovery
modeboot=qspiboot
mtdids=nand0=pl353-nand
mtdparts=mtdparts=pl35x-nand:48M(data0),15M(data1),1M(data2),-(data3)
mtdparts1=mtdparts=pl353-nand:512K(spl),512K(uboot),256K(env1),256K(env2),4M(fpga),256K(fdt),4M(kernel),-(nand-ubi)
nand_erasesize=20000
nand_loadk=nand read ${loadaddr} kernel
nand_oobsize=40
nand_updatek=nand erase.part kernel; nand write ${loadaddr} nand-kernel ${filesize}
nand_writesize=800
nandargs=setenv bootargs ubi.mtd=7 root=ubi0_0 rootfstype=ubifs rw
net_nfs=ping ${serverip};run loadk loadfdt nfsargs addip addcons addmisc; run configid_fixupfdt; bootm ${loadaddr} - ${fdtaddr}
net_vx=run loadvx vxargs; bootvx ${loadaddr}
netmask=255.255.255.0
nfsargs=setenv bootargs root=/dev/nfs rw nfsroot=${serverip}:${rootpath},tcp
normalboot=net_nfs
program_fpga=run loadfpga;fpga load 0 ${loadaddr} 0x${filesize}
qspiboot=echo Booting from QSPI: use net_nfs && run net_nfs
ramdisk_size=0x200000
recovery=if run loadbootscript; then run bootscript; fi
rootpath=/opt/nfsroot/bora/belk-4.0.0
script=boot.scr
serial#_DBXx=00C5
serverip=192.168.0.13
som_configid#=00000005
som_uniqueid#=3a11013a:40b52447
stderr=serial@e0001000
stdin=serial@e0001000
stdout=serial@e0001000
u-boot_base=0x80000
update=sf probe 0 0 0;sf erase ${u-boot_base} +${filesize};sf write ${loadaddr} ${u-boot_base} ${filesize}
updatefdt=sf probe 0 0 0;sf erase ${fdt_base} +${filesize};sf write ${fdtaddr} ${fdt_base} ${filesize}
updatefpga=sf probe 0 0 0;sf erase ${fpga_base} +${filesize};sf write ${loadaddr} ${fpga_base} ${filesize}
updatefsbl=sf probe 0 0 0;sf erase ${fsbl_base} +${filesize};sf write ${loadaddr} ${fsbl_base} ${filesize}
updatehdr=sf probe 0 0 0;sf erase ${header_base} +${filesize};sf write ${loadaddr} ${header_base} ${filesize}
updatek=sf probe 0 0 0;sf erase ${kernel_base} +${filesize};sf write ${loadaddr} ${kernel_base} ${filesize}
usbrecovery=usb start; usb dev 0; setenv recoverydev usb; run recovery
vxargs=setenv bootargs gem(0,0)host:vxWorks.st h=${serverip} e=${ipaddr} g=${gatewayip} tn=${hostname} u=target pw=vxTarget f=0x0
vxfile=bora/vxWorks

Environment size: 3823/262139 bytes
Bora> nand write ${loadaddr} 0 ${filesize}

NAND write: device 0 offset 0x0, size 0x8fc790
 9422736 bytes written: OK
Bora> tftpboot ${loadaddr} borax/elt/bitstream.bit
Using ethernet@e000b000 device
TFTP from server 192.168.0.13; our IP address is 192.168.0.81
Filename 'borax/elt/bitstream.bit'.
Load address: 0x2080000
Loading: #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         ###############################################################
         2.6 MiB/s
done
Bytes transferred = 5980021 (5b3f75 hex)
Bora> nand erase 3000000 f00000

NAND erase: device 0 offset 0x3000000, size 0xf00000
Erasing at 0x3ee0000 -- 100% complete.
OK
Bora> nand write ${loadaddr} 3000000 ${filesize}

NAND write: device 0 offset 0x3000000, size 0x5b3f75
 5980021 bytes written: OK
Bora> nand erase 3f00000 100000

NAND erase: device 0 offset 0x3f00000, size 0x100000
Erasing at 0x3fe0000 -- 100% complete.
OK
Bora> tftpboot ${loadaddr} borax/elt/bora.dtb
Using ethernet@e000b000 device
TFTP from server 192.168.0.13; our IP address is 192.168.0.81
Filename 'borax/elt/bora.dtb'.
Load address: 0x2080000
Loading: ###
         746.1 KiB/s
done
Bytes transferred = 15280 (3bb0 hex)
Bora> nand write ${loadaddr} 3f00000 ${filesize}

NAND write: device 0 offset 0x3f00000, size 0x3bb0
 15280 bytes written: OK
Bora>



root@bora:~# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 03000000 00020000 "data0"
mtd1: 00f00000 00020000 "data1"
mtd2: 00100000 00020000 "data2"
mtd3: 3c000000 00020000 "data3"
root@bora:~# ubiformat /dev/mtd3
ubiformat: mtd3 (nand), size 1006632960 bytes (960.0 MiB), 7680 eraseblocks of 131072 bytes (128.0 KiB), min. I/O size 2048 bytes
libscan: scanning eraseblock 7679 -- 100 % complete
ubiformat: 7676 eraseblocks are supposedly empty
ubiformat: 4 bad eraseblocks found, numbers: 7676, 7677, 7678, 7679
ubiformat: formatting eraseblock 7679 -- 100 % complete
root@bora:~# ubiattach -m 3
[ 1149.075187] ubi0: attaching mtd3
[ 1154.062660] ubi0: scanning is finished
[ 1154.093813] ubi0: attached mtd3 (name "data3", size 960 MiB)
[ 1154.099516] ubi0: PEB size: 131072 bytes (128 KiB), LEB size: 129024 bytes
[ 1154.106479] ubi0: min./max. I/O unit sizes: 2048/2048, sub-page size 512
[ 1154.113172] ubi0: VID header offset: 512 (aligned 512), data offset: 2048
[ 1154.120026] ubi0: good PEBs: 7676, bad PEBs: 4, corrupted PEBs: 0
[ 1154.126302] ubi0: user volume: 0, internal volumes: 1, max. volumes count: 128
[ 1154.133591] ubi0: max/mean erase counter: 0/0, WL threshold: 4096, image sequence number: 248135964
[ 1154.142667] ubi0: available PEBs: 7516, total reserved PEBs: 160, PEBs reserved for bad PEB handling: 156
[ 1154.152304] ubi0: background thread "ubi_bgt0d" started, PID 870
UBI device number 0, total 7676 LEBs (990388224 bytes, 944.5 MiB), available 7516 LEBs (969744384 bytes, 924.8 MiB), LEB size 129024 bytes (126.0 KiB)
root@bora:~# ubimkvol /dev/ubi0 -N data3 -m
Set volume size to 969744384
Volume ID 0, size 7516 LEBs (969744384 bytes, 924.8 MiB), LEB size 129024 bytes (126.0 KiB), dynamic, name "data3", alignment 1
root@bora:~# ls -la /mnt/
total 16
drwxr-xr-x    4 root     root          4096 Mar 19  2018 .
drwxrwxr-x   16 541      502           4096 Jul  9 21:11 ..
drwxr-xr-x    2 root     root          4096 Mar 19  2018 tftpvideo
drwxr-xr-x    2 root     root          4096 Mar 19  2018 ubifs
root@bora:~# mkdir -p /mnt/data3
root@bora:~# mount -t ubifs ubi0_0 /mnt/data3
[ 1238.777228] UBIFS (ubi0:0): default file-system created
[ 1238.783887] UBIFS (ubi0:0): background thread "ubifs_bgt0_0" started, PID 878
[ 1238.913347] UBIFS (ubi0:0): UBIFS: mounted UBI device 0, volume 0, name "data3"
[ 1238.920577] UBIFS (ubi0:0): LEB size: 129024 bytes (126 KiB), min./max. I/O unit sizes: 2048 bytes/2048 bytes
[ 1238.930509] UBIFS (ubi0:0): FS size: 967421952 bytes (922 MiB, 7498 LEBs), journal size 33546240 bytes (31 MiB, 260 LEBs)
[ 1238.941440] UBIFS (ubi0:0): reserved for root: 4952683 bytes (4836 KiB)
[ 1238.948006] UBIFS (ubi0:0): media format: w4/r0 (latest is w4/r0), UUID B4CA7F10-B2AE-4C89-B2E1-59B38879E564, small LPT model
root@bora:~# mount
192.168.0.13:/opt/nfsroot/bora/belk-4.0.0 on / type nfs (rw,relatime,vers=2,rsize=4096,wsize=4096,namlen=255,hard,nolock,proto=tcp,timeo=600,retrans=2,sec=sys,mountaddr=192.168.0.13,mountvers=1,mountproto=tcp,local_lock=all,addr=192.168.0.13)
devtmpfs on /dev type devtmpfs (rw,relatime,size=506608k,nr_inodes=126652,mode=755)
proc on /proc type proc (rw,relatime)
sysfs on /sys type sysfs (rw,relatime)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
tmpfs on /run type tmpfs (rw,nosuid,nodev,mode=755)
tmpfs on /var/volatile type tmpfs (rw,relatime)
devpts on /dev/pts type devpts (rw,relatime,gid=5,mode=620,ptmxmode=000)
ubi0_0 on /mnt/data3 type ubifs (rw,relatime)
root@bora:~# df
Filesystem           1K-blocks      Used Available Use% Mounted on
192.168.0.13:/opt/nfsroot/bora/belk-4.0.0
                     103080204  95026920   2810460  97% /
devtmpfs                506608         0    506608   0% /dev
tmpfs                   515312        48    515264   0% /run
tmpfs                   515312        48    515264   0% /var/volatile
ubi0_0                  887868        16    883016   0% /mnt/data3
root@bora:~#


Bora> setenv nandboot2 'run loadunand loadfdtnand nandargs2 addip addcons addmisc; run configid_fixupfdt; bootm ${loadaddr} - ${fdtaddr}'
Bora> savee
Saving Environment to SPI Flash...
SF: Detected s25fl128s_64k with page size 256 Bytes, erase size 64 KiB, total 32 MiB
Erasing SPI flash...Writing to SPI flash...done
Valid environment: 1
Bora> edit loadunand
edit: Bora> nand help
nand - NAND sub-system

Usage:
nand info - show available NAND devices
nand device [dev] - show or set current device
nand read - addr off|partition size
nand write - addr off|partition size
    read/write 'size' bytes starting at offset 'off'
    to/from memory address 'addr', skipping bad blocks.
nand read.raw - addr off|partition [count]
nand write.raw[.noverify] - addr off|partition [count]
    Use read.raw/write.raw to avoid ECC and access the flash as-is.
nand erase[.spread] [clean] off size - erase 'size' bytes from offset 'off'
    With '.spread', erase enough for given file size, otherwise,
    'size' includes skipped bad blocks.
nand erase.part [clean] partition - erase entire mtd partition'
nand erase.chip [clean] - erase entire chip'
nand bad - show bad blocks
nand dump[.oob] off - dump page
nand scrub [-y] off size | scrub.part partition | scrub.chip
    really clean NAND erasing bad blocks (UNSAFE)
nand markbad off [...] - mark bad block(s) at offset (UNSAFE)
nand biterr off - make a bit error at offset (UNSAFE)
nand lock [tight] [status]
    bring nand to lock state or display locked pages
nand unlock[.allexcept] [offset] [size] - unlock section
Bora> edit loadunand
edit: nand read ${loadaddr} 0 3000000
Bora> edit loadfdtnand
edit: nand read ${fdtaddr} 3000000 f00000
Bora> edit loadfdtnand
edit: nand read ${fdtaddr} 3f00000 100000
Bora> savee
Saving Environment to SPI Flash...
Erasing SPI flash...Writing to SPI flash...done
Valid environment: 2
Bora> edit nandargs2
edit: setenv bootargs ''