Skip to content

Commit

Permalink
Merge pull request #6 from FyraLabs/fix-arm64
Browse files Browse the repository at this point in the history
Fix arm64
  • Loading branch information
WeirdTreeThing authored Jan 27, 2024
2 parents f4dd060 + 897d2a0 commit 1ee9076
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ jobs:
- name: Install dependencies
run: |
dnf5 update -y
dnf5 install -y git make gcc ccache flex bison elfutils-devel parted vboot-utils golang xz bc tar openssl-devel
dnf5 install -y git make gcc ccache flex bison elfutils-devel parted vboot-utils golang xz bc tar openssl-devel python3-pip uboot-tools
pip3 install depthcharge-tools
- uses: actions/checkout@v3
with:
Expand Down
22 changes: 17 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ IMG_A64=$(project_name)-a64.bin

.PHONY: usage

ifeq ($(shell uname -m), x86_64)
CROSS=aarch64-linux-gnu-
endif

usage:
@echo "usage: make [x86_64|arm64]"

Expand All @@ -44,6 +48,7 @@ $(KPART_X64): $(BZIMAGE_X64)

$(BZIMAGE_X64): $(INITFSZ_X64)
cp $(CONFDIR)/$(CONFIG_X64) kernel/.config
make -C kernel olddefconfig
make -C kernel
cp kernel/arch/x86/boot/bzImage $(WORKDIR)/$(BZIMAGE_X64)

Expand All @@ -58,23 +63,30 @@ $(INITFS_X64):
# Use 'make arm64' to build ARM64 (cross-compiling is supported).
arm64: $(IMG_A64)
$(IMG_A64): $(KPART_A64)
fallocate -l 18M $(WORKDIR)/$(IMG_A64)
fallocate -l 69M $(WORKDIR)/$(IMG_A64)
parted $(WORKDIR)/$(IMG_A64) mklabel gpt --script
cgpt add -i 1 -t kernel -b 2048 -s 32767 -P 15 -T 1 -S 1 $(WORKDIR)/$(IMG_A64)
cgpt add -i 1 -t kernel -b 2048 -s 131068 -P 15 -T 1 -S 1 $(WORKDIR)/$(IMG_A64)
dd if=$(WORKDIR)/$(KPART_A64) of=$(WORKDIR)/$(IMG_A64) bs=512 seek=2048 conv=notrunc
cp $(WORKDIR)/$(IMG_A64) $(OUTPUTDIR)/$(IMG_A64)
@echo 'Build complete! Resulting file saved as "$(IMG_A64)" in "images" directory.'

$(KPART_A64): $(BZIMAGE_A64)
echo $(project_name) > $(TMPFILE)
futility vbutil_kernel --pack $(WORKDIR)/$(KPART_A64) --signprivate /usr/share/vboot/devkeys/kernel_data_key.vbprivk --keyblock /usr/share/vboot/devkeys/kernel.keyblock --config $(TMPFILE) --bootloader $(TMPFILE) --vmlinuz $(WORKDIR)/$(BZIMAGE_A64) --version 1 --arch arm64
depthchargectl build -v \
--board arm64-generic \
--kernel $(WORKDIR)/$(BZIMAGE_A64) \
--fdtdir $(WORKDIR)/dtbs \
--root none \
--kernel-cmdline "console=tty0" \
--output $(WORKDIR)/$(KPART_A64)
mkdir -p $(OUTPUTDIR)
cp $(WORKDIR)/$(KPART_A64) $(OUTPUTDIR)/$(KPART_A64)
@echo 'Kernel partition binary saved as "$(KPART_A64)" in "images" directory.'

$(BZIMAGE_A64): $(INITFSZ_A64)
cp $(CONFDIR)/$(CONFIG_A64) kernel/.config
[ $(shell uname -m) = x86_64 ] && ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- make -C kernel || make -C kernel
CROSS_COMPILE=$(CROSS) ARCH=arm64 make -C kernel olddefconfig
CROSS_COMPILE=$(CROSS) ARCH=arm64 make -C kernel
CROSS_COMPILE=$(CROSS) ARCH=arm64 make -C kernel dtbs_install INSTALL_DTBS_PATH=../$(WORKDIR)/dtbs
cp kernel/arch/arm64/boot/Image.gz $(WORKDIR)/$(BZIMAGE_A64)

$(INITFSZ_A64): $(INITFS_A64)
Expand Down

0 comments on commit 1ee9076

Please sign in to comment.