From 9a993336835d38600fd740af01af6e68bf9f1af7 Mon Sep 17 00:00:00 2001 From: lonkaars Date: Sun, 4 Feb 2024 17:46:44 +0100 Subject: linux kernel booting --- makefile | 33 +++++++++++++++------------------ readme.md | 18 ++++++++++++++++++ util/part | 2 +- 3 files changed, 34 insertions(+), 19 deletions(-) diff --git a/makefile b/makefile index f29ed2a..e7b7356 100644 --- a/makefile +++ b/makefile @@ -3,12 +3,7 @@ ifneq ($(shell id -u),0) AS_ROOT := sudo -n endif -MOUNT := $(AS_ROOT) mount -UMOUNT := $(AS_ROOT) umount - CTR := podman -CP := cp -GIT := git CTR_IMG_TAG := avans-linux @@ -30,9 +25,9 @@ $(eval $(shell state/gen)) include ./env export -# shortcuts .PHONY: all -all: $(BOOTLOADER_FILES) +all: + .PHONY: sd_format sd_partition sd_format: state/sdcard_fmt sd_partition: state/sdcard_part @@ -42,7 +37,7 @@ state/container_img: Containerfile touch $@ state/submodules: - $(GIT) submodule update --init + git submodule update --init touch $@ state/sdcard_part: @@ -51,8 +46,8 @@ state/sdcard_part: state/sdcard_fmt: state/sdcard_part $(eval $(shell state/gen)) - $(AS_ROOT) mkfs.vfat -n BOOT -F 32 $(SDCARD_PART_BOOT) - $(AS_ROOT) mkfs.ext4 -L ROOTFS -F $(SDCARD_PART_ROOTFS) + $(AS_ROOT) mkfs.vfat -a -F 16 -n BOOT $(SDCARD_PART_BOOT) + $(AS_ROOT) mkfs.ext4 -F -L ROOTFS $(SDCARD_PART_ROOTFS) touch $@ bootloader/.config: state/submodules state/container_img @@ -60,38 +55,40 @@ bootloader/.config: state/submodules state/container_img .PHONY: build_bootloader build_bootloader: bootloader/.config state/container_img $(CTRIZE) $(MAKE) -C bootloader +# NOTE: MLO MUST be copied first +BOOTLOADER_FILES += bootloader/MLO BOOTLOADER_FILES += bootloader/u-boot.img BOOTLOADER_FILES += bootloader/u-boot.dtb -BOOTLOADER_FILES += bootloader/MLO $(BOOTLOADER_FILES): build_bootloader kernel/.config: state/submodules state/container_img $(CTRIZE) $(MAKE) -C kernel bb.org_defconfig .PHONY: build_kernel build_kernel: kernel/.config state/container_img - $(CTRIZE) $(MAKE) -C kernel zImage + $(CTRIZE) $(MAKE) -C kernel zImage am335x-boneblack.dtb KERNEL_FILES += kernel/arch/$(ARCH)/boot/dts/am335x-boneblack.dtb KERNEL_FILES += kernel/arch/$(ARCH)/boot/zImage $(KERNEL_FILES): build_kernel +# NOTE: ordering is important! FILES_PART_BOOT += $(BOOTLOADER_FILES) FILES_PART_BOOT += $(KERNEL_FILES) .PHONY: load_boot load_rootfs load_boot: $(FILES_PART_BOOT) state/sdcard_fmt mkdir -p mnt/boot - $(MOUNT) $(SDCARD_PART_BOOT) mnt/boot - $(AS_ROOT) $(CP) $(FILES_PART_BOOT) mnt/boot + $(AS_ROOT) mount $(SDCARD_PART_BOOT) mnt/boot + $(AS_ROOT) cp $(FILES_PART_BOOT) mnt/boot $(AS_ROOT) sync - $(UMOUNT) mnt/boot + $(AS_ROOT) umount mnt/boot # TODO # FILES_PART_ROOTFS += .... load_rootfs: state/sdcard_fmt mkdir -p mnt/rootfs - $(MOUNT) $(SDCARD_PART_ROOTFS) mnt/rootfs - $(AS_ROOT) $(CP) $(FILES_PART_ROOTFS) mnt/boot + $(AS_ROOT) mount $(SDCARD_PART_ROOTFS) mnt/rootfs + $(AS_ROOT) cp $(FILES_PART_ROOTFS) mnt/boot $(AS_ROOT) sync - $(UMOUNT) mnt/rootfs + $(AS_ROOT) umount mnt/rootfs .PHONY: status status: diff --git a/readme.md b/readme.md index 4a79680..a0d2242 100644 --- a/readme.md +++ b/readme.md @@ -24,3 +24,21 @@ make status - `git` - geduld +# de afwijkingen + +- de makefile formatteert de BOOT partitie als FAT16 zonder alignment. dit + stond [hier][vanleeuwen-uboot], en werkte voor mij, terwijl FAT32 met + alignment niet werkte en alleen `CCCCCC` opleverde. +- deze repository gebruikt BeagleBoard's fork van Linux inplaats van de + upstream Linux kernel. dit is niet alleen makkelijker, maar zorgt er ook voor + dat er geen firmware blobs voor andere kernel versies gebruikt hoeven te + worden. + +[vanleeuwen-uboot]: https://blog.billvanleeuwen.ca/porting-u-boot-onto-the-beaglebone + +[digikey-ext4opt]: https://forum.digikey.com/t/debian-getting-started-with-the-beaglebone-black/12967 + diff --git a/util/part b/util/part index ea4e62b..a57f3e5 100755 --- a/util/part +++ b/util/part @@ -20,7 +20,7 @@ set -e sfdisk "$SDCARD_DISK" << 'EOF' label: dos -,64M,0C,* +,64M,0E,* ,+ ,83, EOF -- cgit v1.2.3