Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: Use Docker image cross compiling for M1 Mac #81

Merged
merged 1 commit into from
Nov 12, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,15 @@ INITRAMFS_PATH := build/$(IMAGE_FILENAME).initramfs
export INIT_SCRIPT := $(shell tools/inspect-init-in-docker-image.py $(IMAGE))
endif

# Set the platform name for docker image cross compiling.
ifeq ($(ARCH),x64)
docker_platform = linux/amd64
endif

ifeq ($(docker_platform),)
$(error "docker_platform is not set for $(ARCH)!")
endif

topdir := $(PWD)
build_mode := $(if $(RELEASE),release,debug)
target_json := kernel/arch/$(ARCH)/$(ARCH).json
Expand Down Expand Up @@ -171,7 +180,7 @@ clean:
#
build/kerla.initramfs: $(wildcard initramfs/*) $(wildcard initramfs/*/*) Makefile
$(PROGRESS) "BUILD" initramfs
cd initramfs && docker buildx build -t kerla-initramfs .
cd initramfs && docker buildx build --platform $(docker_platform) -t kerla-initramfs .
$(PROGRESS) "EXPORT" initramfs
mkdir -p build
$(PYTHON3) tools/docker2initramfs.py $@ kerla-initramfs
Expand Down