docker build -t sd-images https://github.com/johang/sd-card-images.git mkdir -p /tmp/sd-images docker run --rm -v /tmp/sd-images:/artifacts sd-images build-boot raspberrypi_3b bcm2837 rpi_3_defconfig aarch64-linux-gnuI have never had any dealings with "docker", but I suppose we can give it a try. He says the above process will leave the boot image in /tmp/sd-images.
su dnf install docker dnf updateThe install removes some selinux files -- which is fine by me, I have selinux disabled.
I do the dnf update simply because things on my system are quite out of date. I will also end up needing to reboot. I get some weird error about Nvidia modules not building properly. I know this has something to do with me installing CUDA development tools on my machine, which have conflicts with the drivers I use to run my system. All this has nothing to do with docker, so we will try to ignore it for now. But it turns ugly. I spend an hour or so getting rid of the entire CUDA package set.
I find this nice tutorial:
Of course all tutorials seem nice at first. I run into my first problem right away:docker run hello-world docker: permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sockIt works as root, which tells me that the docker daemon is running properly. It does go fetch the hello world thing from the "docker hub" for me. Some searching tells me that it is not the best idea to run docker as root. I edit /etc/group and add "tom" to the docker group. I have to log out and back in again for this to take effect. Docker gives me a bunch of tips and suggests trying:
docker run -it ubuntu bashThis pulls an "ubuntu:latest" image from the hub and runs it for me.
docker build -t sd-images https://github.com/johang/sd-card-images.gitThis fails. A look at the error message shows that it is trying to do something with apt-get. I don't know enough to tell if this is simply because I am running on Fedora, or whether it is trying to run things in a debian docker image -- but this is turning into much more of a tangle than I want to dive into. I peek a little more after I clone his repository and see that all this is coming from the "Dockerfile" which seems to specify a ubuntu image. As a Docker beginner, this is above my pay grade.
cd Projects/RK3328 git clone https://github.com/johang/sd-card-images.git cd sd-card-imagesHere is the line he said would build the boot image for a rpi-3:
docker run --rm -v /tmp/sd-images:/artifacts sd-images build-boot raspberrypi_3b bcm2837 rpi_3_defconfig aarch64-linux-gnuI squint at this and see the tail end is the command:
build-boot raspberrypi_3b bcm2837 rpi_3_defconfig aarch64-linux-gnuIn "scripts" is a shell script named "build-boot" that extracts and renames 4 arguments:
BOARD_ID = raspberrypi_3b CHIP_ID = bcm2837 DEFCONFIG = rpi_3_defconfig TUPLE = aarch64-linux-gnuIt then has a long case/switch on CHIP_ID. For a chip that matches "rk*" it invokes:
build-boot-rk "${BOARD_ID}" "${CHIP_ID}" "${DEFCONFIG}" "${TUPLE}"
Also, stepping back a bit. I grep for "3328" and find these lines.
What are these csv files for?
My guess is that he has a top level script that automates the build process
for all the boards in his collection.
boards.csv:orangepi_r1_plus_lts,Orange Pi R1 Plus LTS,Xunlong,rk3328,orangepi-r1-plus-lts-rk3328_defconfig,aarch64-linux-gnu,rk3328-orangepi-r1-plus-lts chips.csv:rk3328,RK3328,Rockchip,ARM Cortex A53,armv8,arm64Squinting at this, I can guess the following:
BOARD_ID = orangepi_r1_plus_lts CHIP_ID = rk3328 DEFCONFIG = orangepi-r1-plus-lts-rk3328_defconfig TUPLE = aarch64-linux-gnuSo, I could invoke "build-boot" as:
build-boot orangepi_r1_plus_lts rk3328 orangepi-r1-plus-lts-rk3328_defconfig aarch64-linux-gnuPoking around yet more I discover docs/_boards/orangepi_r1_plus_lts.md --
# DO NOT EDIT - Generated by rebuild-jekyll-boards layout: board title: Orange Pi R1 Plus LTS SD card images description: "Minimal, pure and up-to-date vanilla Debian/Ubuntu arm64 SD card images for Orange Pi R1 Plus LTS by Xunlong, SoC: Rockchip RK3328, CPU ISA: armv8" board_id: orangepi_r1_plus_lts board_dtb_name: rk3328-orangepi-r1-plus-lts board_name: Orange Pi R1 Plus LTS board_maker_name: Xunlong board_soc_name: Rockchip RK3328 board_cpu_name: ARM Cortex A53 (armv8) board_cpu_arch_isa: armv8 board_cpu_arch_debian: arm64But back in build-boot-rk, I find (more or less):
git clone --depth 1 --reference-if-able https://github.com/rockchip-linux/rkbin.git rkbinI just do this:
cd Projects/RK3328 mkdir sources cd sources git clone https://github.com/rockchip-linux/rkbin.gitThe webpage is here. You can ask google chrome to translate the Chinese for you. As build-boot-rk continue along, it will do these two things for the rk3328:
build-atf "${CHIP_ID}" "${TUPLE}"
export BL31="$PWD/arm-trusted-firmware/build/${CHIP_ID}/debug/bl31/bl31.elf"
build-u_boot "${DEFCONFIG}" "${TUPLE}"
The sources are:
https://github.com/ARM-software/arm-trusted-firmware.git https://source.denx.de/u-boot/u-boot.git/I clone these for now. I am somewhat surprised that the "official" sources for each of these is what is used -- and I am pleased.
cd arm-trusted-firmware make PLAT="rk3328" DEBUG=1 bl31Apparently PLAT is short for "platform". Maybe.
When build-boot-rk is done, it does:
# Copy U-Boot to 64 sectors from start dd if=u-boot/u-boot-rockchip.bin of=tmp.img seek=64 conv=notruncThen back in build-boot, this happens:
truncate -s 32M tmp.img pigz tmp.imgFor now, I just want to peek at the ATF sources (in particular for bl31). I am not yet ready to try to do a build.
Tom's electronics pages / tom@mmto.org