5. Burn this u-boot image to spi rom by spi driver
6. Re-boot u-boot from spi flash with power off and power on.
-Messages
-====================
+Messages of U-Boot boot on AE250 board
+======================================
U-Boot 2018.01-rc2-00033-g824f89a (Dec 21 2017 - 16:51:26 +0800)
DRAM: 1 GiB
eth0: mac@e0100000
RISC-V #
-TODO
-====================
-Boot bbl and riscv-linux
+Boot bbl and riscv-linux via U-Boot on QEMU
+===========================================
+1. Build riscv-linux
+2. Build bbl and riscv-linux with --with-payload
+3. Prepare ae250.dtb
+4. Creating OS-kernel images
+ ./mkimage -A riscv -O linux -T kernel -C none -a 0x0000 -e 0x0000 -d bbl.bin bootmImage-bbl.bin
+ Image Name:
+ Created: Tue Mar 13 10:06:42 2018
+ Image Type: RISC-V Linux Kernel Image (uncompressed)
+ Data Size: 17901204 Bytes = 17481.64 KiB = 17.07 MiB
+ Load Address: 00000000
+ Entry Point: 00000000
+
+4. Copy bootmImage-bbl.bin and ae250.dtb to qemu sd card image
+5. Message of booting riscv-linux from bbl via u-boot on qemu
+
+U-Boot 2018.03-rc4-00031-g2631273 (Mar 13 2018 - 15:02:55 +0800)
+
+DRAM: 1 GiB
+main-loop: WARNING: I/O thread spun for 1000 iterations
+MMC: mmc@f0e00000: 0
+Loading Environment from SPI Flash... *** Warning - spi_flash_probe_bus_cs() failed, using default environment
+
+Failed (-22)
+In: serial@f0300000
+Out: serial@f0300000
+Err: serial@f0300000
+Net:
+Warning: mac@e0100000 (eth0) using random MAC address - 02:00:00:00:00:00
+eth0: mac@e0100000
+RISC-V # mmc rescan
+RISC-V # mmc part
+
+Partition Map for MMC device 0 -- Partition Type: DOS
+
+Part Start Sector Num Sectors UUID Type
+RISC-V # fatls mmc 0:0
+ 17901268 bootmImage-bbl.bin
+ 1954 ae2xx.dtb
+
+2 file(s), 0 dir(s)
+
+RISC-V # fatload mmc 0:0 0x00600000 bootmImage-bbl.bin
+17901268 bytes read in 4642 ms (3.7 MiB/s)
+RISC-V # fatload mmc 0:0 0x2000000 ae250.dtb
+1954 bytes read in 1 ms (1.9 MiB/s)
+RISC-V # setenv bootm_size 0x2000000
+RISC-V # setenv fdt_high 0x1f00000
+RISC-V # bootm 0x00600000 - 0x2000000
+## Booting kernel from Legacy Image at 00600000 ...
+ Image Name:
+ Image Type: RISC-V Linux Kernel Image (uncompressed)
+ Data Size: 17901204 Bytes = 17.1 MiB
+ Load Address: 00000000
+ Entry Point: 00000000
+ Verifying Checksum ... OK
+## Flattened Device Tree blob at 02000000
+ Booting using the fdt blob at 0x2000000
+ Loading Kernel Image ... OK
+ Loading Device Tree to 0000000001efc000, end 0000000001eff7a1 ... OK
+[ 0.000000] OF: fdt: Ignoring memory range 0x0 - 0x200000
+[ 0.000000] Linux version 4.14.0-00046-gf3e439f-dirty (rick@atcsqa06) (gcc version 7.1.1 20170509 (GCC)) #1 Tue Jan 9 16:34:25 CST 2018
+[ 0.000000] bootconsole [early0] enabled
+[ 0.000000] Initial ramdisk at: 0xffffffe000016a98 (12267008 bytes)
+[ 0.000000] Zone ranges:
+[ 0.000000] DMA [mem 0x0000000000200000-0x000000007fffffff]
+[ 0.000000] Normal empty
+[ 0.000000] Movable zone start for each node
+[ 0.000000] Early memory node ranges
+[ 0.000000] node 0: [mem 0x0000000000200000-0x000000007fffffff]
+[ 0.000000] Initmem setup node 0 [mem 0x0000000000200000-0x000000007fffffff]
+[ 0.000000] elf_hwcap is 0x112d
+[ 0.000000] random: fast init done
+[ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 516615
+[ 0.000000] Kernel command line: console=ttyS0,38400n8 earlyprintk=uart8250-32bit,0xf0300000 debug loglevel=7
+[ 0.000000] PID hash table entries: 4096 (order: 3, 32768 bytes)
+[ 0.000000] Dentry cache hash table entries: 262144 (order: 9, 2097152 bytes)
+[ 0.000000] Inode-cache hash table entries: 131072 (order: 8, 1048576 bytes)
+[ 0.000000] Sorting __ex_table...
+[ 0.000000] Memory: 2047832K/2095104K available (1856K kernel code, 204K rwdata, 532K rodata, 12076K init, 756K bss, 47272K reserved, 0K cma-reserved)
+[ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
+[ 0.000000] NR_IRQS: 0, nr_irqs: 0, preallocated irqs: 0
+[ 0.000000] riscv,cpu_intc,0: 64 local interrupts mapped
+[ 0.000000] riscv,plic0,e4000000: mapped 31 interrupts to 1/2 handlers
+[ 0.000000] clocksource: riscv_clocksource: mask: 0xffffffffffffffff max_cycles: 0x24e6a1710, max_idle_ns: 440795202120 ns
+[ 0.000000] Calibrating delay loop (skipped), value calculated using timer frequency.. 20.00 BogoMIPS (lpj=40000)
+[ 0.000000] pid_max: default: 32768 minimum: 301
+[ 0.004000] Mount-cache hash table entries: 4096 (order: 3, 32768 bytes)
+[ 0.004000] Mountpoint-cache hash table entries: 4096 (order: 3, 32768 bytes)
+[ 0.056000] devtmpfs: initialized
+[ 0.060000] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns
+[ 0.064000] futex hash table entries: 256 (order: 0, 6144 bytes)
+[ 0.068000] NET: Registered protocol family 16
+[ 0.080000] vgaarb: loaded
+[ 0.084000] clocksource: Switched to clocksource riscv_clocksource
+[ 0.088000] NET: Registered protocol family 2
+[ 0.092000] TCP established hash table entries: 16384 (order: 5, 131072 bytes)
+[ 0.096000] TCP bind hash table entries: 16384 (order: 5, 131072 bytes)
+[ 0.096000] TCP: Hash tables configured (established 16384 bind 16384)
+[ 0.100000] UDP hash table entries: 1024 (order: 3, 32768 bytes)
+[ 0.100000] UDP-Lite hash table entries: 1024 (order: 3, 32768 bytes)
+[ 0.104000] NET: Registered protocol family 1
+[ 0.616000] Unpacking initramfs...
+[ 1.220000] workingset: timestamp_bits=62 max_order=19 bucket_order=0
+[ 1.244000] io scheduler noop registered
+[ 1.244000] io scheduler cfq registered (default)
+[ 1.244000] io scheduler mq-deadline registered
+[ 1.248000] io scheduler kyber registered
+[ 1.360000] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
+[ 1.368000] console [ttyS0] disabled
+[ 1.372000] f0300000.serial: ttyS0 at MMIO 0xf0300020 (irq = 10, base_baud = 1228800) is a 16550A
+[ 1.392000] console [ttyS0] enabled
+[ 1.392000] ftmac100: Loading version 0.2 ...
+[ 1.396000] ftmac100 e0100000.mac eth0: irq 8, mapped at ffffffd002005000
+[ 1.400000] ftmac100 e0100000.mac eth0: generated random MAC address 6e:ac:c3:92:36:c0
+[ 1.404000] IR NEC protocol handler initialized
+[ 1.404000] IR RC5(x/sz) protocol handler initialized
+[ 1.404000] IR RC6 protocol handler initialized
+[ 1.404000] IR JVC protocol handler initialized
+[ 1.408000] IR Sony protocol handler initialized
+[ 1.408000] IR SANYO protocol handler initialized
+[ 1.408000] IR Sharp protocol handler initialized
+[ 1.408000] IR MCE Keyboard/mouse protocol handler initialized
+[ 1.412000] IR XMP protocol handler initialized
+[ 1.456000] ftsdc010 f0e00000.mmc: mmc0 - using hw SDIO IRQ
+[ 1.464000] bootconsole [early0] uses init memory and must be disabled even before the real one is ready
+[ 1.464000] bootconsole [early0] disabled
+[ 1.508000] Freeing unused kernel memory: 12076K
+[ 1.512000] This architecture does not have kernel memory protection.
+[ 1.520000] mmc0: new SD card at address 4567
+[ 1.524000] mmcblk0: mmc0:4567 QEMU! 20.0 MiB
+[ 1.844000] mmcblk0:
+Wed Dec 1 10:00:00 CST 2010
+/ #
+
+
+
+TODO
+==================================================
+Boot bbl and riscv-linux via U-Boot on AE250 board