From a9383e658ed69023b3d621dc08f1c073621d1ff1 Mon Sep 17 00:00:00 2001 From: lonkaars Date: Thu, 1 Feb 2024 19:49:49 +0100 Subject: initial commit --- .gitmodules | 3 +++ Containerfile | 18 ++++++++++++++++++ env | 5 +++++ license | 21 +++++++++++++++++++++ makefile | 42 ++++++++++++++++++++++++++++++++++++++++++ readme.md | 13 +++++++++++++ u-boot | 1 + 7 files changed, 103 insertions(+) create mode 100644 .gitmodules create mode 100644 Containerfile create mode 100644 env create mode 100644 license create mode 100644 makefile create mode 100644 readme.md create mode 160000 u-boot diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..4538f40 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "u-boot"] + path = u-boot + url = https://source.denx.de/u-boot/u-boot.git diff --git a/Containerfile b/Containerfile new file mode 100644 index 0000000..5b98b10 --- /dev/null +++ b/Containerfile @@ -0,0 +1,18 @@ +from ghcr.io/void-linux/void-glibc-full + +# update package manager (needs to be separate) +run xbps-install -Syu xbps +# update entire system +run xbps-install -Syu + +# packages (in separate steps to optimize caching) +run xbps-install -Sy cross-arm-linux-gnueabihf +run xbps-install -Sy make +run xbps-install -Sy git +run xbps-install -Sy gcc +run xbps-install -Sy flex +run xbps-install -Sy openssl-devel + +# container directory on which the working directory on host is mounted +workdir /workdir + diff --git a/env b/env new file mode 100644 index 0000000..e1ff350 --- /dev/null +++ b/env @@ -0,0 +1,5 @@ +#!/bin/sh +# this file should be sourced, not run! +ARCH=arm +CROSS_COMPILE=arm-linux-gnueabihf- + diff --git a/license b/license new file mode 100644 index 0000000..6faf3cf --- /dev/null +++ b/license @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 lonkaars + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/makefile b/makefile new file mode 100644 index 0000000..3bfd896 --- /dev/null +++ b/makefile @@ -0,0 +1,42 @@ +# read environment variables from ./env +include ./env +export + +CTR := sudo -n podman +MOUNT := sudo -n mount +UMOUNT := sudo -n umount +CP := sudo -n cp +GIT := git + +CTR_IMG_TAG := avans-linux +CTRIZE := $(CTR) run --rm --interactive --tty --volume .:/workdir:rw --user $(shell id -u):$(shell id -g) --env-file ./env $(CTR_IMG_TAG) + +.PHONY: all +all: os_bootloader + +.PHONY: container_img +container_img: Containerfile + $(CTR) build --tag $(CTR_IMG_TAG) . + +# this list holds the .git files in each submodule folder (add +# $(SUBMODULE_INIT) as prerequisite to require the submodules to exist) +SUBMODULE_INIT += ./u-boot/.git +$(SUBMODULE_INIT): + $(GIT) submodule init + $(GIT) submodule update + +MKFLAGS += -j $(shell nproc) + +.PHONY: os_bootloader +os_bootloader: container_img $(SUBMODULE_INIT) + $(CTRIZE) make -C u-boot $(MKFLAGS) am335x_evm_config + $(CTRIZE) make -C u-boot $(MKFLAGS) + +# sd card block device (assumed partition numbers, see readme.md) +SDCARD_BD := $(shell realpath /dev/disk/by-id/usb-Generic-_Multi-Card_20071114173400000-0:0) +load_bootloader: $(os_bootloader) + mkdir -p /tmp/sdcard-boot + $(MOUNT) $(SDCARD_BD)1 /tmp/sdcard-boot + $(CP) u-boot/MLO u-boot/u-boot.img u-boot/u-boot.dtb /tmp/sdcard-boot + $(UMOUNT) $(SDCARD_BD)1 + diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..d0d6279 --- /dev/null +++ b/readme.md @@ -0,0 +1,13 @@ +- containers/images worden door rootful podman beheerd, maar het builden zelf + wordt in een geïsoleerde omgeving gedaan, en kan niet de host mollen + +## handmatige configuratie + +### SD kaart partitionering + +- DOS table +- partities: + |#|size|fs|bootable| + |-|-|-|-| + |1|64M|VFAT (W95 FAT32 / LBA)|\*| + |2|\*|ext4|| diff --git a/u-boot b/u-boot new file mode 160000 index 0000000..050a9b9 --- /dev/null +++ b/u-boot @@ -0,0 +1 @@ +Subproject commit 050a9b981d6a835133521b599be3ae189ce70f41 -- cgit v1.2.3