Manual Version
Disclaimer
While every effort has been made to ensure accuracy in this document, errors or omissions may still exist. Users should carefully assess its applicability; we reserve the right to make revisions at any time and do not guarantee the validity of content from previous versions. For the latest product information, please regularly visit the official website of LCSC Dev Boards for updated materials. The copyright and final interpretation of this document belong to Shenzhen JLC Technology Group Co.,Ltd. Please take note of this disclaimer and assess the risks independently when making decisions. We are not responsible for any issues arising from the use of this document. Thank you for your understanding and support.
Introduction
When compiling the LCSC Taishan-RK3566-Linux Development Board (Taishan SDK), different computer environments can lead to compilation failures. By using Docker, you can avoid these environment-related issues and greatly increase the likelihood of a successful compilation. This is our recommended method for compiling the Taishan SDK.
Below is a Docker setup that I have tested and used over the long term. I suggest using this approach for compiling the Taishan SDK.
Docker Installation
Uninstall Old Versions
sudo apt-get remove docker docker-engine docker.io containerd runc
Docker Installation Methods [Choose One]
If one method doesn't work, try the other!!
DANGER
📌 Currently, Docker Hub is experiencing issues. It’s uncertain when it will be restored, so you can use the Alibaba Cloud installation method instead.
1. Install Docker Using Docker Repository
First, update the apt package index and install the necessary packages to allow apt to use Docker repository over HTTPS:
sudo apt-get update
sudo apt-get install ca-certificates curl gnupg lsb-release
2
Then, add the official Docker GPG key:
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
2
Set up the repository:
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee -a /etc/apt/sources.list.d/docker.list > /dev/null
2. Install Docker Using Alibaba Cloud
Since Docker Hub images are no longer available, we will switch to using an Alibaba Cloud mirror.
- First, update the apt package index and install necessary packages:
sudo apt-get update
sudo apt-get install ca-certificates curl gnupg lsb-release
2
- Add the Alibaba Cloud Docker GPG key:
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
2
- Add the Alibaba Cloud Docker source:
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
Install Docker Engine
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin
2
Verify Installation
sudo docker -v
# You should see the version number printed
Docker version 24.0.2, build cb74dfc
2
3
Creating an Image
When the image we downloaded from the Docker image repository doesn't meet our needs, we can modify the image in the following two ways:
- Update the image from an already created container and then commit this image.
- Create a new image using Dockerfile instructions.
# Create a directory
root@filex-virtual-machine:/home/LCKFB_RK3566# mkdir docker_lckfb_android_sdk/ # Enter the directory
root@filex-virtual-machine:/home/LCKFB_RK3566# cd docker_lckfb_android_sdk/
# Write the Dockerfile
root@filex-virtual-machine:/home/LCKFB_RK3566/docker_lckfb_android_sdk# vim dockerfile
2
3
4
5
Content of the dockerfile:
# Set the base image to Ubuntu 18.04
FROM ubuntu:18.04
# Set author information
MAINTAINER lckfb "service@lckfb.com"
# Set environment variable for non-interactive installation
ENV DEBIAN_FRONTEND=noninteractive
# Backup the source list file
RUN cp -a /etc/apt/sources.list /etc/apt/sources.list.bak
# Replace http://.*ubuntu.com in the source list with http://repo.huaweicloud.com
RUN sed -i 's@http://.*ubuntu.com@http://repo.huaweicloud.com@g' /etc/apt/sources.list
# Update the package list
RUN apt update
# Install basic build tools and dependencies
RUN apt install -y build-essential crossbuild-essential-arm64 \
bash-completion vim sudo locales time rsync bc python
# Install other required dependencies, this environment is for compiling android11sdk
RUN apt install -y repo git ssh libssl-dev liblz4-tool lib32stdc++6 \
expect patchelf chrpath gawk texinfo diffstat binfmt-support \
qemu-user-static live-build bison flex fakeroot cmake \
unzip device-tree-compiler python-pip ncurses-dev python-pyelftools \
subversion asciidoc w3m dblatex graphviz python-matplotlib cpio \
libparse-yapp-perl default-jre patchutils swig expect-dev u-boot-tools
RUN apt install -y bear
# Update the package list again and install any missing dependencies
RUN apt update && apt install -y -f
# Generate localization language support
RUN locale-gen en_US.UTF-8
ENV LANG en_US.UTF-8
# Create a development board user
RUN useradd -c 'lckfb user' -m -d /home/lckfb -s /bin/bash lckfb
# Set sudo without password login
RUN sed -i -e '/%sudo/ c %sudo ALL=(ALL) NOPASSWD: ALL' /etc/sudoers
RUN usermod -a -G sudo lckfb
USER lckfb # Set the Docker working directory to /home/lckfb
WORKDIR /home/lckfb
# Container uses this kernel method
# docker run --privileged --mount type=bind,source=/home/LCKFB_RK3566/ROCKCHIP_ANDROID11.0_SDK_RELEASE/ROCKCHIP_ANDROID11.0_SDK_RELEASE,target=/home/lckfb/android11 --name="lckfb_android11_sdk" -h lckfb -it lckfb_android11_sdk_cmp
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
Create the Image
# In the directory where the Dockerfile is stored, execute the build action
docker build -t lckfb_android11_sdk_cmp .
# lckfb_android11_sdk_cmp is the name of the image, which can be changed as needed.
# Note that there is a ‘.’ at the end of the command.
# This process may take some time, please be patient.
2
3
4
5
6
WARNING
📌 If you encounter the following error when running docker build -t lckfb_android11_sdk_cmp .: => ERROR [internal] load metadata for docker.io/library/ubuntu:18.04 Please check the common troubleshooting methods at the end!! If an error occurs during image creation, you can test it by running the command below first.
docker run --rm -it Ubuntu 18.04 bash
2
- docker run is the command used to create and run a container.
- The --rm parameter tells Docker to automatically remove the container after it stops. This ensures that no stopped containers are left lingering in the system.
- The -it parameter combines the -i (interactive) and -t (terminal) options, allowing the commands inside the container to receive terminal input and display output.
- <image_name_or_ID> refers to the image based on which you want to create the container. You can provide either the image's name or its ID to uniquely identify it.
- <command_to_run> is the command or instruction that you want to run inside the container.
Viewing Images
root@filex-virtual-machine:/home/EX_DISK_4T_20230726/lckfb_tspi/android11/docker# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
tsp_android11_cmp_img latest 998f0ecd6d5d About a minute ago 1.93GB
lckfb_android11_sdk_cmp latest d8e470a39b2b About a minute ago 1.93GB
2
3
4
Creating a Container Based on an Image
docker run --privileged --mount type=bind,source=/home/wucaicheng/gw_work/EX_DISK_A,target=/home/lckfb --name="lckfb_android11_sdk" -h lckfb -it lckfb_android11_sdk_cmp
--privileged
: Enables privileged mode within the container, allowing processes inside the container to access all host devices.--mount type=bind,source=/home/wucaicheng/gw_work/EX_DISK_A,target=/home/lckfb
:Creates a bind mount, linking the/home/wucaicheng/gw_work/EX_DISK_A
directory on the host to the/home/lckfb
directory inside the container. This allows the applications in the container to access and manipulate the host's directory.--name="lckfb_android11_sdk"
: Assigns a name to the container, allowing it to be referenced in subsequent Docker commands.-h lckfb
: Sets the container's hostname to lckfb.-it
: Runs the container in interactive mode with a terminal, allowing for interaction with the container.lckfb_android11_sdk_cmp
: Uses thelckfb_android11_sdk_cmp
image to create the container.
Listing All Containers
docker ps -a lists all containers, both running and stopped.
docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
7258412811df lckfb_android11_sdk_cmp "/bin/bash" 29 minutes ago Exited (0) 26 minutes ago lckfb_android11_sdk
2
3
- CONTAINER ID: The unique ID of the container.
- IMAGE: The image used for the container.
- COMMAND: The command that was run when the container started.
- CREATED: The time when the container was created.
- STATUS: The current state of the container (e.g., running, stopped).
- PORTS: Information about the container’s port mappings. NAMES: The name of the container.
Starting a Container
docker start lckfb_android11_sdk # Start the container
docker attach lckfb_android11_sdk # Attach to the running container's terminal for interaction
2
Exiting the Container
lckfb@lckfb:~$ exit
Troubleshooting Common Issues
If you encounter the issue shown in the image above, you can modify the/etc/docker/daemon.json
file as follows:
If you are unfamiliar with the vim editor, you can easily learn it through online tutorials. You can get started in 5 minutes.
sudo vi /etc/docker/daemon.json
Then, change the content of the file to:
{
"registry-mirrors": ["https://ccr.ccs.tencentyun.com/"]
}
2
3
Save and exit the file. Next, restart Docker:
sudo systemctl restart docker
Finally, try running the docker build -t lckfb_android11_sdk_cmp .
command again.
You can add sudo in front of the command if you encounter any permission errors. If it works without errors, no need to add sudo.