HiFive_U-Boot
Development repository for HiFive Unleashed U-Boot
This repository contains the U-Boot created by Microsemi a Microchip company for RISC-V core on HiFive Unleashed 540 device. The HiFive Unleashed Board is used for HiFive U-Boot.
RISC-V cross tools
Get the RISC-V cross tool from SiFive GitHub and follow the README file for installation.
$ git clone --recursive https://github.com/sifive/freedom-u-sdk.git
$ cd freedom-u-sdk
$ make
Getting U-Boot sources
$ git clone https://github.com/Microsemi-SoC-IP/HiFive_U-Boot
$ cd HiFive_U-Boot
Build U-Boot
-
Set the PATH
$ export PATH=$PATH:/{path to freedom-u-sdk}/toolchain/bin
-
Create U-Boot configuration based on architecture defaults:
$ make HiFive-U540_defconfig
-
Optionally edit the configuration via an ncurses interface:
$ make menuconfig
-
Build the U-Boot image:
$ make
Load uboot image on SD card
-
Copy uboot.bin image to
freedom-u-sdk/work
directory -
Connect SD card to a Host machine.
-
Open
make
file fromfreedom-u-sdk
directory and edit at.PHONY: format-boot-loader
.PHONY: format-boot-loader format-boot-loader: $(bin) @test -b $(DISK) || (echo "$(DISK): is not a block device"; exit 1) sgdisk --clear \ --new=1:2048:4095 --change-name=1:uboot --typecode=1:$(FSBL) \ --new=2:4096:69631 --change-name=2:bootloader --typecode=2:$(BBL) \ --new=3:264192: --change-name=3:root --typecode=3:$(LINUX) \ $(DISK) @sleep 1 ifeq ($(DISK)p1,$(wildcard $(DISK)p1)) @$(eval PART1 := $(DISK)p1) @$(eval PART2 := $(DISK)p2) @$(eval PART3 := $(DISK)p3) else ifeq ($(DISK)s1,$(wildcard $(DISK)s1)) @$(eval PART1 := $(DISK)s1) @$(eval PART2 := $(DISK)s2) @$(eval PART3 := $(DISK)s3) else ifeq ($(DISK)1,$(wildcard $(DISK)1)) @$(eval PART1 := $(DISK)1) @$(eval PART2 := $(DISK)2) @$(eval PART3 := $(DISK)3) else @echo Error: Could not find bootloader partition for $(DISK) @exit 1 endif dd if=/{Path_To}/freedom-u-sdk/work/u-boot.bin of=$(PART1) bs=4096 dd if=/{Path_To}/freedom-u-sdk/work/bbl.bin of=$(PART2) bs=4096 mke2fs -t ext3 $(PART3)
-
Go to
freedom-u-sdk
directory$ cd freedom-u-sdk $ sudo make DISK=/dev/sdb format-boot-loader
If any error, follow the HiFive Getting started user guide section 7.2.4.
-
Remove SD card from Host machine and insert it on the HiFive unleashed Board
-
Select dip switch for
mode select
to1011
(boot from SD card) -
Power suppy the board and connect usb cable to Host Machine and open serial terminal with 115200 baud rate.
-
Press reset button and see the uboot messages on serial terminal
Boot Linux from SD card
Enter below commands on serial terminal
# mmc_spi 1 20000000 0
# mmc read 0x80000000 0x1000 0x10000
# go 0x80000000
Boot Linux from TFTP
Enter below commands on serial terminal
# setenv serverip xx.xx.xx.xx
# bootp
# go 0x80000000