Compile Ubuntu Image from Source Code

This document describes how to compile Ubuntu image from source code.

Preparations

A Ubuntu 22.04 machine

Steps

Step 1. Install dependent 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

Step 2. Obtain the source code

git clone https://github.com/mixtile-rockchip/ubuntu-rockchip.git
cd ubuntu-rockchip

Step 3. All Build

sudo ./build.sh -b mixtile-core3588e -s noble -f desktop

If you only want to compile kernel and uboot, you can use the following command

Only build kernel

sudo ./build.sh -b mixtile-core3588e -s noble -f desktop -ko

Only build uboot

sudo ./build.sh -b mixtile-core3588e -s noble -f desktop -uo

Other build options

Usage: ./build.sh --board=[mixtile-core3588e] --suite=[jammy|noble] --flavor=[server|desktop]

Required arguments:
  -b, --board=BOARD      target board
  -s, --suite=SUITE      ubuntu suite
  -f, --flavor=FLAVOR    ubuntu flavor

Optional arguments:
  -h,  --help            show this help message and exit
  -c,  --clean           clean the build directory
  -ko, --kernel-only     only compile the kernel
  -uo, --uboot-only      only compile uboot
  -ro, --rootfs-only     only build rootfs
  -l,  --launchpad       use kernel and uboot from launchpad repo
  -v,  --verbose         increase the verbosity of the bash script

The generated image file is in the images folder, including xz compressed packages of the desktop version.

images/
├── ubuntu-24.04-preinstalled-desktop-arm64-mixtile-core3588e-rockchip-format.img.xz
├── ubuntu-24.04-preinstalled-desktop-arm64-mixtile-core3588e-rockchip-format.img.xz.sha256
├── ubuntu-24.04-preinstalled-desktop-arm64-mixtile-core3588e.img.xz
└── ubuntu-24.04-preinstalled-desktop-arm64-mixtile-core3588e.img.xz.sha256

ubuntu-24.04-preinstalled-desktop-arm64-mixtile-core3588e.img.xz: the compressed disk image file (img.xz) for Ubuntu 24.04 preinstalled desktop for the Mixtile Core3588E board.

ubuntu-24.04-preinstalled-desktop-arm64-mixtile-core3588e-rockchip-format.img.xz: the compressed disk image file (img.xz) for Ubuntu 24.04 preinstalled desktop specifically tailored for the Mixtile Core3588E board with Rockchip format.

Fore more information, see Mixtile ubuntu-rockchip wiki.

Was this article helpful?

Related Articles