commit 6de534d6edb4b3174053833140f4d6106e110ac9 Author: root Date: Thu Apr 13 18:21:57 2023 +0800 AcoSailV2CrossArm64 inited and tested on localobs diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..540aced --- /dev/null +++ b/Dockerfile @@ -0,0 +1,28 @@ +FROM debian:bullseye-slim + +# Update apt and get crossbuild ENV for arm64; +RUN apt-get update && \ + apt-get install -y crossbuild-essential-arm64 vim + +# Set ENV for crossbuild arm64 app; +ENV CC=aarch64-linux-gnu-gcc +ENV CXX=aarch64-linux-gnu-g++ + +# Make dir for sources' dir in host machine; +RUN mkdir /app +WORKDIR /app + +# Add ARM64 base rootfs into Docker; +ADD ./rootfs_minbase.tar.xz /rootfs + +# Make sure we can qemu arm64 inside Docker; +COPY ./qemu-aarch64-static /usr/bin/qemu-aarch64-static +COPY ./qemu-aarch64-static /rootfs/bin/qemu-aarch64-static + +# Add some tools to make rootfs useble; +RUN chroot /rootfs bash -c "apt update && \ + apt install -y build-essential libncurses5-dev llvm-dev clang cmake " + +# Now we are in AcoSail V2 cross build ENV for arm64. +CMD ["/bin/bash"] + diff --git a/README.md b/README.md new file mode 100644 index 0000000..bac4528 --- /dev/null +++ b/README.md @@ -0,0 +1,55 @@ +# AcoSail V2 ARM64 CROSS build Dockerfile + +Useing AcoSail V2 minibase rootfs with Debian-slim docker-base. +This Docker can be use for crossbuild AcoSail V2 C/C++ cli programs; +And testing the program inside the Docker without a real ARM64 hardware. + +# How to build Docker +~~~bash +sudo docker build -t acosail_v2_cross:1.0 . +~~~ + +# How to RUN this docker for crossbuild +Of cause you need have some crossbuild experience before you using this tool. +You can learn crossbuild on google/github and maybe CSDN. +~~~bash +export PROJECT_DIR +sudo docker run -it --rm -v ${PROJECT_DIR}:/app acosail_v2_cross:1.0 +# Do what ever you want to build an arm64 C/C++ cli program; +# Don't forget to make sure your have set FLAGS -isysroot=/rootfs; +~~~ + +## FAQ for crossbuild +You may find some projects complain about lacking packages ,like libzma-dev; +To fix it, you can do like following: +~~~bash +chroot /rootfs bash +apt update +#apt install lacking packages; +~~~ + +# How to RUN this docker for QEMU arm64 native & VERY SLOW build +~~~bash +export PROJECT_DIR +sudo docker run -it --rm -v ${PROJECT_DIR}:/rootfs/app acosail_v2_cross:1.0 +#Inside docker +chroot /rootfs/app +# Do what you want to build a native arm64 program; +# It can & should be very slow; +~~~ + +# How to test builded app +We suppose you have build your progarms already. +~~~bash +export PROJECT_DIR +sudo docker run -it --rm -v ${PROJECT_DIR}:/rootfs/app acosail_v2_cross:1.0 +#Insdile docker +chroot /rootfs/app +# Do anything you like to run a native program +~~~ + +## FAQ for run app +Your app is run as root user; +You do not have any hardware, so you can't test kernel moudles; +And it can be very slow. + diff --git a/app/test.c b/app/test.c new file mode 100644 index 0000000..df93d8b --- /dev/null +++ b/app/test.c @@ -0,0 +1,6 @@ +#include + +int main() { + printf("corss_build acosail V2 app\n"); + return 0; +} diff --git a/qemu-aarch64-static b/qemu-aarch64-static new file mode 100755 index 0000000..50e2aff Binary files /dev/null and b/qemu-aarch64-static differ diff --git a/rootfs_minbase.tar.xz b/rootfs_minbase.tar.xz new file mode 100644 index 0000000..01437b0 Binary files /dev/null and b/rootfs_minbase.tar.xz differ