Skip to content

Commit efbd6b3

Browse files
committed
rename to FAB_ARCH_FAMILY & remove img support
1 parent 006a918 commit efbd6b3

File tree

1 file changed

+16
-50
lines changed

1 file changed

+16
-50
lines changed

share/product.mk

Lines changed: 16 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -23,23 +23,27 @@ UBUNTU = $(shell [ $(DISTRO) = 'ubuntu' ] && echo 'y')
2323
DEBIAN = $(shell [ $(DISTRO) = 'debian' ] && echo 'y')
2424

2525
FAB_ARCH ?= $(shell dpkg --print-architecture)
26+
2627
I386 = $(shell [ $(FAB_ARCH) = 'i386' ] && echo 'y')
2728
AMD64 = $(shell [ $(FAB_ARCH) = 'amd64' ] && echo 'y')
2829
ARM64 = $(shell [ $(FAB_ARCH) = 'arm64' ] && echo 'y')
2930

31+
ifndef FAB_ARCH_FAMILY
3032
ifeq ($(I386),y)
31-
ARCH_FAMILY=x86
33+
FAB_ARCH_FAMILY=x86
3234
endif
3335
ifeq ($(AMD64),y)
34-
ARCH_FAMILY=x86
36+
FAB_ARCH_FAMILY=x86
3537
endif
3638
ifeq ($(ARM64),y)
37-
ARCH_FAMILY=arm
39+
FAB_ARCH_FAMILY=arm
3840
# NONFREE is used to get raspi-firmware and firmware-brcm80211
39-
NONFREE=1
41+
# NONFREE=1
42+
endif
43+
44+
ifndef FAB_ARCH_FAMILY
45+
$(error unsupported architecture family)
4046
endif
41-
ifndef ARCH_FAMILY
42-
$(error unsupported architecture)
4347
endif
4448

4549
ifdef FAB_POOL
@@ -152,8 +156,8 @@ endef
152156
ifdef CHROOT_ONLY
153157
all: root.sandbox
154158
else
155-
ifeq ($(ARCH_FAMILY),arm)
156-
all: $O/product.img
159+
ifeq ($(FAB_ARCH_FAMILY),arm)
160+
all: root.sandbox
157161
else
158162
all: $O/product.iso
159163
endif
@@ -193,7 +197,7 @@ define help/body
193197
@echo ' CONF_VARS $(value CONF_VARS)'
194198
@echo
195199
@echo ' FAB_ARCH $(value FAB_ARCH)'
196-
@echo ' ARCH_FAMILY $(value ARCH_FAMILY)'
200+
@echo ' FAB_ARCH_FAMILY $(value FAB_ARCH_FAMILY)'
197201
@echo ' FAB_POOL $(value FAB_POOL)'
198202
@echo ' FAB_POOL_PATH $(value FAB_POOL_PATH)'
199203
@echo ' FAB_PLAN_INCLUDE_PATH $(value FAB_PLAN_INCLUDE_PATH)/'
@@ -243,12 +247,7 @@ define help/body
243247
@echo '# remake target and the targets that depend on it'
244248
@echo '$$ rm $(value STAMPS_DIR)/<target>; make <target>'
245249
@echo
246-
@if [ "$(ARCH_FAMILY)" = "arm" ]; \
247-
then \
248-
echo '# build a target (default: product.img)'; \
249-
else \
250250
echo '# build a target (default: product.iso)'; \
251-
fi
252251
@echo '$$ make [target] [O=path/to/build/dir]'
253252
@echo ' redeck # deck unmounted input/output decks (e.g., after reboot)'
254253
@echo
@@ -264,17 +263,12 @@ define help/body
264263
endef
265264

266265
ifndef CHROOT_ONLY
267-
ifeq ($(ARCH_FAMILY),arm)
268-
help/body += ;\
269-
echo ' product.img \# product img for raspberry pi 4';
270-
else
271266
help/body += ;\
272267
echo ' cdroot \# created by squashing root.patched into cdroot template + overlay'; \
273268
echo ' product.iso \# product ISO created from the cdroot'; \
274269
echo; \
275270
echo ' updated-initramfs \# rebuild product with updated initramfs'
276271
endif
277-
endif
278272

279273
help:
280274
$(help/pre)
@@ -286,7 +280,7 @@ define clean/body
286280
$(call remove-deck, $O/root.patched)
287281
$(call remove-deck, $O/root.build)
288282
$(call remove-deck, $O/bootstrap)
289-
-rm -rf $O/root.spec $O/cdroot $O/product.iso $O/sdroot $O/product.img $O/product.img.xz $O/log $O/screens $(STAMPS_DIR)
283+
-rm -rf $O/root.spec $O/cdroot $O/product.iso $O/log $O/screens $(STAMPS_DIR)
290284
endef
291285

292286
clean:
@@ -334,7 +328,7 @@ define run-conf-scripts
334328
if [ -n "$(wildcard $1/*)" ]; then \
335329
echo "\$$(call $0,$1)"; \
336330
fi; \
337-
for script in $1/* $1/$(ARCH_FAMILY).d/*; do \
331+
for script in $1/* $1/$(FAB_ARCH_FAMILY).d/*; do \
338332
[ -f "$$script" ] && [ -x "$$script" ] || continue; \
339333
args_path=$(strip $1)/args/$$(echo $$(basename $$script) | sed 's/^[^a-zA-Z]*//'); \
340334
args="$$([ -f $$args_path ] && (cat $$args_path | sed 's/#.*//'))"; \
@@ -368,7 +362,7 @@ define root.patched/body
368362
# apply the common overlays
369363
$(foreach overlay,$(_COMMON_OVERLAYS),
370364
@if echo $(overlay) | grep -q '\.d$$'; then \
371-
for d in $(overlay)/* $(overlay)/$(ARCH_FAMILY).d/*; do \
365+
for d in $(overlay)/* $(overlay)/$(FAB_ARCH_FAMILY).d/*; do \
372366
if echo $$d | grep -q '\.d$$'; then continue; fi; \
373367
echo fab-apply-overlay $$d $O/root.patched; \
374368
fab-apply-overlay $$d $O/root.patched; \
@@ -526,26 +520,6 @@ define product.iso/body
526520
$(run-isohybrid)
527521
endef
528522

529-
# target: product.img
530-
define product.img/body
531-
qemu-img create -f raw $O/product.img 2G
532-
parted -s $O/product.img mklabel msdos
533-
parted -s $O/product.img -- mkpart primary fat32 4MiB 400MiB
534-
parted -s $O/product.img -- mkpart primary ext2 400MiB 100%
535-
kpartx -asv $O/product.img
536-
mkfs -t vfat -n RASPIFIRM /dev/mapper/loop0p1
537-
mkfs -t ext4 -L RASPIROOT /dev/mapper/loop0p2
538-
mkdir -p $O/sdroot
539-
mount /dev/mapper/loop0p2 $O/sdroot
540-
mkdir -p $O/sdroot/boot/firmware
541-
mount /dev/mapper/loop0p1 $O/sdroot/boot/firmware
542-
cp -ax $O/root.sandbox/* $O/sdroot
543-
umount $O/sdroot/boot/firmware
544-
umount $O/sdroot
545-
kpartx -dsv $O/product.img
546-
xz -8 -f $O/product.img
547-
endef
548-
549523
cdroot-dynamic: $(STAMPS_DIR)/root.sandbox
550524
$(cdroot-dynamic/pre)
551525
$(cdroot-dynamic/body)
@@ -582,14 +556,6 @@ $O/product.iso: $(product.iso/deps) $(product.iso/deps/extra)
582556

583557
product.iso: $O/product.iso
584558

585-
product.img/deps ?= $(STAMPS_DIR)/root.sandbox
586-
$O/product.img: $(product.img/deps) $(product.img/deps/extra)
587-
$(product.img/pre)
588-
$(product.img/body)
589-
$(product.img/post)
590-
591-
product.img: $O/product.img
592-
593559
# target: updated-initramfs
594560
define updated-initramfs/body
595561
rm -rf $O/product.iso

0 commit comments

Comments
 (0)