Compile Debian 11 From Source Code
It is suggested to use Ubuntu, the distribution version of Linux, to compile Debian firmware. To compile Debian firmware, you need to build a suitable environment on Ubuntu PC as required.
1. Preparation to Compile
Recommended computer configuration as below:
64-bit CPU (Open System Setting –> About –> xx-bit system to check this)
16GB physical memory + swap memory (Open System Setting –> About –> xx memory to check this)
250GB of free disk space (Open terminal –> type “df -h” command to check this) The official recommendation is the Ubuntu 20.04 operating system. (Open System Setting –> About –> System Version to check this)
2. Checkout code
git clone https://github.com/mixtile-rockchip/build.git
cd build
3. Checkout LFS
git lfs fetch && git lfs checkout
4. Install dependencies
sudo apt-get update && sudo apt-get upgrade -y
sudo apt-get install -y git ssh make gcc libssl-dev \
liblz4-tool expect g++ patchelf chrpath gawk texinfo \
chrpath diffstat software-properties-common bison flex \
fakeroot cmake gcc-multilib g++-multilib unzip device-tree-compiler \
libncurses-dev python3-pip python3-pyelftools bc make build-essential \
libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl \
llvm libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev \
liblzma-dev uuid-dev lzma-dev liblzma-dev libbluetooth-dev python-parted-doc \
u-boot-tools sudo time rsync libmpc-dev bsdmainutils python2 xz-utils
5. Install PPA dependencies
sudo apt-get update && sudo apt-get install -y binfmt-support qemu-user-static live-build
6. Install debian_prepare
sudo cp debian-rk3588.tar.gz /opt/ && sudo tar -xvf debian-rk3588.tar.gz -C /opt/ && \
sudo apt-get update && sudo apt-get install -y xxd && \
sudo chmod a+x debian_prepare.sh && sudo ./debian_prepare.sh
7. Install repo
mkdir -p ~/.bin && \
sudo curl https://storage.googleapis.com/git-repo-downloads/repo -o ~/.bin/repo && \
sudo cp ~/.bin/repo /usr/bin/repo && sudo chmod a+x /usr/bin/repo
8. Download code
repo init -u https://github.com/mixtile-rockchip/manifests.git -b master -m mixtile_edge2_release.xml && \
repo sync
9. Build image
echo '19' > input.txt && \
echo '8' >> input.txt && \
sudo ./build.sh chip < input.txt && sudo rm input.txt && \
sudo ./build.sh all
10. Build output
Directory: output/update/Image
.
├── boot.img -> ../../../kernel/boot.img
├── MiniLoaderAll.bin -> ../../../u-boot/rk356x_spl_loader_v1.18.112.bin
├── oem.img -> ../../firmware/oem.img
├── package-file
├── parameter.txt -> ../../../device/rockchip/.chips/rk3566_rk3568/parameter-buildroot-fit.txt
├── recovery.img -> ../../recovery/ramboot.img
├── rootfs.img -> ../../../debian/linaro-rootfs.img
├── uboot.img -> ../../../u-boot/uboot.img
├── update.img
├── update.raw.img
└── userdata.img -> ../../firmware/userdata.img
update.img is rockchip-format image.
update.raw.img is raw-format image.