9480
Comment:
|
9481
fix link
|
Deletions are marked like this. | Additions are marked like this. |
Line 59: | Line 59: |
(Unmatched Debian prebuilt image)[https://github.com/yuzibo/Unmatched-Debian-image/] built from multistrap, maintianed by vimer <tsu.yubo@gmail.com> | [[ttps://github.com/yuzibo/Unmatched-Debian-image/|Unmatched Debian prebuilt image]] built from multistrap, maintianed by vimer <tsu.yubo@gmail.com> |
Line 249: | Line 249: |
To boot from the onboard SPI flash (QSPI0 in SiFive's documentation), set MSEL[3:0] to 0110: | To boot from the onboard SPI flash (QSPI0 in !SiFive's documentation), set MSEL[3:0] to 0110: |
DebianOn is an effort to document how to install, configure and use Debian on some specific hardware. Therefore potential buyers would know if that hardware is supported and owners would know how get the best out of that hardware. The purpose is not to duplicate the Debian Official Documentation, but to document how to install Debian on some specific hardware. If you need help to get Debian running on your hardware, please have a look at our user support channels where you may find specific channels (mailing list, IRC channel) dedicated to certain types of hardware. |
Translation(s): none
Contents
Models covered
?SiFive ?HiFive Unmatched
?SiFive HiFive Unmatched, ?SiFive FU740-C000 (Quad-core 64-bit ?SiFive U74) + Embedded 64-bit ?SiFive S7 Core, 16 GB 64-bit DDR4, 1x PCI Express Gen3 x8 via PCI Express x16 Connector, Ethernet – 10/100/1000 Mbps, NVMe SSD M.2 , microSD Card.
Overall Status
Core Components |
||
Boot Standard Kernel: |
|
|
LAN network card (): |
|
|
Detect hard drives (microSD/NVMe): |
|
|
Xorg |
[?] |
|
Extra Features |
||
CPU Frequency Scaling |
[?] |
|
Hibernation |
[?] |
|
Sleep / Suspend |
[?] |
|
Power Off / Reboot |
|
Legend :
= OK ; Unsupported(No Driver) ; = Error (Couldn't get it working); [?] Unknown, Not Test ; [-] Not-applicable
= Configuration Required; = Only works with a non-free driver and or firmware
Important Note
Debian on the ?HiFive Unmatched is very new. There are no official images available yet.
* Option 1
You could find some experimental images in (signed with ?Deiv's key):
This images are built with the same instructions in the next section. You just need to decompress them and burn to sd-card.
* Option 2
Or you can download the prebuilt image which can be dd into nvme and/or sd card to boot Debian sid on Unmatched:
?Unmatched Debian prebuilt image built from multistrap, maintianed by vimer <tsu.yubo@gmail.com>
Installing Debian on HiFive
The easiest way at present to run Debian binaries on a ?HiFive is to generate an sdcard image with all the Debian stock parts.
To boot from the SD card, ensure the MSEL[3:0] DIP switches on the board are configured as 1011:
+----------> CHIPIDSEL | +--------> MSEL3 | | +------> MSEL2 | | | +----> MSEL1 | | | | +--> MSEL0 | | | | | +-+-+-+-+-+ | |X| |X|X| ON(1) | | | | | | |X| |X| | | OFF(0) +-+-+-+-+-+ BOOT MODE SEL
If you never touched these switches, this should be the default state.
Preparing disk image
# create image file dd if=/dev/zero of=debian-sid-risc-v-sifive-unmatched.img bs=1M count=4096 # Partition image with correct disk IDs sudo sgdisk -g --clear --set-alignment=1 \ --new=1:34:+1M: --change-name=1:'u-boot-spl' --typecode=1:5b193300-fc78-40cd-8002-e86c45580b47 \ --new=2:2082:+4M: --change-name=2:'opensbi-uboot' --typecode=2:2e54b353-1271-4842-806f-e436d6af6985 \ --new=3:16384:+400M: --change-name=3:'boot' --typecode=3:0x0700 --attributes=3:set:2 \ --new=4:835584:-0 --change-name=4:'rootfs' --typecode=4:0x8300 \ debian-sid-risc-v-sifive-unmatched.img # Mount image in loop device sudo losetup --partscan --find --show debian-sid-risc-v-sifive-unmatched.img # format partitions sudo mkfs.vfat /dev/loop0p3 sudo mkfs.ext4 /dev/loop0p4 sudo e2label /dev/loop0p3 boot sudo e2label /dev/loop0p4 rootfs
Installing debian sid+riscv-port on image
# mount root partition sudo mount /dev/loop0p4 /mnt # install base files sudo apt-get install debootstrap qemu-user-static binfmt-support sudo debootstrap --arch=riscv64 unstable /mnt http://deb.debian.org/debian # mount boot partition sudo mount /dev/loop0p3 /mnt/boot # chroot into base filesystem and made basic configuration sudo chroot /mnt
Inside created chroot:
# Update package information apt-get update # Set up basic networking cat >>/etc/network/interfaces <<EOF auto lo iface lo inet loopback auto end0 iface end0 inet dhcp EOF # Set root password 'sifive' passwd # Change hostname echo unmatched > /etc/hostname # Set up fstab cat > /etc/fstab <<EOF # <file system> <mount point> <type> <options> <dump> <pass> /dev/mmcblk0p4 / ext4 errors=remount-ro 0 1 /dev/mmcblk0p3 /boot vfat nodev,noexec,rw 0 2 EOF # Install kernel and bootloader infrastructure apt-get install linux-image-riscv64 u-boot-menu u-boot-sifive apt-get clean # add needed modules in initrd echo mmc_spi >>/etc/initramfs-tools/modules #update-initramfs -u (TODO: add more space in boot) rm /boot/initrd* update-initramfs -c -k all # Set up u-boot (TODO: better integration for kernel updates) # Should cp your latest dtb file,e.g, cp /usr/lib/linux-image-xx-riscv64 cp /usr/lib/linux-image-5.14.0-3-riscv64/sifive/hifive-unmatched-a00.dtb /boot/ echo U_BOOT_FDT=\"hifive-unmatched-a00.dtb\" >> /etc/default/u-boot echo U_BOOT_PARAMETERS=\"rw rootwait console=ttySIF0,115200 earlycon\" >> /etc/default/u-boot u-boot-update # Install ssh server and ntp apt-get install openssh-server openntpd ntpdate apt-get clean # set the time immediately at startup sed -i 's/^DAEMON_OPTS="/DAEMON_OPTS="-s /' /etc/default/openntpd # exit chroot exit
Once out of chroot:
sudo rm /mnt/root/.bash_history
Setup bootloaders
sudo dd if=/mnt/usr/lib/u-boot/sifive_unmatched/u-boot-spl.bin of=/dev/loop0p1 bs=4k iflag=fullblock oflag=direct conv=fsync status=progress sudo dd if=/mnt/usr/lib/u-boot/sifive_unmatched/u-boot.itb of=/dev/loop0p2 bs=4k iflag=fullblock oflag=direct conv=fsync status=progress
Finish and write image to sdcard
sudo umount /mnt/boot sudo umount /mnt sudo losetup -d /dev/loop0 # take care of writing to the correct sdcard-device sudo dd if=debian-sid-risc-v-sifive-unmatched.img of=/dev/sdcard-device bs=64k iflag=fullblock oflag=direct conv=fsync status=progress
Boot from onboard SPI Flash + NVMe drive
Suppose you now have a working system that boots from the SD card and have installed the u-boot-sifive package:
Make SPI Flash visible
Load the MTD block driver:
sudo modprobe mtdblock
Partition onboard flash
Partition onboard flash (/dev/mtdblock0):
sudo sgdisk -g --clear -a 1 \ --new=1:40:2087 --change-name=1:'u-boot-spl' --typecode=1:5B193300-FC78-40CD-8002-E86C45580B47 \ --new=2:2088:10279 --change-name=2:'opensbi-uboot' --typecode=2:2E54B353-1271-4842-806F-E436D6AF6985 \ --new=3:10280:10535 --change-name=3:'uboot-env' --typecode=3:0FC63DAF-8483-4772-8E79-3D69D8477DE4 \ /dev/mtdblock0
These partition offsets and types must be exact. Notice that they differ slightly from what is required for an SD card.
Setup bootloaders
sudo dd if=/usr/lib/u-boot/sifive_unmatched/u-boot-spl.bin of=/dev/mtdblock0 bs=4096 seek=5 conv=sync status=progress sudo dd if=/usr/lib/u-boot/sifive_unmatched/u-boot.itb of=/dev/mtdblock0 bs=4096 seek=261 conv=sync status=progress
Installing debian sid+riscv-port on nvme drive
Similar to Installing debian sid+riscv-port on image, partitioning the nvme drive, install debian into it and install kernel & other packages using chroot. You may also dd your sd card to nvme drive.
Switch to boot from onboard SPI flash
To boot from the onboard SPI flash (QSPI0 in SiFive's documentation), set MSEL[3:0] to 0110:
+----------> CHIPIDSEL | +--------> MSEL3 | | +------> MSEL2 | | | +----> MSEL1 | | | | +--> MSEL0 | | | | | +-+-+-+-+-+ | | |X|X| | ON(1) | | | | | | |X|X| | |X| OFF(0) +-+-+-+-+-+ BOOT MODE SEL