building kernel for scaleway riscv

building node sysprep

apt install \
    build-essential flex bison libssl-dev bc libelf-dev libncurses-dev \
    curl \
    file \
    git \
    htop \
    ifupdown-ng ifupdown-ng-compat \
    manpages man-db \
    net-tools \
    plocate \
    screen \
    wget \
    u-boot-tools \
    xz-utils

# pahole

kernel build

git clone --depth=1 https://github.com/revyos/th1520-linux-kernel.git
git branch -a
git switch th1520-mainline
ls -lhF arch/riscv/boot/dts/thead/*cluster*
make revyos_defconfig
cat >> .config <<EOF
CONFIG_OCFS2_FS=m
CONFIG_GFS2_FS=m
CONFIG_GFS2_FS_LOCKING_DLM=y
CONFIG_DLM=m
CONFIG_DEBUG_INFO_BTF=n
EOF
make olddefconfig
grep GFS2_FS_LOCKING_DLM .config
screen -S build

time make -j4 > ../linux.log && echo BUILT

# default branch 238m9.809s ~ 3 hours

time make modules_install >/dev/null && echo DEPLOYED
cd ../

git clone https://github.com/revyos/thead-opensbi.git
cd thead-opensbi/
time make PLATFORM=generic -j4 > ../thead-opensbi.log && echo BUILT
cd ../

ln -s th1520-linux-kernel linux
ln -s thead-opensbi opensbi

git clone https://github.com/scaleway/em-rv1.git
cd em-rv1/fit/

ls -lhF ../../linux/arch/riscv/boot/dts/thead/*cluster*
vi em-rv1-c4m16s128-a-boot.its

    fdt {
    ...
        data = /incbin/("../../linux/arch/riscv/boot/dts/thead/th1520-lichee-cluster-4a-16g.dtb");

build the FIT

mv /boot/boot.itb /boot/boot.itb.bak
mkimage -f em-rv1-c4m16s128-a-boot.its /boot/boot.itb

check you’ve got the right kernel within

sha256sum ../../linux/arch/riscv/boot/Image

and reboot

reboot

HOME | GUIDES | LECTURES | LAB | SMTP HEALTH | HTML5 | CONTACT
Copyright © 2024 Pierre-Philipp Braun