]> git.plutz.net Git - bootimage/blobdiff - Makefile
scripts for volume setup
[bootimage] / Makefile
index 9b3579004d63ddc815a0325a3888ac0568a0a7b4..5ea6b7c89d90bd0d1daa07a965be32c22b423613 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -9,7 +9,7 @@ CONFIG := config_base/
 
 PACKAGES := apt bilibop-lockfs btrfs-tools busybox-static bzip2 ca-certificates cron deborphan extlinux gzip htop ifupdown init iputils-ping irqbalance isc-dhcp-client less live-boot live-boot-initramfs-tools make man-db nbd-client net-tools nmap ntpdate openssh-client openssh-server p7zip-full pciutils rsync squashfs-tools sshfs sudo systemd unace unrar-free unzip vim wget wireless-tools wpasupplicant xz-utils zip
 
-Include *.mk
+include *.mk
 
 stretch_%_root/bin/sh:
        btrfs subvolume create "$(subst bin/sh,,$@)" || mkdir "$(subst bin/sh,,$@)"
@@ -45,3 +45,19 @@ stretch_%_config/: stretch_%_root/ ${CONFIG} permissions .FORCE
 stretch_%.squashfs: stretch_%_config/
        rm "$@" || true
        mksquashfs "$<" "$@" -comp xz
+
+/dev/sd%: partitions vmlinuz initrd.img syslinux.cfg .FORCE
+       mkdir mount
+       sfdisk ${@} <partitions
+       mkfs.ext3 -L SQUASHBOOT ${@}1
+       mkfs.btrfs -L SQUASHCLIENT ${@}2
+       dd of=${@} if=/usr/lib/syslinux/mbr/mbr.bin
+       mount -t ext3 ${@}1 mount
+       cp -L vmlinuz initrd.img *.squashfs syslinux.cfg mount/
+       cp $(addprefix /usr/lib/syslinux/modules/bios/, menu.c32 libutil.c32) mount/
+       extlinux -i mount/
+       umount mount/
+       mount -t btrfs ${@}2 mount
+       btrfs subvolume create mount/home
+       chmod 0755 mount/home
+       umount mount/