X-Git-Url: http://git.plutz.net/?a=blobdiff_plain;f=Makefile;h=453fa6af0fe4c3f48a31251b0903fcae49c223ff;hb=e926f81d2b0222eb366b13d0ef5634b1590d3b81;hp=8da2961171dc795d65fbe15b80f4517561a26eba;hpb=3e76c50ac86d1546c8e063c5511ad0e87db1593a;p=blast diff --git a/Makefile b/Makefile index 8da2961..453fa6a 100644 --- a/Makefile +++ b/Makefile @@ -68,7 +68,7 @@ else ifdef image VOLUME := ${image} PBOOT := part_boot.img PROOT := part_root.img - SYSROOT := sys_root_${release}/ + SYSROOT := sys_root_${release}_${ARCH}/ CFGROOT := img_mount/ _target: _mbr _umount _config _install @@ -86,9 +86,23 @@ else ifdef image _umount: _img_mount _config _bootloader_pc _mbr: _partcopy _bootloader_pc +else ifdef subvol + SYSROOT := sys_root_${release}_${ARCH}/ + CFGROOT := cfg_root/ + + _target: _install _config ${subvol} + + _bootstrap: + _install: _bootstrap + _copy: _install + _config: _copy + + ${subvol}: _config + btrfs sub snap "${CFG_ROOT}" "$@" + else ifdef squash SQUASH := ${squash} - SYSROOT := sys_root_${release}/ + SYSROOT := sys_root_${release}_${ARCH}/ CFGROOT := cfg_root/ PACKAGES += squashfs-tools nbd-client @@ -104,7 +118,7 @@ else ifdef squash else ifdef iso ISO := ${iso} ISOROOT := iso_root/ - SYSROOT := sys_root_${release}/ + SYSROOT := sys_root_${release}_${ARCH}/ CFGROOT := cfg_root/ BOOT_MB := 2 PBOOT := ${ISOROOT}/efi.img @@ -118,21 +132,18 @@ else ifdef iso _copy: _install _config: _copy _squash_modules _isosquash: _config -# ${PBOOT}: ${ISOROOT} -# _format_boot: ${PBOOT} -# _efi_mount: ${PBOOT} _format_boot -# _efi_umount: _config _bootloader_iso: _config _iso_image: _bootloader_iso _isosquash # _efi_umount else ifdef raspi + ARCH := armhf + VOLUME := ${raspi} PBOOT := rpi_boot.img PROOT := rpi_root.img - SYSROOT := rpi_root_${release}/ + SYSROOT := sys_root_${release}_${ARCH}/ CFGROOT := img_mount/ - ARCH := armhf KEYRING := keys/raspbian-archive-keyring.gpg BOOTSTRAP := http://raspbian.raspberrypi.org/raspbian @@ -141,8 +152,8 @@ else ifdef raspi deb http://archive.raspberrypi.org/debian ${release} main endef - PACKAGES += firmware-brcm80211 libraspberrypi-bin libraspberrypi0 pi-bluetooth raspberrypi-bootloader raspberrypi-kernel initramfs-tools nilfs-tools - fstype := nilfs2 + PACKAGES += firmware-brcm80211 libraspberrypi-bin libraspberrypi0 pi-bluetooth raspberrypi-bootloader raspberrypi-kernel initramfs-tools btrfs-tools + fstype := btrfs _target: _umount _config @@ -157,7 +168,7 @@ else ifdef raspi _copy: _install _img_mount _config: _copy _img_mount _bootloader_raspi: _img_mount - _umount: _img_mount _config _bootloader_raspi + _umount: _copy _config _bootloader_raspi else _target: @@ -178,15 +189,11 @@ endif export SOURCES SYSROOT CFGROOT VOLUME PBOOT PROOT SQUASH ARCH KEYRING BOOTSTRAP ISOROOT ISO -sys_root_${release}/: - btrfs subvol create "$@" || mkdir "$@" - chmod 755 "$@" - -rpi_root_${release}/: +sys_root_${release}_${ARCH}/: btrfs subvol create "$@" || mkdir "$@" chmod 755 "$@" -cfg_root/: sys_root_${release}/ _install +cfg_root/: sys_root_${release}_${ARCH}/ _install -btrfs sub del "$@" || rm -r "$@" btrfs sub snap "$<" "$@" || mkdir "$@" chmod 755 "$@" @@ -249,6 +256,7 @@ _install: ${SYSROOT} _aptkeys _norecommends chroot "$${SYSROOT}" rm /usr/sbin/udevadm _copy: ${SYSROOT} ${CFGROOT} + sync cp -au "$${SYSROOT}/." "$${CFGROOT}/" _config: ${CFGROOT} @@ -302,7 +310,7 @@ _sparse: ${PBOOT} ${PROOT} ifdef raspi _format_root: ${PROOT} -umount "$${CFGROOT}/boot" "$${CFGROOT}" "${PROOT}" - mkfs.nilfs2 -f -L FSROOT "$${PROOT}" + mkfs.${fstype} -f -L FSROOT "$${PROOT}" else _format_root: ${PROOT} -umount "$${CFGROOT}/boot" "$${CFGROOT}" "${PROOT}" @@ -387,6 +395,7 @@ _efi_mount: ${PBOOT} mount -t vfat -o loop "$${PBOOT}" "efi/" _efi_umount: _efi_mount + sync umount efi/ && rmdir efi/ .PHONY: _syslinux_mbr _grub_mbr @@ -430,10 +439,12 @@ _img_mount: ${CFGROOT} || mount -o loop,offset=2M,sizelimit=${BOOT_MB}M \ -t vfat "$${VOLUME}" "$${CFGROOT}/boot" -_umount_boot: ${CFGROOT} +_umount_boot: ${CFGROOT} _config + sync -umount "$${CFGROOT}/boot" -_umount_root: _umount_boot +_umount_root: _umount_boot _config + sync umount "$${CFGROOT}" && rmdir "$${CFGROOT}" _umount: _umount_boot _umount_root @@ -448,8 +459,7 @@ clean: -rmdir hdd_mount if [ -d "cfg_root/" ]; then btrfs sub del "cfg_root/" || rm -r "cfg_root/"; fi if [ -d "iso_root/" ]; then btrfs sub del "iso_root/" || rm -r "iso_root/"; fi - if [ -d "sys_root_${release}/" ]; then btrfs sub del "sys_root_${release}/" || rm -r "sys_root_${release}/"; fi - if [ -d "rpi_root_${release}/" ]; then btrfs sub del "rpi_root_${release}/" || rm -r "rpi_root_${release}/"; fi + if [ -d "sys_root_${release}_${ARCH}/" ]; then btrfs sub del "sys_root_${release}_${ARCH}/" || rm -r "sys_root_${release}_${ARCH}/"; fi -rm part_boot.img -rm part_root.img -rm rpi_boot.img