├── .gitignore ├── .gitmodules ├── Dockerfile └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | /files/qtsdk-friendlyelec 2 | .*.swp 3 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "toolchain"] 2 | path = toolchain 3 | url = https://github.com/friendlyarm/prebuilts.git 4 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:18.04 2 | MAINTAINER Lawrence-Tang 3 | 4 | RUN apt-get update 5 | 6 | RUN echo 'tzdata tzdata/Areas select Asia' | debconf-set-selections 7 | RUN echo 'tzdata tzdata/Zones/Asia select Chongqing' | debconf-set-selections 8 | RUN DEBIAN_FRONTEND="noninteractive" apt install -y tzdata 9 | RUN apt-get -y install texinfo 10 | 11 | RUN apt-get -y install bash repo git cvs gzip bzip2 unzip tar perl sudo file time aria2 wget make lsb-release openssh-client vim tree exfat-fuse exfat-utils u-boot-tools mediainfo \ 12 | libncurses5 libncurses5-dev zlib1g-dev gcc g++ gawk patch libasound2-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libxcb-xinerama0 libxcb-xinerama0-dev \ 13 | libopenal-dev libalut-dev libpulse-dev libuv1-dev libmicrohttpd-dev libssl-dev bridge-utils ifplugd \ 14 | libbluetooth3-dev libjpeg8 libjpeg8-dev libjpeg-turbo8 libjpeg-turbo8-dev libvpx-dev \ 15 | libgtk2.0-dev libnss3 libgconf-2-4 gconf2 gconf2-common libx11-dev libxext-dev libxtst-dev \ 16 | libxrender-dev libxmu-dev libxmuu-dev libxfixes-dev libxfixes3 libpangocairo-1.0-0 \ 17 | libpangoft2-1.0-0 libdbus-1-dev libdbus-1-3 libusb-0.1-4 libusb-dev \ 18 | bison build-essential gperf flex ruby python libasound2-dev libbz2-dev libcap-dev \ 19 | libcups2-dev libdrm-dev libegl1-mesa-dev libgcrypt11-dev libnss3-dev libpci-dev libpulse-dev libudev-dev \ 20 | libxtst-dev gyp ninja-build \ 21 | libssl-dev libxcursor-dev libxcomposite-dev libxdamage-dev libxrandr-dev \ 22 | libfontconfig1-dev libxss-dev libsrtp0-dev libwebp-dev libjsoncpp-dev libopus-dev libminizip-dev \ 23 | libavutil-dev libavformat-dev libavcodec-dev libevent-dev libcups2-dev libpapi-dev \ 24 | gcc-aarch64-linux-gnu g++-aarch64-linux-gnu gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf \ 25 | qemu-user-static debootstrap whiptail bsdtar bc device-tree-compiler \ 26 | swig python-dev python3-dev liblz4-tool mercurial subversion asciidoc w3m \ 27 | dblatex graphviz python-matplotlib genext2fs lib32stdc++6 28 | 29 | # libc6-dev-i386 30 | # packages for rk linux-sdk 31 | RUN apt-get -y install expect expect-dev mtools libusb-1.0-0-dev linaro-image-tools python-linaro-image-tools \ 32 | autoconf autotools-dev libsigsegv2 m4 intltool curl sed binutils libqt4-dev libglib2.0-dev \ 33 | libglade2-dev 34 | RUN apt-get -y install kmod cpio rsync patchelf live-build 35 | 36 | # musl-dev 37 | RUN apt-get -y install musl-dev 38 | RUN ln -s /usr/lib/x86_64-linux-musl/libc.so /lib/libc.musl-x86_64.so.1 39 | 40 | # misc tools 41 | RUN apt-get -y install net-tools silversearcher-ag strace 42 | 43 | # for sd_fuse 44 | RUN apt-get -y install parted udev android-tools-fsutils 45 | 46 | # for menuconfig 47 | RUN apt-get -y install libncurses* 48 | 49 | # install friendlyarm-toolchain 50 | COPY ./toolchain/gcc-x64 /gcc-x64 51 | RUN echo "> install friendlyarm-toolchain"; \ 52 | cat /gcc-x64/toolchain-4.9.3-armhf.tar.gz* | tar xz -C /; \ 53 | cat /gcc-x64/toolchain-6.4-aarch64.tar.gz* | tar xz -C /; \ 54 | rm -rf /gcc-x64; 55 | 56 | RUN echo "root:fa" | chpasswd 57 | RUN groupadd -g 1000 ubuntu 58 | RUN useradd -rm -d /home/ubuntu -s /bin/bash -g root -G sudo -u 1000 ubuntu 59 | RUN echo "ubuntu:fa" | chpasswd 60 | 61 | RUN mkdir -p /opt/work-tzs 62 | RUN chown ubuntu /opt/work-tzs 63 | 64 | USER root 65 | WORKDIR /root 66 | 67 | RUN echo "all done." 68 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## **FriendlyELEC-Ubuntu18-Docker** 2 | 3 | This docker image provide a base build environment for cross-compiling your code. 4 | 5 | Can be used to compile the following projects: 6 | * Qt5.10 project 7 | * Linux kernel 8 | * U-boot 9 | * Android 7 10 | * Android 8 11 | * FriendlyWrt 12 | * Rockchip Linuxsdk (buildroot) 13 | 14 | Build docker image with toolchain 15 | ------------ 16 | 17 | Download the qt-sdk package from the following url: 18 | http://dl.friendlyarm.com/qt-sdk-friendlyelec 19 | 20 | Once you've done that then: 21 | ``` 22 | git clone --recursive https://github.com/friendlyarm/friendlyelec-ubuntu18-docker.git 23 | docker build -t "fa-ubuntu18" friendlyelec-ubuntu18-docker 24 | ``` 25 | 26 | Run 27 | ------------ 28 | Enter docker shell: 29 | ``` 30 | docker run --name fa-ubuntu18 --privileged -it -v /tmp:/tmp -v /dev:/dev -v ~/work:/work fa-ubuntu18 bash 31 | ``` 32 | * This will mount the local ~/work directory to the container's /work directory. 33 | * Prepare for packing img, mount the loop device (Optional). 34 | 35 | User accounts in the docker container 36 | ------------ 37 | Non-root User: 38 | ``` 39 | User Name: ubuntu 40 | Password: fa 41 | ``` 42 | Root: 43 | ``` 44 | User Name: root 45 | Password: fa 46 | ``` 47 | Install the Qt SDK for Rockchip in the Docker container 48 | ------------ 49 | Mount the qt-5.10-rockchip directory which in the netdrive to the container: 50 | ``` 51 | docker run --name fa-ubuntu18 --privileged \ 52 | -it -v /tmp:/tmp -v /dev:/dev -v ~/work:/work \ 53 | -v /path/to/netdrive/04_SDK\ and\ toolchain/qt-5.10-rockchip:/qt-5.10-rockchip \ 54 | fa-ubuntu18 bash 55 | ``` 56 | In the container,execute the following commands: 57 | ``` 58 | cd /qt-5.10-rockchip 59 | chmod 755 install.sh 60 | ./install.sh 61 | ``` 62 | 63 | Save docker container state 64 | ------------ 65 | Open another shell terminal on the host PC and enter the following commands: 66 | ``` 67 | CONTAINER_ID=`docker ps -l | grep fa-ubuntu18 | awk '{print $1}'` 68 | docker commit ${CONTAINER_ID} fa-ubuntu18 69 | ``` 70 | 71 | Start a new shell session 72 | ------------ 73 | ``` 74 | CONTAINER_ID=`docker ps -l | grep fa-ubuntu18 | awk '{print $1}'` 75 | docker exec -it ${CONTAINER_ID} bash 76 | ``` 77 | 78 | Test the Qt sdk installation: Cross compile qt application 79 | ------------ 80 | ``` 81 | git clone https://github.com/friendlyarm/QtE-Demo 82 | mkdir build && cd build 83 | /usr/local/Trolltech/Qt-5.10.0-rk64one-sdk/bin/qmake ../QtE-Demo/QtE-Demo.pro 84 | make 85 | scp build/QtE-Demo root@BOARDIP:/tmp/ 86 | ``` 87 | Run QtE-Demo on target board: 88 | ``` 89 | . setqt5env 90 | /tmp/QtE-Demo 91 | ``` 92 | More details: 93 | http://wiki.friendlyarm.com/wiki/index.php/How_to_Build_and_Install_Qt_Application_for_FriendlyELEC_Boards 94 | 95 | 96 | Compile Kernel4.4 (for RK3399 FriendlyCore/FriendlyDesktop/Lubuntu/EFlasher) 97 | ------------ 98 | ``` 99 | cd /work/ 100 | git clone https://github.com/friendlyarm/kernel-rockchip --depth 1 -b nanopi4-linux-v4.4.y kernel-rockchip 101 | cd kernel-rockchip 102 | make ARCH=arm64 nanopi4_linux_defconfig 103 | export PATH=/opt/FriendlyARM/toolchain/6.4-aarch64/bin/:$PATH 104 | make ARCH=arm64 nanopi4-images CROSS_COMPILE=aarch64-linux-gnu- -j$(nproc) 105 | ``` 106 | 107 | Compile U-boot (for RK3399 FriendlyCore/FriendlyDesktop/Lubuntu/EFlasher) 108 | ------------ 109 | ``` 110 | cd /work 111 | git clone https://gitlab.com/friendlyelec/rk3399-nougat --depth 1 -b nanopc-t4-nougat 112 | cd rk3399-nougat/u-boot 113 | make CROSS_COMPILE=aarch64-linux- rk3399_defconfig 114 | export PATH=/opt/FriendlyARM/toolchain/6.4-aarch64/bin/:$PATH 115 | make CROSS_COMPILE=aarch64-linux- -j$(nproc) 116 | ``` 117 | 118 | Build LinuxSdk (buildroot for rk3399) 119 | ------------ 120 | ``` 121 | mkdir -p /work/ubuntu 122 | chown ubuntu /work/ubuntu 123 | su ubuntu #switch to non-root user 124 | cd /work/ubuntu 125 | tar xvf /work/linuxsdk-friendlyelec-20211119.tar 126 | cd linuxsdk-friendlyelec 127 | .repo/repo/repo sync -l --no-clone-bundle 128 | (cd pre-download && ./unpack.sh) 129 | ./build.sh kernel 130 | ./build.sh uboot 131 | ./build.sh rootfs 132 | ./build.sh sd-img 133 | ``` 134 | * Here it is assumed that you have downloaded linuxsdk-friendlyelec-20211119.tar from netdisk to the ~/work directory of Host PC. 135 | 136 | Build FriendlyWrt (For NanoPi-R4S) 137 | ------------ 138 | ``` 139 | mkdir -p /work/ubuntu 140 | chown ubuntu /work/ubuntu 141 | su ubuntu #switch to non-root user 142 | cd /work/ubuntu 143 | tar xvf /work/friendlywrt-rk3399-kernel5-20211031.tar 144 | cd friendlywrt-rk3399-kernel5 145 | .repo/repo/repo sync --no-clone-bundle # update working tree to the latest revision 146 | (cd pre-download/ && ./unpack.sh) 147 | ./build.sh nanopi_r4s.mk 148 | ``` 149 | * Here it is assumed that you have downloaded friendlywrt-rk3399-kernel5-20211031.tar from netdisk to the ~/work directory of Host PC. 150 | 151 | Creating firmware with sd-fuse 152 | ------------ 153 | ``` 154 | cd /work 155 | git clone https://github.com/friendlyarm/sd-fuse_rk3399 156 | cd sd-fuse_rk3399 157 | ./mk-emmc-image.sh friendlydesktop-arm64 158 | ``` 159 | 160 | Rebuild docker image and container 161 | ------------ 162 | ``` 163 | docker rmi fa-ubuntu18 -f 164 | docker rm fa-ubuntu18 -f 165 | docker build -t "fa-ubuntu18" friendlyelec-ubuntu18-docker 166 | ``` 167 | 168 | Currently supported boards 169 | ------------ 170 | * RK3399 171 | NanoPi R4S 172 | NanoPC T4 173 | NanoPi M4 174 | NanoPi NEO4 175 | Som-RK3399 176 | * RK3328 177 | NanoPi R2S 178 | NanoPi R2C 179 | NanoPi NEO3 180 | 181 | Resources 182 | ------------ 183 | * How to Install and Use Docker on Ubuntu 18.04 184 | https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-18-04 185 | * How to Build and Install Qt Application for FriendlyELEC Boards 186 | https://wiki.friendlyarm.com/wiki/index.php/How_to_Build_and_Install_Qt_Application_for_FriendlyELEC_Boards 187 | * How to Build FriendlyWrt 188 | https://wiki.friendlyarm.com/wiki/index.php/How_to_Build_FriendlyWrt 189 | 190 | 191 | ## License 192 | 193 | The MIT License (MIT) 194 | Copyright (C) 2021 FriendlyELEC 195 | 196 | Permission is hereby granted, free of charge, to any person obtaining a copy 197 | of this software and associated documentation files (the "Software"), to deal 198 | in the Software without restriction, including without limitation the rights 199 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 200 | copies of the Software, and to permit persons to whom the Software is 201 | furnished to do so, subject to the following conditions: 202 | 203 | The above copyright notice and this permission notice shall be included in 204 | all copies or substantial portions of the Software. 205 | 206 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 207 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 208 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 209 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 210 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 211 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 212 | THE SOFTWARE. 213 | --------------------------------------------------------------------------------