xref: /OK3568_Linux_fs/buildroot/board/sifive/hifive-unleashed/readme.txt (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593SmuzhiyunSiFive HiFive Unleashed
2*4882a593Smuzhiyun=======================
3*4882a593Smuzhiyun
4*4882a593SmuzhiyunThis file describes how to use the pre-defined Buildroot
5*4882a593Smuzhiyunconfiguration for the SiFive HiFive Unleashed board.
6*4882a593Smuzhiyun
7*4882a593SmuzhiyunFurther information about the HiFive Unleashed board can be found
8*4882a593Smuzhiyunat https://www.sifive.com/boards/hifive-unleashed
9*4882a593Smuzhiyun
10*4882a593SmuzhiyunBuilding
11*4882a593Smuzhiyun========
12*4882a593Smuzhiyun
13*4882a593SmuzhiyunConfigure Buildroot using the default board configuration:
14*4882a593Smuzhiyun
15*4882a593Smuzhiyun  $ make hifive_unleashed_defconfig
16*4882a593Smuzhiyun
17*4882a593SmuzhiyunCustomise the build as necessary:
18*4882a593Smuzhiyun
19*4882a593Smuzhiyun  $ make menuconfig
20*4882a593Smuzhiyun
21*4882a593SmuzhiyunStart the build:
22*4882a593Smuzhiyun
23*4882a593Smuzhiyun  $ make
24*4882a593Smuzhiyun
25*4882a593SmuzhiyunResult of the build
26*4882a593Smuzhiyun===================
27*4882a593Smuzhiyun
28*4882a593SmuzhiyunOnce the build has finished you will have the following files:
29*4882a593Smuzhiyun
30*4882a593Smuzhiyun    output/images/
31*4882a593Smuzhiyun    +-- boot.scr
32*4882a593Smuzhiyun    +-- fw_dynamic.bin
33*4882a593Smuzhiyun    +-- fw_dynamic.elf
34*4882a593Smuzhiyun    +-- fw_jump.bin
35*4882a593Smuzhiyun    +-- fw_jump.elf
36*4882a593Smuzhiyun    +-- hifive-unleashed-a00.dtb
37*4882a593Smuzhiyun    +-- Image
38*4882a593Smuzhiyun    +-- rootfs.cpio
39*4882a593Smuzhiyun    +-- rootfs.ext2
40*4882a593Smuzhiyun    +-- rootfs.ext4
41*4882a593Smuzhiyun    +-- rootfs.tar
42*4882a593Smuzhiyun    +-- sdcard.img
43*4882a593Smuzhiyun    +-- u-boot.bin
44*4882a593Smuzhiyun    +-- u-boot.itb
45*4882a593Smuzhiyun    +-- u-boot-spl.bin
46*4882a593Smuzhiyun
47*4882a593Smuzhiyun
48*4882a593SmuzhiyunCreating a bootable SD card with genimage
49*4882a593Smuzhiyun=========================================
50*4882a593Smuzhiyun
51*4882a593SmuzhiyunBy default Buildroot builds a SD card image for you. All you need to do
52*4882a593Smuzhiyunis dd the image to your SD card, which can be done with the following
53*4882a593Smuzhiyuncommand on your development host:
54*4882a593Smuzhiyun
55*4882a593Smuzhiyun  $ sudo dd if=output/images/sdcard.img of=/dev/sdb bs=4096
56*4882a593Smuzhiyun
57*4882a593SmuzhiyunThe above example command assumes the SD card is accessed via a USB card
58*4882a593Smuzhiyunreader and shows up as /dev/sdb on the host. Adjust it accordingly per
59*4882a593Smuzhiyunyour actual setup.
60*4882a593Smuzhiyun
61*4882a593SmuzhiyunBooting the SD card on the board
62*4882a593Smuzhiyun================================
63*4882a593Smuzhiyun
64*4882a593SmuzhiyunMake sure that the all DIP switches are set to the off position for
65*4882a593Smuzhiyundefault boot mode (MSEL mode = 1011), insert the SD card and power
66*4882a593Smuzhiyunup the board.
67*4882a593Smuzhiyun
68*4882a593SmuzhiyunConnect the USB cable and open minicom (/dev/ttyUSB1, 115200, 8N1).
69*4882a593Smuzhiyun
70*4882a593SmuzhiyunSee the 'SiFive HiFive Unleashed Getting Started Guide' for
71*4882a593Smuzhiyunmore details (https://www.sifive.com/documentation).
72*4882a593Smuzhiyun
73*4882a593SmuzhiyunYou will get a warning reported by fdisk when you examine the SD card.
74*4882a593SmuzhiyunThis is because the genimage_sdcard.cfg file doesn't specify the SD card
75*4882a593Smuzhiyunsize (as people will naturally have different sized cards), so the
76*4882a593Smuzhiyunsecondary GPT header is placed after the rootfs rather than at the end
77*4882a593Smuzhiyunof the disk where it is expected to be.
78*4882a593Smuzhiyun
79*4882a593SmuzhiyunYou will see something like this at boot time:
80*4882a593Smuzhiyun
81*4882a593Smuzhiyun[    0.989458] mmc0: host does not support reading read-only switch, assuming write-enable
82*4882a593Smuzhiyun[    0.996772] mmc0: new SDHC card on SPI
83*4882a593Smuzhiyun[    1.001634] mmcblk0: mmc0:0000 SD8GB 7.28 GiB
84*4882a593Smuzhiyun[    1.038079] GPT:Primary header thinks Alt. header is not at the end of the disk.
85*4882a593Smuzhiyun[    1.044759] GPT:52389 != 15264767
86*4882a593Smuzhiyun[    1.048051] GPT:Alternate GPT header not at the end of the disk.
87*4882a593Smuzhiyun[    1.054015] GPT:52389 != 15264767
88*4882a593Smuzhiyun[    1.057323] GPT: Use GNU Parted to correct GPT errors.
89*4882a593Smuzhiyun[    1.062479]  mmcblk0: p1 p2 p3
90*4882a593Smuzhiyun
91*4882a593Smuzhiyun
92*4882a593SmuzhiyunCreating a bootable SPI flash with genimage
93*4882a593Smuzhiyun===========================================
94*4882a593Smuzhiyun
95*4882a593SmuzhiyunAdjust Buildroot configuration by:
96*4882a593Smuzhiyun
97*4882a593Smuzhiyun  $ make menuconfig
98*4882a593Smuzhiyun
99*4882a593SmuzhiyunChange "System configuration" -> "Extra arguments passed to custom scripts"
100*4882a593Smuzhiyunvalue to "-c board/sifive/hifive-unleashed/genimage_spi-nor.cfg", save the
101*4882a593Smuzhiyunconfiguration and build. This creates a output/images/spi-nor.img that can
102*4882a593Smuzhiyunbe programmed to the on-board SPI flash.
103*4882a593Smuzhiyun
104*4882a593SmuzhiyunBoot the board from the SD card prepared above, stop the U-Boot auto boot,
105*4882a593Smuzhiyunand type the following commands to program the whole SPI flash:
106*4882a593Smuzhiyun
107*4882a593Smuzhiyun  => tftp 82000000 output/images/spi-nor.img
108*4882a593Smuzhiyun  => sf probe
109*4882a593Smuzhiyun  => sf update 82000000 0 2000000
110*4882a593Smuzhiyun
111*4882a593SmuzhiyunBooting the SPI flash on the board
112*4882a593Smuzhiyun==================================
113*4882a593Smuzhiyun
114*4882a593SmuzhiyunMake sure that the all DIP switches are set to the off position for
115*4882a593Smuzhiyundefault boot mode (MSEL mode = 0110) to boot from SPI flash.
116