Allwinner D1 docker buildroot environment construction

development environment

  1. We use dongshannezha STU development board for development
  2. A PC or cloud server with ubuntu24 installed

Install docker

sudo apt-get remove docker docker-engine docker.io containerd runc
sudo apt-get update
sudo apt-get install ca-certificates curl gnupg lsb-release apt-transport-https software-properties-common -y
curl -fsSL http://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add –
sudo add-apt-repository “deb [arch=amd64] http://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable”
sudo apt-get install docker-ce docker-ce-cli containerd.io -y
sudo usermod -aG docker $USER
sudo apt-get install docker-compose -y

Create working directory

mkdir -p ~/work/Nezha-D1/docker-env
cd ~/work/Nezha-D1/docker-env
touch Docckerfile docker-compose.yml
cp /etc/ssl/certs/ca-certificates.crt ./

Create nezha d1 development container

The content of the Dockerfile script is as follows:

# 1. 基础镜像:使用Ubuntu 18.04FROM ubuntu:18.04 # 

2. Set maintainer information LABEL maintainer=”[email protected]” 

# 3. Change the source (optional, but recommended) to speed up downloading

#RUN sed -i ‘s/archive.ubuntu.com/mirrors.aliyun.com/g’ /etc/apt/sources.list && #    sed -i ‘s/security.ubuntu.com/mirrors.aliyun.com/g’ /etc/apt/sources.list 

# 4. Set environment variables

ENV DEBIAN_FRONTEND=noninteractiveENV LANG=C.UTF-8ENV TZ=Asia/Shanghai 

# 5. Install basic tools

RUN apt-get update && apt-get install -y –no-install-recommends tzdata  curl  wget vim git net-tools iputils-ping build-essential libncurses5-dev flex bison git subversion  mercurial gettext pkg-config patch cpio python3 unzip rsync wget libssl-dev bc file android-tools-mkbootimg dosfstools mtools 

COPY ./ca-certificates.crt /etc/ssl/certs/ 

#RUN apt-get install -y which sed make binutils build-essential  gcc g++ bash patch gzip bzip2 perl  tar cpio unzip rsync file  bc wget python ncurses5  bazaar cvs git mercurial  scp subversion android-tools-mkbootimg 

RUN ln -fs /usr/share/zoneinfo/${TZ} /etc/localtime     && echo ${TZ} > /etc/timezone     && dpkg-reconfigure –frontend noninteractive tzdata     && apt-get clean     && rm -rf /var/lib/apt/lists/*  

# 6. Set working directory

WORKDIR /root 

# 7. Default command

CMD [“/bin/bash”] 

—————————————————————————————–file end——————————————————————————————————————————————————————————————-file begin———————————————————————————————–


docker-compose.yml脚本如下

services:  nezha: 

  #image: my-ubuntu18-nezhad1-env:latest    

  build:      context: ./      dockerfile: Dockerfile    stdin_open: true                 # 代表 docker run -i    tty: true                        # 代表 docker run -t    container_name: nezhad1-ubuntu18-env    restart: always    volumes:      – type: bind        source: ./work        target: /root/work        consistency: cached—————————————————————————————–file end————————————————————————————————– 

Use the docker compose up -d command to build a development container environment 

Use the following command to enter the container environment

docker exec -it nezhad1-ubuntu18-env /bin/bash

Download the buildroot source code and compile with default configuration

mkdir -p ~/work/Neza-D1 && cd ~/work/Neza-D1/
git clone https://gitee.com/weidongshan/neza-d1-buildroot.git buildroot-2021
cd buildroot-2021
make nehza-d1_deconfig
make BRJLEVEL=N(N<=2xCPU数量)

However, the following error will occur in the cross-compilation tool chain

git clone https://e.coding.net/weidongshan/Tina-D1/Toolchain.git
cp Toolchain/riscv64-glibc-gcc-thead_20200702.tar.xz dl/toolchain-external-custom/
make BRJLEVEL=N(N<=2xCPU数量)

What follows is a long wait (it’s time to fish and drink tea)

The SD card image file sdcard.img is located in the output directory. Use balena-etcher to burn it into the SD card. Insert the SD card into the development board and power on to open the serial port.