-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
77 lines (63 loc) · 2.21 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
.PHONY: clean image minimal-distro update-scripts packages-continue \
build-package find-package-file install-package
SHELL=/bin/bash
LFS_VER=11.2
TARGET_TOOLS=lfs-tools-$(LFS_VER).tar.gz
TARGET_ROOTFS=lfs-rootfs-$(LFS_VER).tar.gz
include .env
export
export MAKEFLAGS="--jobs=$(JOB_COUNT)"
all:
@echo -e "\
Welcome to LFS linux building tool!\n\n\
To build a bootable image run\n\n\
sudo make image \n\n\
or pick up one of the available targets:\n\
clean - Sets an initial state\n\
image - Builds uefi bootable image\n\
min-distro - Creates rootfs partition with minimum set of packages.\n\
"
clean:
@echo -n "Removing overlay tmp rootfs lfs.img $(LFS_PACKAGES) $(TARGET_TOOLS) $(TARGET_ROOTFS) [y/N] " \
&& read ans && [ $${ans:-N} = y ]
rm -rf overlay tmp rootfs lfs.img $(LFS_PACKAGES) $(TARGET_TOOLS) $(TARGET_ROOTFS)
$(TARGET_TOOLS):
mkdir -p $(LFS_BASE)
cp -R scripts $(LFS_BASE)
cp -R sources $(LFS_BASE)
chmod -R +x $(LFS_BASE)/scripts
docker build -t lfs\:$(LFS_VER) .
docker run \
--rm \
-v $(shell pwd)/$(LFS_BASE)\:/$(LFS_BASE) \
--env-file .env \
lfs\:$(LFS_VER)
@echo Packing $@...
tar cfz $@ -C $(LFS_BASE) .
$(TARGET_ROOTFS): $(TARGET_TOOLS)
rm -rf tmp overlay/work $(LFS) $(LFS_BASE) $(LFS_PACKAGE) $(LFS_PACKAGES)
mkdir -pv tmp overlay/work $(LFS) $(LFS_BASE) $(LFS_PACKAGE) $(LFS_PACKAGES)
@echo "Unpacking base..."
tar xf $< -C $(LFS_BASE) .
./scripts/packages/build-packages.sh
@echo Packing $@...
tar cfz $@ --exclude='./sources' --exclude='./scripts' --exclude='./tools' -C $(LFS_BASE) .
@echo "Here you are $@"
packages-continue:
./scripts/packages/build-packages.sh
@echo Packing $(TARGET_ROOTFS)...
tar cfz $(TARGET_ROOTFS) --exclude='./sources' --exclude='./scripts' --exclude='./tools' -C $(LFS_BASE) .
@echo "Here you are $(TARGET_ROOTFS)"
image: $(TARGET_ROOTFS)
./scripts/image/build-image.sh $<
min-distro:
./scripts/image/build-distro.sh minimal
update-scripts:
cp -R scripts $(LFS_BASE)
chmod -R +x $(LFS_BASE)/scripts
build-package:
./scripts/packages/build-package.sh -f $(shell find scripts/packages -name $(PACKAGE))
find-package-file:
./scripts/packages/find-package-file.sh $(FILE)
install-package:
./scripts/packages/install-package.sh $(PACKAGE)