- # Optional file to set variables also possible to pass in environment:
- # * http_proxy - proxy URL (for APT), e.g. http://example.net:9999/
- # * apt_cacher_host - apt-cacher host (for all downloads), e.g. example.net
- # * approx_host - approx host (for all downloads), e.g. example.net
- # * noscreen - set to "true" to use default (serial) instead of HDMI+USB
- # * noquiet - set to "true" to not quiet down default boot messages
- # * nogfx - set to "true" to minimize video buffers
- # * bootargs - set custom bootargs, e.g. BOOT_DEBUG=5 log_host=example.org preseed/interactive=true
- # * fakeroot - command used for faked root (set empty to not fake root)
- # * sudo - command used for real root (leave empty to not switch to root)
- # * eatmydata - avoid fsync (set empty to not use)
- # * linux - custom kernel: colon-separated suite and version
- -include local.mk
- suites = stretch buster sid
- archs = armhf
- devicetypes-armhf = lime lime2 micro
- nodes := $(patsubst nodes/%.yml,%,$(wildcard nodes/*.yml))
- profiles-di = $(foreach suite,$(suites),\
- $(patsubst %,content/%-$(suite)/preseed.cfg,$(subst -,/,$(nodes))))
- profiles-script = $(patsubst %/preseed.cfg,%/script.sh,$(profiles-di))
- profiles = $(profiles-di) $(profiles-script)
- mdfiles = content/MD5SUMS
- shafiles = $(patsubst %,content/SHA%SUMS,1 256 512)
- checksumfiles = $(mdfiles) $(shafiles)
- signfiles = $(patsubst %,%.sig,$(checksumfiles))
- info = content/NEWS content/TODO
- info += content/index.html content/style.css
- title := $(shell grep -Pom1 '^\# \K.*[^\# ]+' README)
- LINUX_SUITE = $(word 1,$(subst :, ,$(linux)))
- LINUX_VERSION = $(word 2,$(subst :, ,$(linux)))
- #installsuite-stretch = $(if $(foobar),buster))
- #installsuite-stretch-reason = $(if $(foobar),foobar broken with stretch))
- # * d-i releases require an archive with same-ABI kernel.
- # * d-i rejects non-stable snapshot older than 1 month: bug#771699
- #time-stretch-reason = bug\#771699
- #snapshot-buster-di = 20170127
- #snapshot-buster-kernel = 4.9.0-1
- # if no newer snapshot available for sid, reuse stretch hints
- #time-sid-reason = $(time-buster-reason)
- snapshot-sid-di = $(snapshot-buster-di)
- snapshot-sid-kernel = $(snapshot-buster-kernel)
- #snapshot-sid-archive = $(snapshot-buster-archive)
- #snapshot-sid-reason = $(snapshot-buster-reason)
- #time-sid = $(time-buster)
- this-partdir = imageparts/$(or $(installsuite-$(1):%=$(1)-%),$(1))
- this-vendordir = $(foreach suite-di,$(or $(installsuite-$(1)),$(1)),$(strip \
- vendor/$(or $(snapshot-$(suite-di)-di:%=$(suite-di)-%),$(suite-di))))
- this-snapshot = $(snapshot-$(or $(installsuite-$(1)),$(1))-archive)
- this-snapshot-kernel = $(snapshot-$(or $(installsuite-$(1)),$(1))-kernel)
- this-snapshot-reason = $(snapshot-$(or $(installsuite-$(1)),$(1))-reason)
- proxy = $(or $(http_proxy),$(apt_cacher_host:%=http://%:3142/),$(approx_host:%=http://%:9999/))
- this-repo = $(or $(http_proxy:%/=%),$(apt_cacher_host:%=http://%:3142/$(1)),$(approx_host:%=http://%:9999),http://$(1))$(2)
- this-installsuite-warn = \
- WARNING:Installer $(installsuite-$(1)) used for target $(1)$(if $(installsuite-$(1)-reason),\
- ($(installsuite-$(1)-reason))).\n
- this-snapshot-warn = \
- WARNING: Install uses snapshot archive$(if $(call this-snapshot-reason,$(1)),\
- ($(call this-snapshot-reason,$(1)))).\n$(if $(time-$(1)),\
- !!! Time will be set back during install$(if $(time-$1)-reason,\
- ($(time-$(1)-reason))).\n)\
- !!! At first boot of new system, edit /etc/apt/sources.list e.g. to this:\n\
- $() deb http://httpredir.debian.org/debian/ $(1) main\n\
- $() deb http://httpredir.debian.org/debian/ $(1)-updates main\n\
- $() deb http://security.debian.org/ $(1) main\n
- this-warnings = \
- $(if $(installsuite-$(1)),\
- printf "\n$(call this-installsuite-warn,$(1))";)\
- $(if $(call this-snapshot,$(1)),\
- printf "\n$(call this-snapshot-warn,$(1))")
- di-firmware-armhf-lime = A20-OLinuXino-Lime
- di-firmware-armhf-lime2 = A20-OLinuXino-Lime2
- di-firmware-armhf-micro = A20-OLinuXino-MICRO
- spl-armhf-lime = A20-OLinuXino-Lime/u-boot-sunxi-with-spl.bin
- spl-armhf-lime2 = A20-OLinuXino-Lime2/u-boot-sunxi-with-spl.bin
- spl-armhf-micro = A20-OLinuXino_MICRO/u-boot-sunxi-with-spl.bin
- dtb-armhf-lime = sun7i-a20-olinuxino-lime.dtb
- dtb-armhf-lime2 = sun7i-a20-olinuxino-lime2.dtb
- dtb-armhf-micro = sun7i-a20-olinuxino-micro.dtb
- scr-armhf = bootscr.sunxi
- vendor-files = $(foreach suite,$(suites),\
- $(foreach arch,$(archs),\
- $(foreach type,$(devicetypes-$(arch)),\
- vendor/$(or $(snapshot-$(suite)-di:%=$(suite)-%),$(suite))/$(arch)/$(type))))
- images-di = $(foreach suite,$(suites),\
- $(foreach arch,$(archs),\
- $(foreach type,$(devicetypes-$(arch)),\
- $(foreach node,plain $(nodes),\
- images/$(suite)/$(arch)/d-i/$(node)/$(type).img.gz))))
- this-kernelbuild = $(shell readlink $(1) | grep -Po 'vmlinuz-\K.*')
- # erase block size of sdcard, in power-of-two megabytes
- segmentsize ?= 4
- # boot partition size, in power-of-two megabytes
- bootsize ?= $(shell echo $$(( \
- ( 200 / $(segmentsize) \
- + 1 ) \
- * $(segmentsize) )) )
- # use video console (HDMI/VGA) by default (U-boot default is serial)
- console = $(strip $(if $(noscreen),\
- ,\
- tty1))
- # ensure custom bootargs are applied last
- bootargs := $(strip \
- $(if $(nogfx),\
- sunxi_ve_mem_reserve=0 \
- sunxi_g2d_mem_reserve=0 \
- sunxi_fb_mem_reserve=16 \
- ) \
- $(bootargs))
- SUPATH = PATH=/usr/sbin:/sbin:$(PATH)
- # tool is either custom (even empty), in PATH, fallback in PATH, or missing
- this_tool = $(strip \
- $(if $(filter-out undefined,$(origin $(1))),\
- $($(1)),\
- $(or \
- $(if $(wildcard $(patsubst %,%/$(1),$(subst :, ,$(PATH)))),\
- $(1)),\
- $(if $(wildcard $(patsubst %,%/$(2),$(subst :, ,$(PATH)))),\
- $(2)$(eval tools_fallback += $(1))),\
- $(eval tools_missing += $(1)$(3:%=[%])))))
- GZIP := $(call this_tool,pigz,gzip)
- GUNZIP := $(call this_tool,unpigz,gunzip)
- FAKEROOT := $(call this_tool,fakeroot)
- SUDO := $(call this_tool,sudo)
- this-fakeroot = $(if $(FAKEROOT),$(call this-fakeroot-$(FAKEROOT),$(1)),$(SUDO))
- this-fakeroot-fakeroot = fakeroot -i'$(1)' -s'$(1)'
- this-fakeroot-fakeroot-ng = fakeroot-ng -p'$(1)'
- this-fakeroot-fakeroot-pseudo = fakeroot-pseudo -i'$(1)' -s'$(1)'
- MOUNT_FAT := $(call this_tool,fusefat) -o rw+
- UMOUNT_FAT = fusermount -u
- # TODO: avoid sudo when fuse2fs proven reliable
- MOUNT_EXT := $(if $(SUDO),$(SUDO) mount,$(SUPATH) $(call this_tool,fuse2fs))
- UMOUNT_EXT = $(if $(SUDO),$(SUDO) umount,fusermount -u)
- # options fetched from "bash -x flash-kernel" on Lime2 box.
- MKIMAGE := $(call this_tool,mkimage,,sunxi-tools) -A arm -O linux -T script -C none -a '' -e '' -n 'boot script'
- EATMYDATA := $(call this_tool,eatmydata)
- $(if $(tools_fallback),\
- $(warning NOTICE: Helper tools missing (replaced by alternative):\
- $(tools_fallback)))
- $(if $(tools_missing),\
- $(warning WARNING: Helper tools missing:\
- $(tools_missing)))
- all: $(checksumfiles) $(images-di) $(info)
- sign: $(signfiles)
- # TODO: drop sid → buster workaround when fixed in boxer
- $(profiles-di): content/%/preseed.cfg: \
- $(wildcard nodes/*.yml) skel/preseed.cfg.in skel/script.sh.in
- mkdir -p $(dir $@)
- cd $(dir $@) \
- && boxer compose \
- --nodedir $(CURDIR)/nodes \
- --skeldir $(CURDIR)/skel \
- --suite $(patsubst sid,buster,$(lastword $(subst -, ,$*))) \
- $(subst /,-,$(firstword $(subst -, ,$*)))
- $(profiles-script): content/%/script.sh: content/%/preseed.cfg
- $(mdfiles): content/MD%SUMS: $(profiles)
- cd content && md$*sum $(profiles:content/%=%) > MD$*SUMS~
- rm -f $@.sig
- mv -f $@~ $@
- $(shafiles): content/SHA%SUMS: $(profiles)
- cd content && sha$*sum $(profiles:content/%=%) > SHA$*SUMS~
- rm -f $@.sig
- mv -f $@~ $@
- $(signfiles): %.sig: % $(checksumfiles)
- rm -f $@
- gpg --detach-sign -a -o $@ $<
- $(info): content/% : %
- mkdir -p content
- cp -f $< $@
- header.htm:
- echo '# $(title)' | pandoc -f markdown -t html -o $@
- index.html: README header.htm style.css
- tail -n +2 $< | \
- pandoc -s --toc \
- -T "$(title)" \
- -B header.htm \
- -c style.css \
- -f markdown -t html \
- -o $@
- style.css: style.scss
- scss --compass --sourcemap=none --style compressed $< $@
- clean::
- rm -rf content
- define SUITE_ARCH_TYPE_NODE_template =
- # Prepend firmware to (plain/preseed installer/bootstrapped) partition
- images/$(1)/$(2)/d-i/$(4)/$(3).img.gz: \
- $(call this-vendordir,$(1))/$(2)/firmware.$(di-firmware-$(2)-$(3)).img.gz \
- $(call this-partdir,$(1))/$(2)/$(4)/partition.img.gz
- mkdir -p $$(dir $$@)
- zcat $$^ | $(GZIP) --rsyncable > $$@~
- mv -f $$@~ $$@
- @$(call this-warnings,$(1))
- images/$(1)/$(2)/local/$(4)/$(3).img.gz: \
- $(call this-partdir,$(1))/$(2)/$(4)/local/firmware.$(3).img \
- partition/$(1)/$(2)/$(4)/$(3)/boot.img \
- partition/$(1)/$(2)/$(4)/rootfs.img
- mkdir -p $$(dir $$@)
- cat $$^ | $(GZIP) --rsyncable > $$@~
- mv -f $$@~ $$@
- @$(call this-warnings,$(1))
- # Compose firmware from bootstrapped system
- $(call this-partdir,$(1))/$(2)/$(4)/d-i/firmware.$(3).img: \
- partition/$(1)/$(2)/$(4)/rootfs
- mkdir -p $$(dir $$@)
- dd if=/dev/zero of=$$@~ bs=1M count=0 seek=39
- $(SUPATH) parted -s $$@~ -- \
- mklabel msdos \
- mkpart primary fat32 1MiB 100% \
- toggle 1 boot
- truncate -s 8K $$@~
- cat $$</usr/lib/u-boot/$(spl-$(2)-$(3)) >> $$@~
- truncate -s 1M $$@~
- mv -f $$@~ $$@
- # Boot partition
- # TODO: extract boot.cmd variables from rootfs
- partition/$(1)/$(2)/$(4)/$(3)/boot.img: \
- partition/$(1)/$(2)/$(4)/rootfs \
- partition/$(1)/$(2)/$(4)/$(3)/boot.cmd
- $$(eval kernelbuild = $$(call this-kernelbuild,$$</vmlinuz))
- mkdir -p $$(dir $$@)
- $(SUPATH) mkfs.ext2 $$@~ $(bootsize)M
- mkdir -p $$@.mnt
- $(MOUNT_EXT) $$@~ $$@.mnt
- $(or $(SUDO),$(call this-fakeroot,partition/$(1)/$(2)/$(4)/rootfs.state)) \
- chown root: $$@.mnt
- $(or $(SUDO),$(call this-fakeroot,partition/$(1)/$(2)/$(4)/rootfs.state)) \
- install -D \
- -t $$@.mnt \
- $$</boot/*-$$(kernelbuild)
- $(or $(SUDO),$(call this-fakeroot,partition/$(1)/$(2)/$(4)/rootfs.state)) \
- install -D \
- -t $$@.mnt/dtbs/$$(kernelbuild) \
- $$</usr/lib/linux-image-$$(kernelbuild)/$(dtb-$(2)-$(3))
- $(MKIMAGE) -d partition/$(1)/$(2)/$(4)/$(3)/boot.cmd $$(dir $$@)/boot.scr
- $(or $(SUDO),$(call this-fakeroot,partition/$(1)/$(2)/$(4)/rootfs.state)) \
- cp $$(dir $$@)/boot.scr $$@.mnt/boot.scr
- $(UMOUNT_EXT) "$$@.mnt"
- mv -f $$@~ $$@
- partition/$(1)/$(2)/$(4)/$(3)/boot.cmd: \
- partition/$(1)/$(2)/$(4)/rootfs \
- partition/$(1)/$(2)/$(4)/rootfs.img.uuid
- $$(eval kernelbuild = $$(call this-kernelbuild,$$</vmlinuz))
- mkdir -p $$(dir $$@)
- perl -0777 -p \
- $(if $(console),\
- -e 's/^(?=[^#])/setenv console $(console)\n/m;') \
- -e "s'@@LINUX_KERNEL_CMDLINE_DEFAULTS@@''g;" \
- -e "s'@@LINUX_KERNEL_CMDLINE@@'$(strip $(if $(noquiet),,quiet) $(bootargs))'g;" \
- -e "s'@@UBOOT_ENV_EXTRA@@''g;" \
- -e "s'@@KERNEL_VERSION@@'$$(kernelbuild)'g;" \
- < $$</etc/flash-kernel/bootscript/$(scr-$(2)) \
- > $$@~
- sed -i '2asetenv bootargs root=/dev/disk/by-uuid/'"$$$$(cat partition/$(1)/$(2)/$(4)/rootfs.img.uuid)" $$@~
- mv -f $$@~ $$@
- $(call this-partdir,$(1))/$(2)/$(4)/local/firmware.$(3).img: \
- partition/$(1)/$(2)/$(4)/rootfs \
- partition/$(1)/$(2)/$(4)/rootfs.size
- mkdir -p $$(dir $$@)
- dd if=/dev/zero of=$$@~ \
- bs=1M \
- count=0 \
- seek=$$$$(( \
- $(segmentsize) \
- + $(bootsize) \
- + $$$$(cat partition/$(1)/$(2)/$(4)/rootfs.size) \
- / 1024 / 1024 ))
- $(SUPATH) parted -s $$@~ -- \
- mklabel msdos \
- mkpart primary ext2 \
- $(segmentsize)MiB \
- $$$$(( ( \
- $(segmentsize) + $(bootsize) ) * 1024 * 1024 \
- - 1 ))B \
- toggle 1 boot \
- mkpart primary ext2 \
- $$$$(( ( $(segmentsize) + $(bootsize) ) * 1024 * 1024 \
- ))B \
- 100%
- truncate -s 8K $$@~
- cat $$</usr/lib/u-boot/$(spl-$(2)-$(3)) >> $$@~
- truncate -s 4M $$@~
- mv -f $$@~ $$@
- touch $$@
- endef
- $(foreach suite,$(suites),\
- $(foreach arch,$(archs),\
- $(foreach type,$(devicetypes-$(arch)),\
- $(foreach node,plain $(nodes),\
- $(eval $(call SUITE_ARCH_TYPE_NODE_template,$(suite),$(arch),$(type),$(node)))))))
- define SUITE_ARCH_NODE_template =
- ifneq ($(3),plain)
- # Add preseed file to ramdisk in installer partition
- $(call this-partdir,$(1))/$(2)/$(3)/partition.img.gz: \
- $(call this-partdir,$(1))/$(2)/plain/partition.img.gz \
- content/$(3)-$(1)/preseed.cfg
- mkdir -p $$(dir $$@)
- cp -f $$< $$@
- $(GUNZIP) -f $$@
- mkdir -p $$(dir $$@)/ramdisk
- $(MOUNT_FAT) $$(patsubst %.gz,%,$$@) $$(dir $$@)/ramdisk
- cp -f $$(dir $$@)/ramdisk/initrd.gz $$(dir $$@)
- $(GUNZIP) -f $$(dir $$@)/initrd.gz
- cp -f content/$(3)-$(1)/preseed.cfg $$(dir $$@)
- cd $$(dir $$@) && echo preseed.cfg | cpio --format=newc -oAO initrd
- $(GZIP) -f $$(dir $$@)/initrd
- rm -f $$(dir $$@)/ramdisk/INITRD.GZ
- cp $$(dir $$@)/initrd.gz $$(dir $$@)/ramdisk/INITRD.GZ
- $(UMOUNT_FAT) $$(dir $$@)/ramdisk
- $(GZIP) -f $$(patsubst %.gz,%,$$@)
- endif
- # Copy preseed file, and strip templating parts if from skeleton
- partition/$(1)/$(2)/$(3)/rootfs.preseed.cfg: \
- $(if $(filter plain,$(3)),skel/preseed.cfg.in,content/$(3)-$(1)/preseed.cfg)
- mkdir -p "$$(dir $$@)"
- cp -f $$< $$@
- $(if $(filter plain,$(3)),\
- perl -i -0777 -p \
- -e 's!\[\%(?:[^\n]+\n)+!!g' \
- $$@)
- $$(if $$(LINUX_VERSION),\
- perl -i -pe 's/linux-image\K/-$$(LINUX_VERSION)/' \
- $$@)
- # Configure multistrap
- # TODO: install libfakeroot only on alien arch
- # TODO: Stop uncomment hooks when faketime supports chroot: bug#778462
- partition/$(1)/$(2)/$(3)/rootfs.multistrap.conf: \
- partition/$(1)/$(2)/$(3)/rootfs.preseed.cfg \
- skel/multistrap.conf.in
- $$(eval packages = $$(strip \
- $(if $(FAKEROOT),libfakeroot) \
- $(if $(EATMYDATA),libeatmydata1) \
- $(if $(time-$(1)),libfaketime) \
- $$(shell perl -0777 -n \
- -e 's/ \\\n / /;' \
- -e 'print m,^d-i pkgsel/include string ([^\n]*),m;' \
- < $$<)))
- $$(eval kernelpackage = $$(strip \
- $$(shell grep -Po \
- 'linux-image-$$(LINUX_VERSION)\S+' \
- $$<)))
- $(if $(call this-snapshot,$(1)),\
- $$(eval source = $(call this-repo,snapshot.debian.org,/archive/debian/$(call this-snapshot,$(1)))),
- $$(eval source = $(call this-repo,httpredir.debian.org,/debian)))
- perl -p \
- -e 's!\@suite\@!$(1)!;' \
- -e 's!\@kernelsuite\@!$(LINUX_SUITE)!g;' \
- -e 's!\@arch\@!$(2)!;' \
- -e 's!\@libdir\@!skel!;' \
- -e 's!\@preseed\@!$$<!;' \
- -e 's!\@packages\@!$$(packages)!;' \
- -e 's!\@kernelpackage\@!$$(kernelpackage)!g;' \
- -e 's!\@source\@!$$(source)!;' \
- $(if $(time-$(1)),\
- ,\
- -e 's!^hookdir=!#hookdir=!g;') \
- $$(if $$(and $(LINUX_SUITE), $$(kernelpackage)),\
- -e 's!^bootstrap=\K!Kernel-$(LINUX_SUITE) !;') \
- < skel/multistrap.conf.in \
- > $$@
- # Bootstrap system
- # TODO: Stop manually run hooks when faketime supports chroot: bug#778462
- partition/$(1)/$(2)/$(3)/rootfs.img.uuid: \
- partition/$(1)/$(2)/$(3)/rootfs.img
- $(SUPATH) blkid $$< | grep -Po 'UUID="\K[^"]+' > $$@~
- mv -f $$@~ $$@
- partition/$(1)/$(2)/$(3)/rootfs.img: \
- partition/$(1)/$(2)/$(3)/rootfs \
- partition/$(1)/$(2)/$(3)/rootfs.size
- $(SUPATH) mkfs.ext4 $$@~ \
- $$$$(( $$$$(cat "$$<.size") / 1024 ))k
- mkdir -p $$@.mnt
- $(MOUNT_EXT) $$@~ $$@.mnt
- $(or $(SUDO),$(call this-fakeroot,$$<.state)) \
- rsync -aHS --numeric-ids --info=progress2 \
- $(and $(SUDO),$(FAKEROOT),\
- -e "$(call this-fakeroot,$$<.state)") \
- --exclude '/boot' \
- --exclude '/var/cache/apt/archives/*.deb' \
- --exclude multistrap-configure.sh \
- --exclude tmp/preseeds \
- $$</ $$@.mnt/
- $(UMOUNT_EXT) "$$@.mnt"
- mv -f $$@~ $$@
- touch $$@
- # Guestimate image size from size of contents
- # * added 10% - 5 as reserved by ext4, and 5 for inaccuracy
- partition/$(1)/$(2)/$(3)/rootfs.size: \
- partition/$(1)/$(2)/$(3)/rootfs
- echo \
- $$$$(( \
- ( \
- $$$$( \
- $(call this-fakeroot,$$<.state) \
- du -s "$$<" \
- | cut -f 1 ) \
- / 1024 \
- / 100 * 120 \
- / $(segmentsize) + 1 ) \
- * $(segmentsize) * 1024 * 1024 )) \
- > $$@~
- mv -f $$@~ $$@
- partition/$(1)/$(2)/$(3)/rootfs: \
- partition/$(1)/$(2)/$(3)/rootfs.multistrap.conf
- $(SUPATH) $(call this-fakeroot,$$@.state) \
- $(EATMYDATA) \
- $(if $(time-$(1)),\
- faketime $(time-$(1))) \
- multistrap \
- -f $$< \
- -d "$$@"
- $(if $(time-$(1)),\
- ,\
- $(call this-fakeroot,$$@.state) \
- $(EATMYDATA) \
- run-parts \
- --regex '^completion' \
- --arg "$$@" \
- skel/multistrap-hooks)
- # TODO: why doesn't this work?!?
- #partition/$(1)/$(2)/$(3)/rootfs/%: \
- # partition/$(1)/$(2)/$(3)/rootfs
- endef
- $(foreach suite,$(suites),\
- $(foreach arch,$(archs),\
- $(foreach node,plain $(nodes),\
- $(eval $(call SUITE_ARCH_NODE_template,$(suite),$(arch),$(node))))))
- define SUITE_ARCH_template =
- # Adjust options in binary U-boot file boot.scr in ramdisk in partition:
- # * Overwrite whole disk by default
- # * if needed by installer, then
- # * hardcode use of snapshot archive
- # * avoid updates or security archives (unsupported with snapshot)
- # * if needed, set back time and suppress use of network time
- # else use httpredir.d.o by default
- # * if variable "http_proxy", "apt_cacher_host" or "approx_host" is set,
- # hardcode http proxy
- # * if non-default d-i suite in use, hardcode target suite
- # * If U-boot uses HDMI+USB, have Linux not replace framebuffer driver
- # * if variable "botargs" is set, append its content to bootargs
- $(call this-partdir,$(1))/$(2)/plain/partition.img.gz: \
- $(call this-vendordir,$(1))/$(2)/partition.img.gz
- $$(eval bootargs := $$(strip \
- $(if $(console),\
- fb=false) \
- partman-auto/method?=regular \
- $$(if $$(call this-snapshot,$(1)),\
- mirror/country=manual \
- mirror/http/hostname=$(or $(apt_cacher_host:%=%:3142),$(approx_host:%=%:9999),snapshot.debian.org) \
- mirror/http/directory=$(apt_cacher_host:%=/snapshot.debian.org)/archive/debian/$$(call this-snapshot,$(1)) \
- apt-setup/services-select= \
- $$(if $$(time-$(1)),\
- preseed/early_command=\\"date -s $$(time-$(1))\\" \
- clock-setup/ntp=false) \
- ,\
- mirror/country?=manual \
- mirror/http/hostname?=httpredir.debian.org \
- mirror/http/directory?=/debian \
- ) \
- $(if $(proxy),\
- mirror/http/proxy=$(proxy)) \
- $$(if $$(installsuite-$(1)),\
- mirror/suite=$(1)) \
- $(bootargs)))
- mkdir -p $$(dir $$@)
- cp -f $$< $$@
- $(GUNZIP) -f $$@
- mkdir -p $$(dir $$@)/ramdisk
- $(MOUNT_FAT) $$(patsubst %.gz,%,$$@) $$(dir $$@)/ramdisk
- perl -0777 -p \
- -e 's/^.*(?=#\s*Bootscript)//s;' \
- $(if $(console),\
- -e 's/^(?=[^#])/setenv console $(console)/m;') \
- -e 's'\''^setenv bootargs \K'\''$$(bootargs)'\'';' \
- < $$(dir $$@)/ramdisk/boot.scr \
- > $$(dir $$@)/boot.cmd
- $(MKIMAGE) -d $$(dir $$@)/boot.cmd $$(dir $$@)/boot.scr
- rm -f $$(dir $$@)/ramdisk/BOOT.SCR
- cp $$(dir $$@)/boot.scr $$(dir $$@)/ramdisk/BOOT.SCR
- $(UMOUNT_FAT) $$(dir $$@)/ramdisk
- $(GZIP) -f $$(patsubst %.gz,%,$$@)
- # Fetch pristine parts
- vendor/$(or $(snapshot-$(1)-di:%=$(1)-%),$(1))/$(2)/%:
- mkdir -p $$(dir $$@)
- curl $(proxy:%=-x %) -fsSRo '$$@' \
- 'http://ftp.de.debian.org/debian/dists/$(1)/main/installer-$(2)/$(or $(snapshot-$(1)-di),current)/images/netboot/SD-card-images/$$(notdir $$@)'
- endef
- $(foreach suite,$(suites),\
- $(foreach arch,$(archs),\
- $(eval $(call SUITE_ARCH_template,$(suite),$(arch)))))
- #%.img.gz: %.img
- # $(GZIP) -c --rsyncable $< > $@~
- # mv -f $@~ $@
- clean::
- $(SUDO) rm -rf --one-file-system images imageparts partition
- rm -f *.htm *.html *.css
- distclean: clean
- rm -rf vendor
- .PHONY: all sign clean distclean
- .PRECIOUS: $(vendor-files)
|