Last active
October 10, 2025 13:03
-
-
Save KevinMX/c8db29302ac7b643a0875c725c957263 to your computer and use it in GitHub Desktop.
RockOS kernel deb and bootloader cross compile (Ubuntu 22.04, Docker)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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 | |
| #In case you want to use GCC 14 | |
| #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 | |
| pushd rockos-kernel | |
| export KDEB_PKGVERSION="$(make kernelversion)-$(date "+%Y.%m.%d.%H.%M")+$(git rev-parse --short HEAD)" | |
| make ${board}_defconfig | |
| make -j$(nproc) dtbs | |
| make -j$(nproc) bindeb-pkg LOCALVERSION="-${board}" | |
| # The debs file will be generated at ../ | |
| popd |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| sudo apt update; sudo apt install -y gdisk g++-12-riscv64-linux-gnu cpp-12-riscv64-linux-gnu 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 | |
| #In case you want to use GCC 14 | |
| #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 config=eic7700_milkv_megrez | |
| export dt=eic7700-milkv-megrez | |
| #See https://github.com/rockos-riscv/rockos-opensbi/blob/rockos-dev/.github/workflows/payload.yml | |
| export CROSS_COMPILE=riscv64-unknown-linux-gnu- | |
| git clone --depth=1 https://github.com/rockos-riscv/rockos-u-boot | |
| pushd rockos-u-boot | |
| make ${config}_defconfig | |
| sed -i "s#eswin/eic7700-evb-a2.dtb#eswin/${dt}.dtb#" .config | |
| make -j$(nproc) | |
| popd | |
| git clone --depth=1 https://github.com/rockos-riscv/rockos-opensbi | |
| pushd opensbi | |
| make PLATFORM=generic FW_PAYLOAD=y \ | |
| FW_FDT_PATH=../rockos-u-boot/u-boot.dtb \ | |
| FW_PAYLOAD_PATH=../rockos-u-boot/u-boot.bin \ | |
| -j $(nproc) | |
| cp -v build/platform/generic/firmware/fw_payload.bin sign/preload | |
| pushd sign/preload | |
| sed -i "s#HOLDER#$(pwd)#g" bootchain.cfg | |
| ../nsign bootchain.cfg | |
| popd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment