AcoSailV2CrossArm64 inited and tested on localobs
This commit is contained in:
commit
6de534d6ed
28
Dockerfile
Normal file
28
Dockerfile
Normal file
|
@ -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"]
|
||||
|
55
README.md
Normal file
55
README.md
Normal file
|
@ -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.
|
||||
|
6
app/test.c
Normal file
6
app/test.c
Normal file
|
@ -0,0 +1,6 @@
|
|||
#include <stdio.h>
|
||||
|
||||
int main() {
|
||||
printf("corss_build acosail V2 app\n");
|
||||
return 0;
|
||||
}
|
BIN
qemu-aarch64-static
Executable file
BIN
qemu-aarch64-static
Executable file
Binary file not shown.
BIN
rootfs_minbase.tar.xz
Normal file
BIN
rootfs_minbase.tar.xz
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user