This Debian riscv64 Linux image is built directly from official packages using the Debian debootstrap utility, see: https://github.com/inindev/visionfive2/blob/main/debian/make_debian_img.sh#L132
Most patches are directly available from the Debian repos using the built-in apt package manager, see: https://github.com/inindev/visionfive2/blob/main/debian/make_debian_img.sh#L354-L361
Note: The kernel in this bundle is from kernel.org and will not get updates from debian.
1. download image
wget https://github.com/inindev/visionfive2/releases/download/v13-6.6.5/visionfive2_trixie-v13-6.6.5.img.xz
2. determine the location of the target micro sd card
- before plugging-in device
ls -l /dev/sd*
ls: cannot access '/dev/sd*': No such file or directory
- after plugging-in device
ls -l /dev/sd*
brw-rw---- 1 root disk 8, 0 Apr 10 15:56 /dev/sda
- note: for mac, the device is
/dev/rdiskX
3. in the case above, substitute 'a' for 'X' in the command below (for /dev/sda)
sudo su
xzcat visionfive2_trixie-v13-6.6.5.img.xz > /dev/sdX
sync
Note the boot switch configuration setting needed to select mmc boot.
4. login account
login id: debian
password: debian
5. take updates
sudo apt update
sudo apt upgrade
6. create account & login as new user
sudo adduser youruserid
echo '<youruserid> ALL=(ALL) NOPASSWD: ALL' | sudo tee /etc/sudoers.d/<youruserid>
sudo chmod 440 /etc/sudoers.d/<youruserid>
7. lockout and/or delete debian account
sudo passwd -l debain
sudo chsh -s /usr/sbin/nologin debian
sudo deluser --remove-home debian
sudo rm /etc/sudoers.d/debian
8. change hostname (optional)
sudo nano /etc/hostname
sudo nano /etc/hosts
1. boot from removable mmc
Follow the instructions for creating bootable mmc media.
2. download and copy the image file on to the nvme media
wget https://github.com/inindev/visionfive2/releases/download/v13-6.6.5/visionfive2_trixie-v13-6.6.5.img.xz
sudo su
xzcat visionfive2_trixie-v13-6.6.5.img.xz > /dev/nvme0n1
sync
3. the u-boot partitions are not used on nvme media and can be removed
sfdisk --delete /dev/nvme0n1 1
sfdisk --delete /dev/nvme0n1 2
sfdisk -r /dev/nvme0n1
4. remove mmc media and reboot
1. boot from removable mmc
Follow the instructions for creating bootable mmc media.
Note: Configure the boot switch setting needed to select mmc boot.
2. install mtd-utils
once linux is booted from the removable mmc, install mtd-utils
sudo apt update
sudo apt -y install mtd-utils
3. erase spi flash
sudo flash_erase /dev/mtd0 0 0
sudo flash_erase /dev/mtd1 0 0
sudo flash_erase /dev/mtd2 0 0
sudo flash_erase /dev/mtd3 0 0
4. write u-boot to spi flash
wget https://github.com/inindev/visionfive2/releases/download/v13-6.6.5/u-boot-spl.bin.normal.out
wget https://github.com/inindev/visionfive2/releases/download/v13-6.6.5/u-boot.itb
sudo flashcp -v u-boot-spl.bin.normal.out /dev/mtd0
sudo flashcp -v u-boot.itb /dev/mtd2
Once the spi flash has been written, the boot sequence should prefer removable mmc media if present, then boot m.2 nvme ssd.
Note: Configure the boot switch setting needed to select spi boot.
The build script builds native riscv64 binaries, and thus needs to be run from an riscv64 device such as visionfive2 running a 64 bit risc-v linux.
1. clone the repo
git clone https://github.com/inindev/visionfive2.git
cd visionfive2
2. run the debian build script
cd debian
sudo sh make_debian_img.sh
- note: edit the build script to change various options:
nano make_debian_img.sh
3. the output if the build completes successfully
mmc_2g.img.xz