Hi Pragnesh > From: Pragnesh Patel [mailto:pragnesh.pa...@sifive.com] > Sent: Friday, January 17, 2020 8:46 PM > To: u-boot@lists.denx.de > Cc: atish.pa...@wdc.com; palmerdabb...@google.com; bmeng...@gmail.com; > paul.walms...@sifive.com; ja...@amarulasolutions.com; > troy.benjeger...@sifive.com; anup.pa...@wdc.com; sagar.ka...@sifive.com; > Pragnesh Patel; Anup Patel; Rick Jian-Zhi Chen(陳建志) > Subject: [PATCH v2 9/9] doc: update FU540 RISC-V documentation > > Add descriptions about U-Boot SPL feature and how to build and run. > > Signed-off-by: Pragnesh Patel <pragnesh.pa...@sifive.com> > --- > doc/board/sifive/fu540.rst | 370 +++++++++++++++++++++++++++++++++++++ > 1 file changed, 370 insertions(+) > > diff --git a/doc/board/sifive/fu540.rst b/doc/board/sifive/fu540.rst index > 3937222c6c..e15427414d 100644 > --- a/doc/board/sifive/fu540.rst > +++ b/doc/board/sifive/fu540.rst > @@ -363,3 +363,373 @@ load uImage. > > Please press Enter to activate this console. > / # > + > + > +Running U-Boot SPL > +------------------ > +The U-Boot SPL will boot in M mode and load the FIT image which include > +OpenSBI and U-Boot proper images. After loading progress, it will jump > +to OpenSBI first and then U-Boot proper which will run in S mode. > + > + > +How to build U-Boot SPL > +----------------------- > +Before building U-Boot SPL, OpenSBI must be build first. OpenSBI can be > +cloned and build for FU540 as below: > +
Please add .. code-block:: console > +git clone https://github.com/riscv/opensbi.git > +cd opensbi > +make PLATFORM=sifive/fu540 > + > +Copy OpenSBI FW_DYNAMIC image > +(build/platform/sifive/fu540/firmware/fw_dynamic.bin) > +into U-Boot root directory > + > + > +How to build U-Boot SPL booting from MMC > +---------------------------------------- > +With sifive_fu540_spl_defconfig: > + > +1. Add the RISC-V toolchain to your PATH. > +2. Setup ARCH & cross compilation enviornment variable: > + > +.. code-block:: none > + > + export ARCH=riscv > + export CROSS_COMPILE=<riscv64 toolchain prefix> > + > +3. make sifive_fu540_spl_defconfig > +4. make > + > + > +Flashing > +-------- > + > +The current U-Boot port is supported in S-mode only. > + > +A prior stage M-mode firmware/bootloader (e.g OpenSBI) is required to > +boot the u-boot.bin in S-mode and provide M-mode runtime services. > + > +First partition of the sdcard should contain "u-boot.itb" and Partition > +type should be of "8300 Linux filesystem". > + > +.. code-block:: none > + > + sudo dd if=spl/u-boot-spl.bin of=/dev/disk2s4 bs=1024 > + sudo dd if=u-boot.itb of=/dev/disk2s1 bs=1024 > + > +Booting > +------- > +Once you plugin the sdcard and power up, you should see the U-Boot prompt. > + > +Sample boot log from HiFive Unleashed board > +------------------------------------------- > + > +.. code-block:: none > + > + U-Boot SPL 2020.01-00176-gfb5af3c225 (Jan 16 2020 - 19:23:14 +0530) > + Trying to boot from MMC1 > + > + > + U-Boot 2020.01-00176-gfb5af3c225 (Jan 16 2020 - 19:23:14 +0530) > + > + CPU: rv64imafdc > + Model: SiFive HiFive Unleashed A00 > + DRAM: 8 GiB > + MMC: spi@10050000:mmc@0: 0 > + In: serial@10010000 > + Out: serial@10010000 > + Err: serial@10010000 > + Board serial number should not be 0 !! > + Net: Please fix ERROR: trailing whitespace #98: FILE: doc/board/sifive/fu540.rst:443: > + Warning: ethernet@10090000 (eth0) using random MAC address - > 9e:33:74:04:6a:eb > + eth0: ethernet@10090000 > + Hit any key to stop autoboot: 0 > + => version > + U-Boot 2020.01-00176-gfb5af3c225 (Jan 16 2020 - 19:23:14 +0530) > + > + riscv64-unknown-linux-gnu-gcc (crosstool-NG 1.24.0.37-3f461da) 9.2.0 > + GNU ld (crosstool-NG 1.24.0.37-3f461da) 2.32 > + => mmc info > + Device: spi@10050000:mmc@0 > + Manufacturer ID: 3 > + OEM: 5344 > + Name: SC16G > + Bus Speed: 20000000 > + Mode: SD Legacy > + Rd Block Len: 512 > + SD version 2.0 > + High Capacity: Yes > + Capacity: 14.8 GiB > + Bus Width: 1-bit > + Erase Group Size: 512 Bytes > + => mmc part > + > + Partition Map for MMC device 0 -- Partition Type: EFI > + > + Part Start LBA End LBA Name > + Attributes > + Type GUID > + Partition GUID > + 1 0x00000800 0x000107ff "Linux filesystem" > + attrs: 0x0000000000000000 > + type: 0fc63daf-8483-4772-8e79-3d69d8477de4 > + guid: 36aab838-b418-4342-929e-678d85fb4438 > + 2 0x00040800 0x00ecdfde "Linux filesystem" > + attrs: 0x0000000000000000 > + type: 0fc63daf-8483-4772-8e79-3d69d8477de4 > + guid: 118ac296-e3ff-4ef2-b435-ec6a7bebdd6e > + > +Now you can configure your networking, tftp server and use tftp boot > +method to load uImage. > + > +.. code-block:: none > + > + => setenv serverip 172.16.35.74 > + => setenv ipaddr 172.16.35.40 > + => tftpboot 0x83000000 fit.itb > + ethernet@10090000: PHY present at 0 > + ethernet@10090000: Starting autonegotiation... > + ethernet@10090000: Autonegotiation complete > + ethernet@10090000: link up, 100Mbps full-duplex (lpa: 0x41e1) > + Using ethernet@10090000 device > + TFTP from server 172.16.35.74; our IP address is 172.16.35.40 > + Filename 'fit.itb'. > + Load address: 0x83000000 > + Loading: ################################################################# > + ################################################################# > + ################################################################# > + ################################################################# > + ################################################################# > + ################################################################# > + ################################################################# > + ################################################################# > + ################################################################# > + ################################################################# > + ################################################################# > + ################################################################# > + ################################################################# > + ################################################################# > + ################################################################# > + ################################################################# > + ################################################################# > + ################################################################# > + ################################################################# > + ################################################################# > + ################################################################# > + ################################################################# > + ################################################################# > + ################################################################# > + ################################################################# > + ################################################################# > + ################################################################# > + ################################################################# > + ################################################################# > + ################################################################# > + ################################################################# > + ################################################################# > + ################################################################# > + ################################################################# > + ################################################################# > + ################################################################# > + ################################################################# > + ################################################################# > + ################################################################# > + ################################################################# > + ################################################################# > + ################################### > + 880.9 KiB/s > + done > + Bytes transferred = 13823823 (d2ef4f hex) > + => bootm 0x83000000 > + ## Loading kernel from FIT Image at 83000000 ... > + Using 'config-1' configuration > + Trying 'kernel@1' kernel subimage > + Description: Linux kernel > + Type: Kernel Image > + Compression: uncompressed > + Data Start: 0x830000d8 > + Data Size: 9247260 Bytes = 8.8 MiB > + Architecture: RISC-V > + OS: Linux > + Load Address: 0x80200000 > + Entry Point: 0x80200000 > + Verifying Hash Integrity ... OK > + ## Loading ramdisk from FIT Image at 83000000 ... > + Using 'config-1' configuration > + Trying 'ramdisk@1' ramdisk subimage > + Description: ramdisk > + Type: RAMDisk Image > + Compression: gzip compressed > + Data Start: 0x838d3378 > + Data Size: 4568674 Bytes = 4.4 MiB > + Architecture: RISC-V > + OS: Linux > + Load Address: 0x82000000 > + Entry Point: unavailable > + Verifying Hash Integrity ... OK > + Loading ramdisk from 0x838d3378 to 0x82000000 > + WARNING: 'compression' nodes for ramdisks are deprecated, please fix your > .its file! > + ## Loading fdt from FIT Image at 83000000 ... > + Using 'config-1' configuration > + Trying 'fdt@1' fdt subimage > + Description: unavailable > + Type: Flat Device Tree > + Compression: uncompressed > + Data Start: 0x838d1b80 > + Data Size: 6023 Bytes = 5.9 KiB > + Architecture: RISC-V > + Verifying Hash Integrity ... OK > + Booting using the fdt blob at 0x838d1b80 > + Loading Kernel Image > + Using Device Tree in place at 00000000838d1b80, end 00000000838d6306 > + > + Starting kernel ... > + > + [ 0.000000] OF: fdt: Ignoring memory range 0x80000000 - 0x80200000 > + [ 0.000000] Linux version 5.3.0-13236-g97f9a3c4eee5 > (pragneshp@sachinj2-OptiPlex-7010) (gcc version 8.2.0 (Buildroot > 2018.11-rc2-00003-ga0787e9 > + [ 0.000000] earlycon: sifive0 at MMIO 0x0000000010010000 (options '') > + [ 0.000000] printk: bootconsole [sifive0] enabled > + [ 0.000000] Initial ramdisk at: 0x(____ptrval____) (4568674 bytes) > + [ 0.000000] Zone ranges: > + [ 0.000000] DMA32 [mem 0x0000000080200000-0x00000000ffffffff] > + [ 0.000000] Normal [mem 0x0000000100000000-0x000000027fffffff] > + [ 0.000000] Movable zone start for each node > + [ 0.000000] Early memory node ranges > + [ 0.000000] node 0: [mem 0x0000000080200000-0x000000027fffffff] > + [ 0.000000] Initmem setup node 0 [mem > 0x0000000080200000-0x000000027fffffff] > + [ 0.000000] software IO TLB: mapped [mem 0xfbfff000-0xfffff000] (64MB) > + [ 0.000000] CPU with hartid=0 is not available > + [ 0.000000] CPU with hartid=0 is not available > + [ 0.000000] elf_hwcap is 0x112d > + [ 0.000000] percpu: Embedded 17 pages/cpu s30680 r8192 d30760 u69632 > + [ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: > 2067975 > + [ 0.000000] Kernel command line: earlycon=sifive,0x10010000 > console=ttySIF0,115200 > + [ 0.000000] Dentry cache hash table entries: 1048576 (order: 11, > 8388608 bytes, linear) > + [ 0.000000] Inode-cache hash table entries: 524288 (order: 10, 4194304 > bytes, linear) > + [ 0.000000] Sorting __ex_table... > + [ 0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off > + [ 0.000000] Memory: 8179828K/8386560K available (6081K kernel code, > 388K rwdata, 2025K rodata, 209K init, 307K bss, 206732K reserved, 0K cma-r) > + [ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1 > + [ 0.000000] rcu: Hierarchical RCU implementation. > + [ 0.000000] rcu: RCU restricting CPUs from NR_CPUS=8 to > nr_cpu_ids=4. > + [ 0.000000] rcu: RCU calculated value of scheduler-enlistment delay is > 25 jiffies. > + [ 0.000000] rcu: Adjusting geometry for rcu_fanout_leaf=16, > nr_cpu_ids=4 > + [ 0.000000] NR_IRQS: 0, nr_irqs: 0, preallocated irqs: 0 > + [ 0.000000] plic: mapped 53 interrupts with 4 handlers for 9 contexts. > + [ 0.000000] riscv_timer_init_dt: Registering clocksource cpuid [0] > hartid [1] > + [ 0.000000] clocksource: riscv_clocksource: mask: 0xffffffffffffffff > max_cycles: 0x1d854df40, max_idle_ns: 3526361616960 ns > + [ 0.000006] sched_clock: 64 bits at 1000kHz, resolution 1000ns, wraps > every 2199023255500ns > + [ 0.008479] Console: colour dummy device 80x25 > + [ 0.012817] Calibrating delay loop (skipped), value calculated using > timer frequency.. 2.00 BogoMIPS (lpj=4000) > + [ 0.022842] pid_max: default: 32768 minimum: 301 > + [ 0.027915] Mount-cache hash table entries: 16384 (order: 5, 131072 > bytes, linear) > + [ 0.035329] Mountpoint-cache hash table entries: 16384 (order: 5, > 131072 bytes, linear) > + [ 0.044787] rcu: Hierarchical SRCU implementation. > + [ 0.049253] smp: Bringing up secondary CPUs ... > + [ 0.055031] smp: Brought up 1 node, 4 CPUs > + [ 0.059662] devtmpfs: initialized > + [ 0.063815] random: get_random_u32 called from > bucket_table_alloc.isra.29+0x4e/0x160 with crng_init=0 > + [ 0.072585] clocksource: jiffies: mask: 0xffffffff max_cycles: > 0xffffffff, max_idle_ns: 7645041785100000 ns > + [ 0.081998] futex hash table entries: 1024 (order: 4, 65536 bytes, > linear) > + [ 0.089506] NET: Registered protocol family 16 > + [ 0.105912] vgaarb: loaded > + [ 0.108166] SCSI subsystem initialized > + [ 0.111949] usbcore: registered new interface driver usbfs > + [ 0.117105] usbcore: registered new interface driver hub > + [ 0.122485] usbcore: registered new device driver usb > + [ 0.128071] clocksource: Switched to clocksource riscv_clocksource > + [ 0.140265] NET: Registered protocol family 2 > + [ 0.144438] tcp_listen_portaddr_hash hash table entries: 4096 (order: > 4, 65536 bytes, linear) > + [ 0.152609] TCP established hash table entries: 65536 (order: 7, > 524288 bytes, linear) > + [ 0.162230] TCP bind hash table entries: 65536 (order: 8, 1048576 > bytes, linear) > + [ 0.172148] TCP: Hash tables configured (established 65536 bind 65536) > + [ 0.178333] UDP hash table entries: 4096 (order: 5, 131072 bytes, > linear) > + [ 0.185129] UDP-Lite hash table entries: 4096 (order: 5, 131072 bytes, > linear) > + [ 0.192542] NET: Registered protocol family 1 > + [ 0.196747] RPC: Registered named UNIX socket transport module. > + [ 0.202140] RPC: Registered udp transport module. > + [ 0.206824] RPC: Registered tcp transport module. > + [ 0.211500] RPC: Registered tcp NFSv4.1 backchannel transport module. > + [ 0.217929] PCI: CLS 0 bytes, default 64 > + [ 0.222133] Unpacking initramfs... > + [ 0.578890] Freeing initrd memory: 4460K > + [ 0.583069] workingset: timestamp_bits=62 max_order=21 bucket_order=0 > + [ 0.596744] NFS: Registering the id_resolver key type > + [ 0.601095] Key type id_resolver registered > + [ 0.605191] Key type id_legacy registered > + [ 0.609190] nfs4filelayout_init: NFSv4 File Layout Driver > Registering... > + [ 0.616026] 9p: Installing v9fs 9p2000 file system support > + [ 0.621682] NET: Registered protocol family 38 > + [ 0.625801] Block layer SCSI generic (bsg) driver version 0.4 loaded > (major 253) > + [ 0.633151] io scheduler mq-deadline registered > + [ 0.637659] io scheduler kyber registered > + [ 0.685692] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled > + [ 0.692289] 10010000.serial: ttySIF0 at MMIO 0x10010000 (irq = 4, > base_baud = 0) is a SiFive UART v0 > + [ 0.700672] printk: console [ttySIF0] enabled > + [ 0.700672] printk: console [ttySIF0] enabled > + [ 0.709334] printk: bootconsole [sifive0] disabled > + [ 0.709334] printk: bootconsole [sifive0] disabled > + [ 0.719129] 10011000.serial: ttySIF1 at MMIO 0x10011000 (irq = 1, > base_baud = 0) is a SiFive UART v0 > + [ 0.728453] [drm] radeon kernel modesetting enabled. > + [ 0.745398] loop: module loaded > + [ 0.748320] sifive_spi 10040000.spi: mapped; irq=3, cs=1 > + [ 0.753595] sifive_spi 10050000.spi: mapped; irq=5, cs=1 > + [ 0.758916] libphy: Fixed MDIO Bus: probed > + [ 0.762992] macb 10090000.ethernet: Registered clk switch > 'sifive-gemgxl-mgmt' > + [ 0.769750] macb: GEM doesn't support hardware ptp. > + [ 0.774636] libphy: MACB_mii_bus: probed > + [ 0.940362] Microsemi VSC8541 SyncE 10090000.ethernet-ffffffff:00: > attached PHY driver [Microsemi VSC8541 SyncE] (mii_bus:phy_addr=10090000.et) > + [ 0.954905] macb 10090000.ethernet eth0: Cadence GEM rev 0x10070109 at > 0x10090000 irq 6 (9e:33:74:04:6a:eb) > + [ 0.964712] e1000e: Intel(R) PRO/1000 Network Driver - 3.2.6-k > + [ 0.970429] e1000e: Copyright(c) 1999 - 2015 Intel Corporation. > + [ 0.976422] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver > + [ 0.982845] ehci-pci: EHCI PCI platform driver > + [ 0.987301] ehci-platform: EHCI generic platform driver > + [ 0.992561] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver > + [ 0.998660] ohci-pci: OHCI PCI platform driver > + [ 1.003105] ohci-platform: OHCI generic platform driver > + [ 1.008570] usbcore: registered new interface driver uas > + [ 1.013632] usbcore: registered new interface driver usb-storage > + [ 1.019706] mousedev: PS/2 mouse device common for all mice > + [ 1.050576] mmc_spi spi1.0: SD/MMC host mmc0, no DMA, no WP, no > poweroff, cd polling > + [ 1.057720] usbcore: registered new interface driver usbhid > + [ 1.063103] usbhid: USB HID core driver > + [ 1.067815] NET: Registered protocol family 10 > + [ 1.072430] Segment Routing with IPv6 > + [ 1.075375] sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver > + [ 1.081750] NET: Registered protocol family 17 > + [ 1.085874] 9pnet: Installing 9P2000 support > + [ 1.089962] Key type dns_resolver registered > + [ 1.096391] Freeing unused kernel memory: 208K > + [ 1.100047] This architecture does not have kernel memory protection. > + [ 1.106486] Run /init as init process > + Starting syslogd: OK > + Starting klogd: OK > + Starting mdev... > + /etc/init.d/S10mdev: line 9: can't create /proc/sys/kernel/hotplug: > nonexistent directory > + [ 1.167865] mmc0: host does not support reading read-only switch, > assuming write-enable > + [ 1.175122] mmc0: new SDHC card on SPI > + [ 1.180128] mmcblk0: mmc0:0000 SC16G 14.8 GiB > + [ 1.214481] mmcblk0: p1 p2 p4 > + modprobe: can't change directory to '/lib/modules': No such file or > directory > + Initializing random number generator... [ 1.655480] random: dd: > uninitialized urandom read (512 bytes read) > + done. > + Starting network: udhcpc: started, v1.29.3 > + udhcpc: sending discover > + [ 3.724710] macb 10090000.ethernet eth0: link up (100/Full) > + [ 3.729529] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready > + udhcpc: sending discover > + udhcpc: sending discover > + udhcpc: sending select for 172.16.35.78 > + udhcpc: lease of 172.16.35.78 obtained, lease time 28800 > + deleting routers > + adding dns 172.16.34.150 > + adding dns 172.16.24.25 > + OK > + Starting dropbear sshd: [ 7.932851] random: dropbear: uninitialized > urandom read (32 bytes read) > + OK > + > + Welcome to Buildroot > + buildroot login: root > + Password: Please fix ERROR: trailing whitespace #389: FILE: doc/board/sifive/fu540.rst:734: + Password: $ > + # > -- > 2.17.1 >