diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2023-10-31 16:06:52 +0000 |
---|---|---|
committer | Laurent Bercot <ska@appnovation.com> | 2023-10-31 16:06:52 +0000 |
commit | 77b8f043ffc48226c69f9052eb2cf127b590f7ca (patch) | |
tree | c0c58706f235746383e034e733feaf2171855270 | |
parent | f3cd8ba5db865e204d1dd6bcd9fbbbeaedaeb668 (diff) | |
download | lh-bootstrap-77b8f043ffc48226c69f9052eb2cf127b590f7ca.tar.xz |
Throw out libguestfs, build e2fsprogs and do things by hand again
Signed-off-by: Laurent Bercot <ska@appnovation.com>
-rw-r--r-- | Makefile | 14 | ||||
-rw-r--r-- | README.md | 3 | ||||
-rwxr-xr-x | bin/makeqcow2 | 8 | ||||
-rw-r--r-- | sub/e2fsprogs/Makefile | 38 |
4 files changed, 54 insertions, 9 deletions
@@ -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 @@ -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 $@ |