Difference between revisions of "RockpiS/dev/Debian"
(→Build kernel) |
|||
Line 73: | Line 73: | ||
Need to checkout branch to '''stable-4.4-rockpis'''. | Need to checkout branch to '''stable-4.4-rockpis'''. | ||
− | Build u-boot with default ''' | + | Build u-boot with default '''rock-pi-s-rk3308_defconfig'''. |
./build/mk-uboot.sh rockpis #For ROCK Pi S | ./build/mk-uboot.sh rockpis #For ROCK Pi S |
Latest revision as of 09:55, 24 September 2021
ROCK Pi S > Development > Build Debian
Contents
Rockchip Debian SDK
Below is the instructions of how to build image for ROCK Pi S on a HOST PC.
Get the source code
You need Git to get multiple git repositories to build the image.
Install Git if you don't have it.
sudo apt-get update sudo apt-get install git
Clone the source code
git clone -b stable-4.4-rockpis https://github.com/radxa/rockchip-bsp.git cd rockchip-bsp git submodule init git submodule update
You will get
build kernel README.md rkbin rootfs u-boot
Directories usage introductions:
- build:
- Some script files and configuration files for building u-boot, kernel and rootfs.
- kernel:
- kernel source code, current version is 4.4.143
- rkbin:
- Prebuilt Rockchip binaries, include first stage loader and ATF(Arm Trustzone Firmware).
- rootfs:
- Bootstrap a Debian based rootfs, support architechture armhf and arm64, support Debian Jessie, Stretch and Buster.
- u-boot:
- u-boot as the second stage bootloader
Update the source code
The rockchip-bsp will be updated all the time, so you can update the source before building the system image.
cd rockchip-bsp git checkout stable-4.4-rockpis git fetch origin git rebase origin/stable-4.4-rockpis git submodule update
Install toolchain from Linaro
wget https://releases.linaro.org/components/toolchain/binaries/7.3-2018.05/aarch64-linux-gnu/gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu.tar.xz sudo tar xvf gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu.tar.xz -C /usr/local/ export CROSS_COMPILE=/usr/local/gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu- export PATH=/usr/local/gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu/bin:$PATH
Check if Linaro toolchain is the default choice:
which aarch64-linux-gnu-gcc /usr/local/gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-gcc
Install other build tools
sudo apt-get install gcc-aarch64-linux-gnu device-tree-compiler libncurses5 libncurses5-dev build-essential libssl-dev mtools sudo apt-get install bc python dosfstools
Build u-boot
Need to checkout branch to stable-4.4-rockpis.
Build u-boot with default rock-pi-s-rk3308_defconfig.
./build/mk-uboot.sh rockpis #For ROCK Pi S
The generated images will be copied to out/u-boot folder
ls out/u-boot/ idbloader.img rk3308_loader_uart0_m0_emmc_port_support_sd_20190717.bin trust.img uboot.img
Build kernel
Need to checkout branch to stable-4.4-rockpis.
Build kernel with default rk3308_linux_defconfig.
./build/mk-kernel.sh rockpis #For ROCK Pi S
Change kernel config(optional)
Optionally, if you want to change the default kernel config
cd kernel export ARCH=arm64 export CROSS_COMPILE=aarch64-linux-gnu- make rk3308_linux_defconfig make menuconfig cd .. ./build/mk-kernel.sh rockpis #For ROCK Pi S
You will get the kernel image and dtb file
ls out/kernel/ Image rk3308-rock-pi-s.dtb
Make rootfs image
Check out the rootfs source. The repository is https://github.com/radxa/rk-rootfs-build.git and the branch is debian.
To build 32bit rootfs:
export ARCH=armhf
To build 64bit rootfs:
export ARCH=arm64
Building a base debian system by ubuntu-build-service from linaro.
cd rootfs sudo apt-get install binfmt-support qemu-user-static cpio gdisk sudo dpkg -i ubuntu-build-service/packages/* # ignore the broken dependencies, we will fix it next step sudo apt-get install -f RELEASE=buster TARGET=desktop ARCH=arm64 ./mk-base-debian.sh
This will bootstrap a Debian Buster image, you will get a rootfs tarball named linaro-buster-alip-xxxx.tar.gz.
Building the rk-debian rootfs.
RELEASE=buster ARCH=arm64 ./mk-rootfs.sh
Creating the ext4 image(linaro-rootfs.img):
./mk-image.sh
Combine everything into one image
build/mk-image.sh -c rk3308 -t system -r rootfs/linaro-rootfs.img
This will combine u-boot, kernel and rootfs into one image and generate GPT partition table. Output is
out/system.img
Flash the image
FAQs
1.I have built one ROCK Pi S system image using rockchip-bsp SDK. With an USB to TTL serial cable connected with UART0 pins (pin#10, pin#8, ping#6 on colorful 26-PIN Header) on ROCK Pi S, the last one line of system logs is shown as follows.
[ 1.072493] bootconsole [uart0] disabled
In fact the system starts up. If your ROCK Pi S system supports Ethernet/WiFi and SSH, you can access ROCK Pi S via SSH.
If you read the kernel command line of system log, you will find that the default console is ttyS0 (1500000n8). But due to uart0 is disabled by default in file rk3308-rock-pi-s.dts, there will be no more system logs on the screen.
To enable console ttyS0, you need to enable uart0 node. Add the following lines at the end of file rk3328-rock-pi-s.dts.
&uart0 { status = "okay"; };
Troubleshooting
Check ROCK Pi S FAQs first, if it doesn't help, start a new post on the forum https://forum.radxa.com/c/rockpiS