• 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
    
    • 1
    • 2
    • 3
    • 4

    uboot

    sudo apt install swig
    
    git clone https://github.com/u-boot/u-boot.git
    cd u-boot/
    
    • 1
    • 2
    • 3
    • 4

    starfive_visionfive2_defconfig 添加:

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

    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
    
    • 1
    • 2
    • 3
    • 4
    • 5

    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
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    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 # 调整镜像为实际大小
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9

    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
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10

    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
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    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
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11

    power on…

    使用root登录

    扩展分区大小:

    lsblk
    df -h
    resize2fs /dev/mmcblk1p4
    
    • 1
    • 2
    • 3
  • 相关阅读:
    一、MyBatis 框架
    英码边缘计算盒子IVP03X——32T超强算力,搭载BM1684X算能TPU处理器
    Thinkphp 5.0.24变量覆盖漏洞导致RCE分析
    易点易动固定资产管理系统:提升企业固定资产领用效率的智能选择
    化工原理 --- 热量传递(补充)
    WPF中加载GIF
    【Python刷题篇】——Python入门 010 内置函数(三)
    LTD248次升级 | 竞赛数字化:在线答题赛、反复多轮赛,答题领取现金 • 官微名片展示个人简介 • 官网可搜索各类文件
    【Vue-Element-Admin】导出el-table全部数据
    k8s 中 Pod 的控制器
  • 原文地址:https://blog.csdn.net/qq_41544116/article/details/138169362