aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile14
-rw-r--r--README.md3
-rwxr-xr-xbin/makeqcow28
-rw-r--r--sub/e2fsprogs/Makefile38
4 files changed, 54 insertions, 9 deletions
diff --git a/Makefile b/Makefile
index 2243070..18a4b2a 100644
--- a/Makefile
+++ b/Makefile
@@ -62,7 +62,7 @@ $(OUTPUT)/tmp/.lh_prepared: lh-config
# This target builds all the build-time native tools, the real part of the build depends on this target
-$(OUTPUT)/build-build/.lh_done: $(OUTPUT)/build-build/.lh_skarnet_installed $(OUTPUT)/build-build/.lh_util-linux_installed $(OUTPUT)/build-build/.lh_kmod_installed
+$(OUTPUT)/build-build/.lh_done: $(OUTPUT)/build-build/.lh_skarnet_installed $(OUTPUT)/build-build/.lh_util-linux_installed $(OUTPUT)/build-build/.lh_kmod_installed $(OUTPUT)/build-build/.lh_e2fsprogs_installed
exec setuidgid $(NORMALUSER) touch $@
@@ -79,13 +79,12 @@ $(OUTPUT)/tmp/.lh_userfs_installed: $(OUTPUT)/tmp/.lh_layout_installed
exec setuidgid $(NORMALUSER) touch $@
-# The qemu disk images (requires qemu and libguestfs-tools)
+# The qemu disk images (requires qemu)
-$(OUTPUT)/tmp/.lh_diskimages_done: $(OUTPUT)/build-$(TRIPLE)/kernel/.lh_modules_installed $(OUTPUT)/tmp/.lh_rootfs_installed $(OUTPUT)/tmp/.lh_rwfs_installed $(OUTPUT)/tmp/.lh_userfs_installed
- virt-make-fs --format=qcow2 --type=ext4 --size=$(ROOTFS_SIZE) $(OUTPUT)/rootfs $(OUTPUT)/rootfs.qcow2 & \
- virt-make-fs --format=qcow2 --type=ext4 --size=$(RWFS_SIZE) $(OUTPUT)/rwfs $(OUTPUT)/rwfs.qcow2 & \
- virt-make-fs --format=qcow2 --type=ext4 --size=$(USERFS_SIZE) $(OUTPUT)/userfs $(OUTPUT)/userfs.qcow2 & wait
- exec chown $(NORMALUSER_UID):$(NORMALUSER_GID) $(OUTPUT)/rootfs.qcow2 $(OUTPUT)/rwfs.qcow2 $(OUTPUT)/userfs.qcow2
+$(OUTPUT)/tmp/.lh_diskimages_done: $(OUTPUT)/build-$(TRIPLE)/kernel/.lh_modules_installed $(OUTPUT)/tmp/.lh_rootfs_installed $(OUTPUT)/tmp/.lh_rwfs_installed $(OUTPUT)/tmp/.lh_userfs_installed | $(OUTPUT)/build-build/.lh_done
+ setuidgid $(NORMALUSER) makeqcow2 $(OUTPUT)/rootfs $(ROOTFS_SIZE) & \
+ setuidgid $(NORMALUSER) makeqcow2 $(OUTPUT)/rwfs $(RWFS_SIZE) & \
+ setuidgid $(NORMALUSER) makeqcow2 $(OUTPUT)/userfs $(USERFS_SIZE) & wait
exec setuidgid $(NORMALUSER) touch $@
qemu-boot:
@@ -99,6 +98,7 @@ qemu-boot:
include sub/kernel/Makefile
include sub/xz/Makefile
include sub/kmod/Makefile
+include sub/e2fsprogs/Makefile
## rootfs contents, what's necessary to get an image to boot and connect to it via ssh
diff --git a/README.md b/README.md
index f84a1b7..201e2c0 100644
--- a/README.md
+++ b/README.md
@@ -124,8 +124,7 @@ you can get a native toolchain [here](https://skarnet.org/toolchains/).
+ `git`
+ a `tar` that supports .gz, .bz2 and .xz archives
+ a `wget` that supports HTTPS
- + `dd`, `chown`, `cpio`
- + `mkfs.ext4`, from e2fsprogs
+ + `dd`, `chown`, `cpio`, `truncate`
+ `qemu-system-$TARGET` to boot your target machine
- A musl cross-development environment from the BUILD machine to the TARGET
diff --git a/bin/makeqcow2 b/bin/makeqcow2
new file mode 100755
index 0000000..2be0468
--- /dev/null
+++ b/bin/makeqcow2
@@ -0,0 +1,8 @@
+#!/bin/sh -e
+
+name="$1"
+size="$2"
+
+truncate -s "$size" "$name".raw
+mkfs.ext4 -b 4096 -d "$name" -F -L `basename "$name"` -O ^huge_file -q -U random "$name".raw
+exec qemu-img convert -f raw -O qcow2 -c -o compression_type=zstd "$name".raw "$name".qcow2
diff --git a/sub/e2fsprogs/Makefile b/sub/e2fsprogs/Makefile
new file mode 100644
index 0000000..116be9b
--- /dev/null
+++ b/sub/e2fsprogs/Makefile
@@ -0,0 +1,38 @@
+
+E2FSPROGS_NAME := e2fsprgs
+E2FSPROGS_VERSION := 1.47.0
+E2FSPROGS_URLDIR := https://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git/snapshot
+E2FSPROGS_TAREXT := tar.gz
+E2FSPROGS_TARLETTER := z
+
+E2FSPROGS_CONFIGURE_OPTIONS := --with-gnu-ld --disable-gtk-doc-html --with-xz --disable-manpages --with-bashcompletiondir=$(OUTPUT)/build-build/opt/$(E2FSPROGS_NAME)-$(E2FSPROGS_VERSION)/bash-completions
+E2FSPROGS_CFLAGS :=
+E2FSPROGS_LDFLAGS := -s -static
+E2FSPROGS_LIBS := -llzma
+
+$(OUTPUT)/sources/$(E2FSPROGS_NAME)-$(E2FSPROGS_VERSION).$(E2FSPROGS_TAREXT): | $(OUTPUT)/tmp/.lh_prepared $(OUTPUT)/build-build/.lh_skarnet_installed
+ exec setuidgid $(NORMALUSER) cd $(OUTPUT)/sources wget $(E2FSPROGS_URLDIR)/$(E2FSPROGS_NAME)-$(E2FSPROGS_VERSION).$(E2FSPROGS_TAREXT)
+
+$(OUTPUT)/sources/.lh_$(E2FSPROGS_NAME)_dled: $(OUTPUT)/sources/$(E2FSPROGS_NAME)-$(E2FSPROGS_VERSION).$(E2FSPROGS_TAREXT) | $(OUTPUT)/build-build/.lh_skarnet_installed
+ exec setuidgid $(NORMALUSER) s6-touch $@
+
+
+$(OUTPUT)/build-build/.lh_$(E2FSPROGS_NAME)_copied: $(OUTPUT)/sources/.lh_$(E2FSPROGS_NAME)_dled | $(OUTPUT)/build-build/.lh_skarnet_installed
+ exec setuidgid $(NORMALUSER) s6-rmrf $(OUTPUT)/build-build/opt/$(E2FSPROGS_NAME)-$(E2FSPROGS_VERSION)
+ exec setuidgid $(NORMALUSER) s6-mkdir -p $(OUTPUT)/build-build/opt/$(E2FSPROGS_NAME)-$(E2FSPROGS_VERSION)
+ exec setuidgid $(NORMALUSER) cd $(OUTPUT)/build-build/opt/$(E2FSPROGS_NAME)-$(E2FSPROGS_VERSION) tar $(E2FSPROGS_TARLETTER)xpvf $(OUTPUT)/sources/$(E2FSPROGS_NAME)-$(E2FSPROGS_VERSION).$(E2FSPROGS_TAREXT)
+ exec setuidgid $(NORMALUSER) s6-rename $(OUTPUT)/build-build/opt/$(E2FSPROGS_NAME)-$(E2FSPROGS_VERSION)/$(E2FSPROGS_NAME)-$(E2FSPROGS_VERSION) $(OUTPUT)/build-build/opt/$(E2FSPROGS_NAME)-$(E2FSPROGS_VERSION)/src
+ exec setuidgid $(NORMALUSER) s6-touch $@
+
+$(OUTPUT)/build-build/.lh_$(E2FSPROGS_NAME)_configured: $(OUTPUT)/build-build/.lh_$(E2FSPROGS_NAME)_copied | $(OUTPUT)/build-build/.lh_skarnet_installed
+ exec setuidgid $(NORMALUSER) cd $(OUTPUT)/build-build/opt/$(E2FSPROGS_NAME)-$(E2FSPROGS_VERSION)/src export CC "$(BUILD_CC)" export LDFLAGS "$(E2FSPROGS_LDFLAGS)" ./configure --prefix=$(OUTPUT)/build-build/opt/$(E2FSPROGS_NAME)-$(E2FSPROGS_VERSION) $(E2FSPROGS_CONFIGURE_OPTIONS)
+ exec setuidgid $(NORMALUSER) s6-touch $@
+
+$(OUTPUT)/build-build/.lh_$(E2FSPROGS_NAME)_built: $(OUTPUT)/build-build/.lh_$(E2FSPROGS_NAME)_configured | $(OUTPUT)/build-build/.lh_skarnet_installed
+ exec setuidgid $(NORMALUSER) cd $(OUTPUT)/build-build/opt/$(E2FSPROGS_NAME)-$(E2FSPROGS_VERSION)/src $(MAKE) "LDFLAGS=$(E2FSPROGS_LDFLAGS)"
+ exec setuidgid $(NORMALUSER) s6-touch $@
+
+$(OUTPUT)/build-build/.lh_$(E2FSPROGS_NAME)_installed: $(OUTPUT)/build-build/.lh_$(E2FSPROGS_NAME)_built | $(OUTPUT)/tmp/.lh_prepared $(OUTPUT)/build-build/.lh_skarnet_installed
+ exec setuidgid $(NORMALUSER) cd $(OUTPUT)/build-build/opt/$(E2FSPROGS_NAME)-$(E2FSPROGS_VERSION)/src $(MAKE) install CC="$(BUILD_CC)"
+ exec setuidgid $(NORMALUSER) makenamelink $(OUTPUT)/build-build/opt $(E2FSPROGS_NAME) $(E2FSPROGS_NAME)-$(E2FSPROGS_VERSION) $(OUTPUT)/tmp
+ exec setuidgid $(NORMALUSER) s6-touch $@