jh7110 visionfive2 linux uboot debian

opensbi

git clone https://github.com/riscv-software-src/opensbi.git
cd opensbi/
sudo apt install gcc-riscv64-linux-gnu
make PLATFORM=generic FW_TEXT_START=0x40000000 FW_OPTIONS=0 CROSS_COMPILE=riscv64-linux-gnu- -j16

uboot

sudo apt install swig

git clone https://github.com/u-boot/u-boot.git
cd u-boot/

starfive_visionfive2_defconfig 添加:

CONFIG_CMD_SYSBOOT=y
CONFIG_BOOTCOMMAND="sysboot mmc 1:3 any b0000000 /extlinux/extlinux.conf"
make starfive_visionfive2_defconfig
make CROSS_COMPILE=riscv64-linux-gnu- OPENSBI=../opensbi/build/platform/generic/firmware/fw_dynamic.bin -j16

linux

git clone https://github.com/starfive-tech/linux.git
cd linux/
git checkout JH7110_VisionFive2_upstream
make starfive_visionfive2_defconfig
make ARCH=riscv CROSS_COMPILE=riscv64-linux-gnu- -j16

rootfs

sudo apt install mmdebstrap qemu-user-static binfmt-support

mkdir rvrootfs
sudo mmdebstrap --architectures=riscv64 sid rvrootfs "deb https://mirrors.ustc.edu.cn/debian sid main"

sudo chroot rvrootfs
passwd root
...

exit
dd if=/dev/zero of=rootfs.img bs=1G count=1
sudo mkfs.ext4 rootfs.img
mkdir rootfs_mount
sudo mount rootfs.img rootfs_mount
sudo cp -rfp rvrootfs/* rootfs_mount
sudo umount rootfs_mount
rm -r rootfs_mount
sudo e2fsck -f rootfs.img
sudo resize2fs -M rootfs.img # 调整镜像为实际大小

sdcard

sudo sgdisk -z -og /dev/sdc
sudo sgdisk --clear \
--set-alignment=2 \
--new=1:4096:8191 --change-name=1:spl --typecode=1:2E54B353-1271-4842-806F-E436D6AF6985 \
--new=2:8192:16383 --change-name=2:uboot --typecode=2:BC13C2FF-59E6-4262-A352-B275FD6F7172 \
--new=3:16384:1654784 --change-name=3:boot --typecode=3:EBD0A0A2-B9E5-4433-87C0-68B6B72699C7 \
--new=4:1654785: --change-name=4:rootfs \
/dev/sdc

sudo mkfs.ext4 /dev/sdc3

nano extlinux.conf
extlinux.conf:

default hhh

label hhh
    kernel /Image.gz
    fdt /jh7110-starfive-visionfive-2-v1.3b.dtb
    append root=/dev/mmcblk1p4 rw
sudo dd if=u-boot/spl/u-boot-spl.bin.normal.out of=/dev/sdc1 bs=512
sudo dd if=u-boot/u-boot.itb of=/dev/sdc2 bs=512
sudo dd if=rootfs.img of=/dev/sdc4 bs=512
sync

sudo mount /dev/sdc3 /mnt/
sudo mkdir /mnt/extlinux
sudo cp extlinux.conf /mnt/extlinux/
sudo cp linux/arch/riscv/boot/Image.gz /mnt/
sudo cp linux/arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-2-v1.3b.dtb /mnt/
sudo umount /mnt

power on…

使用root登录

扩展分区大小:

lsblk
df -h
resize2fs /dev/mmcblk1p4

相关推荐

  1. jh7110 visionfive2 linux uboot debian

    2024-04-24 22:14:05       38 阅读
  2. -CSSE3100/7100

    2024-04-24 22:14:05       35 阅读
  3. 【STM32读取HX711的函数】

    2024-04-24 22:14:05       54 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-04-24 22:14:05       98 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-04-24 22:14:05       106 阅读
  3. 在Django里面运行非项目文件

    2024-04-24 22:14:05       87 阅读
  4. Python语言-面向对象

    2024-04-24 22:14:05       96 阅读

热门阅读

  1. k8s的网络组件有哪些,他们的作用分别是什么

    2024-04-24 22:14:05       34 阅读
  2. Python语言第五章之字符串

    2024-04-24 22:14:05       36 阅读
  3. 5359: 【图论】有向图连接边数(图的遍历前置)

    2024-04-24 22:14:05       29 阅读
  4. 多批道处理算法

    2024-04-24 22:14:05       29 阅读
  5. C# 下记录(Record)详解

    2024-04-24 22:14:05       34 阅读
  6. 6个外贸新人关注的问题

    2024-04-24 22:14:05       33 阅读