Skip to content

Ubuntu 22.04 (deprecated)

Joshua Riek edited this page Jun 20, 2024 · 1 revision

Building

To to set up the build environment, please use a Ubuntu 22.04 machine, then install the below packages:

sudo apt-get install -y build-essential gcc-aarch64-linux-gnu bison \
qemu-user-static qemu-system-arm qemu-efi u-boot-tools binfmt-support \
debootstrap flex libssl-dev bc rsync kmod cpio xz-utils fakeroot parted \
udev dosfstools uuid-runtime git-lfs device-tree-compiler python2 python3 \
python-is-python3 fdisk bc debhelper python3-pyelftools python3-setuptools \
python3-distutils python3-pkg-resources swig libfdt-dev libpython3-dev

To checkout the source and build:

git clone https://github.com/Joshua-Riek/ubuntu-rockchip.git
cd ubuntu-rockchip
sudo ./build.sh --board=orangepi-5

Modify the Kernel Command Line

  1. Open the ubuntuEnv.txt file: Usually in the /boot/firmware/ directory. You can use a text editor like nano to open the file.
sudo nano /boot/firmware/ubuntuEnv.txt
  1. Add or modify the bootargs= line to include your desired parameters. It usually looks like this:
bootargs=root=UUID=175a64cf-c4ed-40af-8219-664e04c64c19 rootfstype=ext4 rootwait rw console=ttyS2,1500000 console=tty1 cgroup_enable=cpuset cgroup_memory=1 cgroup_enable=memory swapaccount=1 systemd.unified_cgroup_hierarchy=0 
  1. Save the changes and exit the editor. Press ctrl+s to save the file, then press ctrl+x to exit.
  2. Reboot your device to apply the changes.

Device Tree Overlays

  1. Open the ubuntuEnv.txt file: Usually in the /boot/firmware/ directory. You can use a text editor like nano to open the file.
sudo nano /boot/firmware/ubuntuEnv.txt
  1. Add or modify the overlays= line to include your desired overlay. Below is an example using two overlays for the Rock 5B.
overlays=rock-5b-radxa-display-8hd rock-5b-radxa-camera-4k
  1. Save the changes and exit the editor. Press ctrl+s to save the file, then press ctrl+x to exit.
  2. Reboot your device to apply the changes.

Kernel

Install Required Packages

Please install the below packages before compiling the kernel.

sudo apt-get install -y build-essential gcc-aarch64-linux-gnu bison \
qemu-user-static qemu-system-arm qemu-efi u-boot-tools binfmt-support \
debootstrap flex libssl-dev bc rsync kmod cpio xz-utils fakeroot parted \
udev dosfstools uuid-runtime git-lfs device-tree-compiler python2 python3 \
python-is-python3 fdisk bc

Compile the Linux Kernel

  1. Clone the Linux Kernel repository.
git clone -b linux-5.10-gen-rkr6 https://github.com/Joshua-Riek/linux-rockchip.git
  1. Build as a deb package.
cd linux-rockchip
make CROSS_COMPILE=aarch64-linux-gnu- ARCH=arm64 rockchip_linux_defconfig
make KBUILD_IMAGE="arch/arm64/boot/Image" CROSS_COMPILE=aarch64-linux-gnu- ARCH=arm64 -j "$(nproc)" bindeb-pkg

Freeze Kernel Updates

  1. Mark the kernel packages to be held.
sudo apt-mark hold linux-image-5.10.160-rockchip linux-headers-5.10.160-rockchip