Skip to content

rcman/riscvboot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 

Repository files navigation

riscvboot


I'm so sick of old installs, u-boot, sbi all that bullshit. I want to install what I want when I want. Making my own custom boot to do that!
https://github.com/ultraembedded/biriscv (https://github.com/ultraembedded/riscv-linux-boot
https://github.com/ultraembedded/riscv
https://www.sifive.com/blog/all-aboard-part-6-booting-a-risc-v-linux-kernel)
https://popovicu.com/posts/bare-metal-programming-risc-v/

How it boots


https://github.com/u-boot/u-boot/blob/master/doc/arch/riscv.rst
Compiling u-boot by default does not compile with many options. Ideally you want u-boot to scan for all devices on your machine. and then have a menu to select where you want to boot from.
The default config file for u-boot is in include/env_default.h and items should be added like below.
CONFIG_BOOTDELAY=30
CONFIG_AUTOBOOT_MENU_SHOW=y
CONFIG_USE_PREBOOT=y
CONFIG_PREBOOT="pci enum; usb start; scsi scan; nvme scan; virtio scan"
CONFIG_SPL_PCI=y
CONFIG_SPL_PCI_PNP=y
CONFIG_SPL_NVME=y
CONFIG_SPL_NVME_PCI=y
CONFIG_SPL_NVME_BOOT_DEVICE (number of the NVMe device)
CONFIG_SYS_NVME_BOOT_PARTITION (partition to read from)
To load from a file system use:

CONFIG_SPL_FS_FAT=y or CONFIG_SPL_FS_EXT=y
CONFIG_SPL_FS_LOAD_PAYLOAD_NAME=””
bootmenu_delay=5
bootmenu_0="-------- Boot Options --------"=run boot_default
bootmenu_1="Boot from Nor"=run nor_boot
bootmenu_2="Boot from Nand"=run nand_boot
bootmenu_3="Boot from MMC"=run mmc_boot
bootmenu_4="Autoboot"=run autoboot
bootmenu_5="Show current Boot Device"=run boot_default
bootmenu_6="-------- Flash Options --------"=run flash_default
bootmenu_7="recovery from usb"=run flash_from_usb
bootmenu_8="recovery from mmc"=run flash_from_mmc

Example of menu option


// Nor+ssd boot combo
set_nor_args=setenv bootargs ${bootargs} mtdparts=${mtdparts} root=${nvme_root} rootfstype=ext4
nor_boot=echo "Try to boot from NVMe ..."; \
run commonargs; \
run set_nvme_root; \
run set_nor_args; \
run detect_dtb; \
run loadknl; \
run loaddtb; \
run loadramdisk; \
bootm ${kernel_addr_r} ${ramdisk_combo} ${dtb_addr}; \
echo "########### boot kernel failed by default config, check your boot config #############"

bootmenu_9="recovery from net"=run flash_from_net

// Variable "boot_device" is set during board_late_init()
autoboot=if test ${boot_device} = nand; then &lt;br&gt; run nand_boot; &lt;br&gt; elif test ${boot_device} = nor; then <br> run nor_boot; <br> elif test ${boot_device} = mmc; then <br> run mmc_boot; <br> fi;

bootcmd=run autoboot; echo "run autoboot"

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published