Difference between revisions of "Linux BSP User Guide for rk3288 series Debian9"
Yunjin.jiang (talk | contribs) |
|||
(33 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
== Linux BSP Version == | == Linux BSP Version == | ||
+ | |||
+ | We have two versions for rk3288 series. | ||
+ | |||
+ | '''V2.1 :''' | ||
Debian 9 stretch<br/>Linux version 4.4.143 | Debian 9 stretch<br/>Linux version 4.4.143 | ||
+ | |||
+ | '''V230 :''' | ||
+ | |||
+ | Debian 10 buster<br/>Linux version 4.4.194 | ||
== Get Docker Image == | == Get Docker Image == | ||
− | <pre>$ sudo docker pull advrisc/u16.04-rk3288lbv1</pre> | + | |
+ | If you don't have docker in your system, then you can follow the below steps to install docker and run it first. | ||
+ | |||
+ | '''To install Docker Engine on your platform''' | ||
+ | |||
+ | Please refer to [https://docs.docker.com/engine/installation/ Docker Installation Guide] for details | ||
+ | |||
+ | '''To pull [https://hub.docker.com/r/advrisc/u16.04-rk3288lbv1/ ubuntu 16.04 image from Docker Hub] ''' | ||
+ | <pre>$ sudo docker pull advrisc/u16.04-rk3288lbv1 | ||
+ | $ sudo apt-get update | ||
+ | $ sudo apt-get install binfmt-support qemu-user-static</pre> | ||
== Config Docker == | == Config Docker == | ||
Line 22: | Line 40: | ||
<span style="color:#FF0000;">'''Note :'''</span> | <span style="color:#FF0000;">'''Note :'''</span> | ||
− | After run the above two commands, you will work in | + | After run the above two commands, you will work in docker workspace . |
− | You can get debian source code and build them in | + | You can get debian source code and build them in docker workspace. |
− | == | + | == Getting Debian Source Code == |
− | + | '''V2.1 :''' | |
<pre>$ cd ~/code | <pre>$ cd ~/code | ||
− | $ sudo git clone https://github.com/ | + | $ sudo git clone https://github.com/ADVANTECH-Rockchip/repo.git |
$ mkdir rk3288_debian | $ mkdir rk3288_debian | ||
$ cd rk3288_debian | $ cd rk3288_debian | ||
Line 38: | Line 56: | ||
$ ../repo/repo sync | $ ../repo/repo sync | ||
$ ../repo/repo forall -c git checkout -b local --track advantech-github/rk3288_linux_v2.0 | $ ../repo/repo forall -c git checkout -b local --track advantech-github/rk3288_linux_v2.0 | ||
+ | $ | ||
+ | $ sudo dpkg -i rootfs/ubuntu-build-service/packages/* | ||
+ | $ sudo apt-get install -f</pre> | ||
+ | |||
+ | '''V230 :''' | ||
+ | <pre>$ cd ~/code | ||
+ | $ sudo git clone https://github.com/ADVANTECH-Rockchip/repo.git | ||
+ | $ mkdir rk3288_debian | ||
+ | $ cd rk3288_debian | ||
+ | $ git config --global user.name "Your Name" | ||
+ | $ git config --global user.email you@example.com | ||
+ | $ ../repo/repo init -u https://github.com/ADVANTECH-Rockchip/linux-manifest.git -b rk3288_linux_v230_risc -m default.xml | ||
+ | $ ../repo/repo sync | ||
+ | $ ../repo/repo forall -c git checkout -b local --track advantech-github/rk3288_linux_v230_risc | ||
$ | $ | ||
$ sudo dpkg -i rootfs/ubuntu-build-service/packages/* | $ sudo dpkg -i rootfs/ubuntu-build-service/packages/* | ||
Line 45: | Line 77: | ||
=== Build RSB-4680 U-boot === | === Build RSB-4680 U-boot === | ||
+ | |||
+ | '''V2.1 :''' | ||
<pre>$ export TOP=`pwd` | <pre>$ export TOP=`pwd` | ||
$ cd $TOP | $ cd $TOP | ||
Line 52: | Line 86: | ||
</pre> | </pre> | ||
− | + | '''V230 :''' | |
<pre>$ export TOP=`pwd` | <pre>$ export TOP=`pwd` | ||
$ cd $TOP | $ cd $TOP | ||
$ cd u-boot/ | $ cd u-boot/ | ||
− | $ ./make.sh | + | $ ./make.sh rk3288_rsb4680a3_2G |
− | + | </pre> | |
− | |||
− | |||
− | |||
− | |||
== <br/>Build Kernel == | == <br/>Build Kernel == | ||
Line 70: | Line 100: | ||
$ cd kernel/ | $ cd kernel/ | ||
$ make ARCH=arm rk3288_adv_defconfig | $ make ARCH=arm rk3288_adv_defconfig | ||
− | $ make ARCH=arm rk3288-rsb4680-a3.img -j12 | + | $ make ARCH=arm rk3288-rsb4680-a3.img -j12 |
− | + | </pre> | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | === | + | === === |
− | |||
− | |||
− | |||
− | |||
== Build Recovery == | == Build Recovery == | ||
<pre>$ cd $TOP | <pre>$ cd $TOP | ||
$ rm buildroot/output/rockchip_rk3288_recovery -rf | $ rm buildroot/output/rockchip_rk3288_recovery -rf | ||
− | $ source envsetup.sh | + | $ source envsetup.sh rockchip_rk3288_recovery |
$ ./build.sh recovery | $ ./build.sh recovery | ||
</pre> | </pre> | ||
Line 94: | Line 115: | ||
== Build Rootfs == | == Build Rootfs == | ||
+ | |||
+ | '''V2.1 :''' | ||
<pre>$ cd $TOP | <pre>$ cd $TOP | ||
$ cd rootfs/ | $ cd rootfs/ | ||
Line 99: | Line 122: | ||
$ sudo ARCH=armhf ./mk-adv.sh | $ sudo ARCH=armhf ./mk-adv.sh | ||
$ sudo ./mk-image.sh</pre> | $ sudo ./mk-image.sh</pre> | ||
+ | |||
+ | '''V230:''' | ||
+ | <pre>$ cd $TOP | ||
+ | $ sudo BUILD_IN_DOCKER=TRUE ./mk-debian.sh | ||
+ | </pre> | ||
== Creating the ext4 image == | == Creating the ext4 image == | ||
<pre>$ cd $TOP | <pre>$ cd $TOP | ||
+ | $ source envsetup.sh rockchip_rk3288_recovery | ||
$ sudo ./mkfirmware.sh | $ sudo ./mkfirmware.sh | ||
</pre> | </pre> | ||
Line 133: | Line 162: | ||
root 123456 | root 123456 | ||
− | == < | + | === Build toolchain === |
+ | |||
+ | To build a toolchain | ||
+ | <pre>$ cd ~/RSB4680_CODEBSAE/ | ||
+ | $ source buildroot/build/envsetup.sh rockchip_rk3288 | ||
+ | $ make | ||
+ | </pre> | ||
+ | The toolchain will be generated here<pre>$ ~/RSB4680_CODEBSAE/ | ||
+ | buildroot/output/rockchip_rk3288/host/arm-buildroot-linux-gnueabihf/ | ||
+ | </pre> | ||
+ | |||
+ | == Initramfs == | ||
+ | |||
+ | 1). Get a sample inittamfs rootfs | ||
+ | <pre>$ git clone https://github.com/TeeFirefly/initrd.git </pre> | ||
+ | |||
+ | 2). Make a cpio format gziped file | ||
+ | <pre>$ cd initrd | ||
+ | $ find . | cpio -o -H newc | gzip > ../initramfs_data.cpio.gz | ||
+ | </pre> | ||
+ | |||
+ | 3). Copy "initramfs_data.cpio.gz" to ~/KERNEL_SRC/usr/ | ||
+ | |||
+ | 4). Add config CONFIG_INITRAMFS_SOURCE="usr/initramfs_data.cpio.gz" on rk3288_adv_defconfig | ||
+ | |||
+ | 5). Rebuild boot image | ||
+ | |||
+ | If you'd like to modify initramfs rootfs | ||
+ | <pre>$ zcat initramfs_data.cpio.gz | cpio -i -d -H newc --no-absolute-filenames </pre> | ||
+ | |||
+ | |||
+ | |||
+ | You can point CONFIG_INITRAMFS_SOURCE to a folder directly also | ||
+ | |||
+ | 1). Get a sample inittamfs rootfs | ||
+ | <pre>$ git clone https://github.com/TeeFirefly/initrd.git </pre> | ||
+ | |||
+ | 2). CONFIG_INITRAMFS_SOURCE="../../initrd/" | ||
+ | |||
+ | 3). Rebuild boot image | ||
+ | |||
+ | PS : | ||
+ | |||
+ | 1). Find a init in the initramfs is not thing to do with kernel cmdline "root=". | ||
− | + | 2). This init inside the initrd.git will be triggered and boot the system completed. You may add anything you want to this rootfs. |
Latest revision as of 03:35, 1 April 2022
Contents
Linux BSP Version
We have two versions for rk3288 series.
V2.1 :
Debian 9 stretch
Linux version 4.4.143
V230 :
Debian 10 buster
Linux version 4.4.194
Get Docker Image
If you don't have docker in your system, then you can follow the below steps to install docker and run it first.
To install Docker Engine on your platform
Please refer to Docker Installation Guide for details
To pull ubuntu 16.04 image from Docker Hub
$ sudo docker pull advrisc/u16.04-rk3288lbv1 $ sudo apt-get update $ sudo apt-get install binfmt-support qemu-user-static
Config Docker
$ mkdir -p ~/work/code/rk3288_debian $ sudo docker run -it --name rk3288_linux --privileged -v ~/work/code/rk3288_debian:/home/adv/code:rw advrisc/u16.04-rk3288lbv1:latest /bin/bash $ exit //This command run in dock workspace. It means exit dock workspace to host workspace.
Note :
The above commands only need run in the first time .
Start Docker
$ sudo docker start rk3288_linux $ sudo docker attach rk3288_linux
Note :
After run the above two commands, you will work in docker workspace .
You can get debian source code and build them in docker workspace.
Getting Debian Source Code
V2.1 :
$ cd ~/code $ sudo git clone https://github.com/ADVANTECH-Rockchip/repo.git $ mkdir rk3288_debian $ cd rk3288_debian $ git config --global user.name "Your Name" $ git config --global user.email you@example.com $ ../repo/repo init -u https://github.com/ADVANTECH-Rockchip/linux-manifest.git -b rk3288_linux_v2.0 -m default.xml $ ../repo/repo sync $ ../repo/repo forall -c git checkout -b local --track advantech-github/rk3288_linux_v2.0 $ $ sudo dpkg -i rootfs/ubuntu-build-service/packages/* $ sudo apt-get install -f
V230 :
$ cd ~/code $ sudo git clone https://github.com/ADVANTECH-Rockchip/repo.git $ mkdir rk3288_debian $ cd rk3288_debian $ git config --global user.name "Your Name" $ git config --global user.email you@example.com $ ../repo/repo init -u https://github.com/ADVANTECH-Rockchip/linux-manifest.git -b rk3288_linux_v230_risc -m default.xml $ ../repo/repo sync $ ../repo/repo forall -c git checkout -b local --track advantech-github/rk3288_linux_v230_risc $ $ sudo dpkg -i rootfs/ubuntu-build-service/packages/* $ sudo apt-get install -f
Build U-boot
Build RSB-4680 U-boot
V2.1 :
$ export TOP=`pwd` $ cd $TOP $ cd u-boot/ $ ./make.sh rsb4680a3-2G-rk3288
V230 :
$ export TOP=`pwd` $ cd $TOP $ cd u-boot/ $ ./make.sh rk3288_rsb4680a3_2G
Build Kernel
Build RSB-4680 Kernel
$ cd $TOP $ cd kernel/ $ make ARCH=arm rk3288_adv_defconfig $ make ARCH=arm rk3288-rsb4680-a3.img -j12
Build Recovery
$ cd $TOP $ rm buildroot/output/rockchip_rk3288_recovery -rf $ source envsetup.sh rockchip_rk3288_recovery $ ./build.sh recovery
NOTE:
For recovery.img includes kernel and recovery tools, kernel MUST be built before recovery.
Build Rootfs
V2.1 :
$ cd $TOP $ cd rootfs/ $ sudo ARCH=armhf ./mk-rootfs.sh $ sudo ARCH=armhf ./mk-adv.sh $ sudo ./mk-image.sh
V230:
$ cd $TOP $ sudo BUILD_IN_DOCKER=TRUE ./mk-debian.sh
Creating the ext4 image
$ cd $TOP $ source envsetup.sh rockchip_rk3288_recovery $ sudo ./mkfirmware.sh
NOTE:
If there is no error, the following ten files will be found in $TOP/rockdev/ :
boot.img MiniLoaderAll.bin misc.img oem.img parameter.txt recovery.img rootfs.img trust.img uboot.img userdata.img
How to do about update RK3288 Platform?
There are two ways to update images :
Android Tool
Update image through AndroidTool
SD card
NOTE :
This way only support Linux(Debian9) upgrade to Linux(Debian9) 、 Android6.0 upgrade to Android6.0 or Android8.1 upgrade to Android8.1.
If the device is in Android, you want to upgrade to Linux(Debian9), please use Android Tool.
User and password
Here are default user and password:
linaro 123456
root 123456
Build toolchain
To build a toolchain
$ cd ~/RSB4680_CODEBSAE/ $ source buildroot/build/envsetup.sh rockchip_rk3288 $ makeThe toolchain will be generated here
$ ~/RSB4680_CODEBSAE/ buildroot/output/rockchip_rk3288/host/arm-buildroot-linux-gnueabihf/
Initramfs
1). Get a sample inittamfs rootfs
$ git clone https://github.com/TeeFirefly/initrd.git
2). Make a cpio format gziped file
$ cd initrd $ find . | cpio -o -H newc | gzip > ../initramfs_data.cpio.gz
3). Copy "initramfs_data.cpio.gz" to ~/KERNEL_SRC/usr/
4). Add config CONFIG_INITRAMFS_SOURCE="usr/initramfs_data.cpio.gz" on rk3288_adv_defconfig
5). Rebuild boot image
If you'd like to modify initramfs rootfs
$ zcat initramfs_data.cpio.gz | cpio -i -d -H newc --no-absolute-filenames
You can point CONFIG_INITRAMFS_SOURCE to a folder directly also
1). Get a sample inittamfs rootfs
$ git clone https://github.com/TeeFirefly/initrd.git
2). CONFIG_INITRAMFS_SOURCE="../../initrd/"
3). Rebuild boot image
PS :
1). Find a init in the initramfs is not thing to do with kernel cmdline "root=".
2). This init inside the initrd.git will be triggered and boot the system completed. You may add anything you want to this rootfs.