aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2024-02-04 17:46:44 +0100
committerlonkaars <loek@pipeframe.xyz>2024-02-04 18:31:36 +0100
commit9a993336835d38600fd740af01af6e68bf9f1af7 (patch)
tree8ba790eb002a0134b37d0a7ca901ba3964a10771
parent8742d700e6dd3efd7063c0aa31117bc4bbf7d868 (diff)
linux kernel booting
-rw-r--r--makefile33
-rw-r--r--readme.md18
-rwxr-xr-xutil/part2
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
+<!-- in de onderstaande bron wordt mkfs.ext4 met de optie
+ -O ^metadata_csum,^64bit
+gebruikt omdat de versie van u-boot die de persoon in deze discussie gebruikt
+deze niet ondersteunt. ik weet nog niet of ik deze optie nodig heb, dus ik laat
+deze link hier even achter als bladwijzer. -->
+[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