Add top-level Makefile

Building the OS is now as simple as running `make` on a Gentoo system.

Interestingly, when `make` is executed as a (grand)child process of
another `make` process, it always prints an `Entering directory ...`
message.  This breaks the `make kernelversion` command, by adding
extraneous text to the output.
gentoo
Dustin 2023-02-13 22:50:59 -06:00
parent f32c6d37a4
commit 1687e615b4
4 changed files with 100 additions and 3 deletions

2
.gitignore vendored
View File

@ -1,3 +1,5 @@
/images
/linux
/output
/.prepared
/.host-tools

95
Makefile Normal file
View File

@ -0,0 +1,95 @@
update.tar: output/update.tar.zstd
.prepared: \
prepare.sh \
config-portage.sh \
setup-local-repo.sh \
$(shell find portage host-portage -type f) \
$(shell find patches/ebuilds -type f)
./prepare.sh
./config-portage.sh
./setup-local-repo.sh
touch .prepared
prepare: .prepared
.host-tools: \
build-host-tools.sh \
.prepared
./build-host-tools.sh
touch .host-tools
host-tools: .host-tools
images/rootfs.squashfs: \
build.sh \
build-rootfs.sh \
build-squashfs.sh \
linux/arch/arm64/boot/Image.gz \
.host-tools \
.prepared
./build.sh
./build-rootfs.sh
./build-squashfs.sh
squashfs: images/rootfs.squashfs
linux/arch/arm64/boot/Image.gz: \
build-kernel.sh \
linux.config \
.host-tools \
.prepared
./build-kernel.sh
kernel: linux/arch/arm64/boot/Image.gz
output/efi-part/EFI/BOOT/BOOTAA64.efi: \
build-grub.sh \
grub.cfg \
.host-tools \
.prepared
./build-grub.sh
grub: output/efi-part/EFI/BOOT/BOOTAA64.efi
output/efi-part/u-boot.bin: \
build-uboot.sh \
u-boot.config
./build-uboot.sh
uboot: output/efi-part/u-boot.bin
images/sdcard.img: \
genimage.cfg \
genimage.sh \
post-build.sh \
output/efi-part/u-boot.bin \
output/efi-part/EFI/BOOT/BOOTAA64.efi
./post-build.sh
./genimage.sh
sdcard.img: images/sdcard.img
images/firmware.img: images/sdcard.img
output/update.tar.zstd: \
images/rootfs.squashfs \
images/firmware.img \
.host-tools \
.prepared
./build-update.sh
clean:
git -C u-boot clean -fdx && git -C u-boot checkout -- .
rm -rf linux output images tmp
rm -f .prepared .host-tools
.PHONY: \
grub \
host-tools \
kernel \
prepare \
sdcard.img \
squashfs \
uboot \
update.tar

View File

@ -15,11 +15,11 @@ cd linux
../linux.config
make -C /usr/src/linux O=${PWD} olddefconfig
make -j$(nproc)
kver=$(make kernelversion)
kver=$(make -s kernelversion)
make modules_install INSTALL_MOD_PATH=/mnt/gentoo
cd -
printf 'Installing Kernel ...\n'
printf 'Installing Kernel %s ...\n' "${kver}"
mkdir -p /mnt/gentoo/boot
cp -au linux/arch/arm64/boot/Image.gz /mnt/gentoo/boot/vmlinuz-${kver}
cp -au linux/.config /mnt/gentoo/boot/config-${kver}

View File

@ -22,7 +22,7 @@ cid=$(podman run \
./patch-uboot.sh
podman exec -it ${cid} ./build-all.sh "${target}"
podman exec -it ${cid} make
podman stop ${cid}
podman rm ${cid}