Skip to content

Instantly share code, notes, and snippets.

@KevinMX
Last active April 1, 2025 08:21
Show Gist options
  • Save KevinMX/c8db29302ac7b643a0875c725c957263 to your computer and use it in GitHub Desktop.
Save KevinMX/c8db29302ac7b643a0875c725c957263 to your computer and use it in GitHub Desktop.
RockOS kernel deb cross compile (Ubuntu 22.04, Docker)
#!/bin/sh
sudo apt update; sudo apt install -y gdisk dosfstools build-essential \
libncurses-dev gawk flex bison openssl libssl-dev tree \
dkms libelf-dev libudev-dev libpci-dev libiberty-dev autoconf \
device-tree-compiler xz-utils devscripts ccache debhelper asciidoc \
bc rsync cpio bc rsync cpio python3-dev wget
wget https://github.com/riscv-collab/riscv-gnu-toolchain/releases/download/2024.04.12/riscv64-glibc-ubuntu-22.04-gcc-nightly-2024.04.12-nightly.tar.gz
tar xvf riscv64-glibc-ubuntu-22.04-gcc-nightly-2024.04.12-nightly.tar.gz -C /opt
#We're not using GCC 14 for now, GCC 14 related code fixes are done but not yet on the main branch yet
#wget https://github.com/riscv-collab/riscv-gnu-toolchain/releases/download/2025.01.20/riscv64-glibc-ubuntu-22.04-gcc-nightly-2025.01.20-nightly.tar.xz
#tar xvf riscv64-glibc-ubuntu-22.04-gcc-nightly-2025.01.20-nightly.tar.xz -C /opt
export PATH=/opt/riscv/bin:$PATH
export ARCH=riscv
export board=win2030
export CROSS_COMPILE=riscv64-unknown-linux-gnu-
git clone --depth=1 https://github.com/rockos-riscv/rockos-kernel -b branch
pushd rockos-kernel
export KDEB_PKGVERSION="$(make kernelversion)-$(date "+%Y.%m.%d.%H.%M")+$(git rev-parse --short HEAD)"
make win2030_defconfig
make -j$(nproc) dtbs
make -j$(nproc) bindeb-pkg LOCALVERSION="-${board}"
# The debs file will be generated at ../
popd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment