Skip to content

Commit 7df617d

Browse files
committed
Merge branch 'buildroot-2022.05'
2 parents 001a4b7 + 7b92f94 commit 7df617d

19 files changed

+956
-2315
lines changed

Dockerfile

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM ailispaw/ubuntu-essential:18.04-nodoc
1+
FROM ailispaw/ubuntu-essential:16.04-nodoc
22

33
ENV TERM xterm
44

@@ -12,8 +12,8 @@ ENV SRC_DIR=/build \
1212
BR_ROOT=/build/buildroot
1313
RUN mkdir -p ${SRC_DIR}
1414

15-
ENV BR_VERSION 2019.05
16-
RUN wget -qO- https://buildroot.org/downloads/buildroot-${BR_VERSION}.tar.bz2 | tar xj && \
15+
ENV BR_VERSION 2022.05
16+
RUN wget -qO- https://buildroot.org/downloads/buildroot-${BR_VERSION}.tar.xz | tar xJ && \
1717
mv buildroot-${BR_VERSION} ${BR_ROOT}
1818

1919
# Apply patches
@@ -22,16 +22,17 @@ RUN for patch in ${SRC_DIR}/patches/*.patch; do \
2222
patch -p1 -d ${BR_ROOT} < ${patch}; \
2323
done
2424

25+
# Copy extra packages
26+
COPY extra ${SRC_DIR}/extra
27+
2528
# Copy the empty config file
2629
COPY empty.config ${BR_ROOT}/.config
2730

28-
# Copy extra packages
29-
COPY extra ${SRC_DIR}/extra
31+
# Copy the build script file
32+
COPY build.sh ${SRC_DIR}/build.sh
33+
34+
VOLUME ${BR_ROOT}/dl ${BR_ROOT}/ccache
3035

3136
WORKDIR ${BR_ROOT}
3237

33-
RUN make BR2_EXTERNAL=${SRC_DIR}/extra oldconfig && \
34-
make --quiet && \
35-
find output/build -mindepth 2 -not -name '.stamp_*' | xargs rm -rf && \
36-
find output/target/ -name 'libstdc++.so*' | tar zcf ${SRC_DIR}/libstdcxx.tar.gz --transform 's?output/target?.?g' -T - && \
37-
rm -rf board/* configs/* dl/* output/images/* output/target/* ccache/*
38+
CMD ["../build.sh"]

Dockerfile.extra

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
FROM ailispaw/barge-pkg
22

3+
# Setup environment
4+
ENV SRC_DIR=/build
5+
36
# Update extra packages
47
RUN rm -rf ${SRC_DIR}/extra/*
58
COPY extra ${SRC_DIR}/extra
69

7-
RUN make BR2_EXTERNAL=${SRC_DIR}/extra oldconfig
10+
VOLUME ${BR_ROOT}/dl ${BR_ROOT}/ccache
11+
12+
WORKDIR ${BR_ROOT}
13+
14+
CMD ["make", "BR2_EXTERNAL=${SRC_DIR}/extra", "oldconfig"]

Makefile

Lines changed: 64 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,70 @@
11
BUILDER := ailispaw/barge-pkg
2-
VERSION := 2.13.0
2+
VERSION := 2.15.0-rc2
33

4-
KERNEL_VERSION := 4.14.125
4+
KERNEL_VERSION := 4.14.282
55

6-
SOURCES := .dockerignore empty.config
6+
SOURCES := .dockerignore empty.config build.sh \
7+
$(shell find patches -type f)
78

89
EXTRA := $(shell find extra -type f)
910

11+
TMP_BUILD_IMAGE := barge-pkg-builder
12+
TMP_BUILD_CONTAINER := barge-pkg-built
13+
14+
DL_DIR := /mnt/data/dl
15+
CCACHE_DIR := /mnt/data/ccache
16+
1017
# $1: Dockerfile
1118
# $2: image-name:tag
1219
# $3: dependencies
20+
# $4: an intermediate image to build
21+
# $5: an intermediate container to build
1322
define docker_build
1423
$(eval SRC_UPDATED=$$(shell stat -f "%m" $3 | sort -gr | head -n1))
15-
$(eval STR_CREATED=$$(shell docker inspect -f '{{.Created}}' $2 2>/dev/null))
16-
$(eval IMG_CREATED=`date -j -u -f "%FT%T" "$$(STR_CREATED)" +"%s" 2>/dev/null || echo 0`)
17-
@if [ "$(SRC_UPDATED)" -gt "$(IMG_CREATED)" ]; then \
18-
set -e; \
24+
@echo "SRC_UPDATED=`date -r $(SRC_UPDATED)`"
25+
26+
@set -e; \
27+
IMG_CREATED=`docker inspect -f '{{.Created}}' $4 2>/dev/null || true`; \
28+
IMG_CREATED=`date -j -u -f "%FT%T" "$${IMG_CREATED}" +"%s" 2>/dev/null || echo 0`; \
29+
echo "IMG_CREATED=`date -r $${IMG_CREATED}`"; \
30+
if [ "$(SRC_UPDATED)" -gt "$${IMG_CREATED}" ]; then \
1931
find . -type f -name '.DS_Store' | xargs rm -f; \
20-
docker build -f $1 -t $2 .; \
32+
docker build -f $1 -t $4 .; \
33+
IMG_CREATED2=`docker inspect -f '{{.Created}}' $4 2>/dev/null || true`; \
34+
IMG_CREATED2=`date -j -u -f "%FT%T" "$${IMG_CREATED2}" +"%s" 2>/dev/null || echo 0`; \
35+
echo "IMG_CREATED2=`date -r $${IMG_CREATED2}`"; \
36+
if [ "$${IMG_CREATED2}" -gt "$(SRC_UPDATED)" ]; then \
37+
(docker rm -f $5 || true); \
38+
fi; \
39+
fi
40+
41+
@set -e; \
42+
CTN_EXISTS=`docker ps -aq -f name='$5$$' -f exited=0`; \
43+
echo "CTN_EXISTS=$${CTN_EXISTS}"; \
44+
if [ -z "$${CTN_EXISTS}" ]; then \
45+
(docker rm -f $5 || true); \
46+
docker run --privileged -v $(DL_DIR):/build/buildroot/dl \
47+
-v $(CCACHE_DIR):/build/buildroot/ccache --name $5 $4; \
48+
fi
49+
50+
@set -e; \
51+
CTN_FINISHED=`docker inspect -f '{{.State.FinishedAt}}' $5 2>/dev/null || true`; \
52+
CTN_FINISHED=`date -j -u -f "%FT%T" "$${CTN_FINISHED}" +"%s" 2>/dev/null || echo 0`; \
53+
echo "CTN_FINISHED=`date -r $${CTN_FINISHED}`"; \
54+
PKG_CREATED=`docker inspect -f '{{.Created}}' $2 2>/dev/null || true`; \
55+
PKG_CREATED=`date -j -u -f "%FT%T" "$${PKG_CREATED}" +"%s" 2>/dev/null || echo 0`; \
56+
echo "PKG_CREATED=`date -r $${PKG_CREATED}`"; \
57+
if [ "$${CTN_FINISHED}" -gt "$${PKG_CREATED}" ]; then \
58+
docker export $5 | docker import \
59+
-c 'VOLUME /build/buildroot/dl /build/buildroot/ccache' \
60+
-c 'WORKDIR /build/buildroot' \
61+
-m 'https://github.com/bargees/barge-pkg' \
62+
- $2; \
2163
fi
2264
endef
2365

2466
build: Dockerfile $(SOURCES) $(EXTRA)
25-
$(call docker_build,$<,$(BUILDER),$^)
67+
$(call docker_build,$<,$(BUILDER),$^,$(TMP_BUILD_IMAGE),$(TMP_BUILD_CONTAINER))
2668

2769
tag: | build
2870
docker tag $(BUILDER) $(BUILDER):$(VERSION)
@@ -31,14 +73,21 @@ release: | tag
3173
docker push $(BUILDER):$(VERSION)
3274

3375
extra: Dockerfile.extra $(EXTRA)
34-
$(call docker_build,$<,$(BUILDER):$(VERSION),$^)
76+
$(call docker_build,$<,$(BUILDER):$@,$^,$(TMP_BUILD_IMAGE)-$@,$(TMP_BUILD_CONTAINER)-$@)
3577

3678
vagrant:
3779
vagrant up
80+
vagrant ssh -c 'sudo mkdir -p $(DL_DIR) $(CCACHE_DIR)'
3881

3982
clean:
83+
-docker rm -f $(TMP_BUILD_CONTAINER)
84+
-docker rm -f $(TMP_BUILD_CONTAINER)-extra
85+
-docker rmi `docker images -q -f dangling=true`
86+
-docker rmi $(TMP_BUILD_IMAGE)
87+
-docker rmi $(TMP_BUILD_IMAGE)-extra
4088
-docker rmi $(BUILDER):$(VERSION)
4189
-docker rmi $(BUILDER)
90+
-docker rmi $(BUILDER):extra
4291

4392
.PHONY: build tag release base extra vagrant clean
4493

@@ -49,15 +98,15 @@ output/$(VERSION)/buildroot.config: | output
4998

5099
PACKAGES := acl bindfs criu eudev git iproute2 ipvsadm kmod libfuse locales make \
51100
shadow sshfs su-exec tar tmux tzdata vim \
52-
dmidecode findutils socat zlib wireguard qemu-ga
101+
dmidecode findutils socat zlib wireguard-linux-compat wireguard-tools qemu-ga
53102

54103
EUDEV_OPTIONS := -e BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV=y
55104
GIT_OPTIONS := -e BR2_PACKAGE_OPENSSL=y -e BR2_PACKAGE_LIBCURL=y
56105
IPVSADM_OPTIONS := -e BR2_PACKAGE_LIBNL=y
57106
KMOD_OPTIONS := -e BR2_PACKAGE_KMOD_TOOLS=y
58107
TMUX_OPTIONS := -e BR2_PACKAGE_NCURSES_WCHAR=y
59108
TZDATA_OPTIONS := -e BR2_TARGET_TZ_ZONELIST=default -e BR2_TARGET_LOCALTIME="Etc/UTC"
60-
WIREGUARD_OPTIONS := -v /vagrant/output/$(VERSION)/kernel.config:/build/kernel.config \
109+
WIREGUARD_LINUX_COMPAT_OPTIONS := -v /vagrant/output/$(VERSION)/kernel.config:/build/kernel.config \
61110
-e BR2_LINUX_KERNEL=y \
62111
-e BR2_LINUX_KERNEL_CUSTOM_VERSION=y \
63112
-e BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE=\"$(KERNEL_VERSION)\" \
@@ -67,9 +116,9 @@ WIREGUARD_OPTIONS := -v /vagrant/output/$(VERSION)/kernel.config:/build/kernel
67116

68117
packages: libstdcxx $(PACKAGES)
69118

70-
libstdcxx $(filter-out wireguard,$(PACKAGES)): % : output/$(VERSION)/barge-pkg-%-$(VERSION).tar.gz
119+
libstdcxx $(filter-out wireguard-linux-compat,$(PACKAGES)): % : output/$(VERSION)/barge-pkg-%-$(VERSION).tar.gz
71120

72-
wireguard: % : output/$(VERSION)/kernel.config output/$(VERSION)/barge-pkg-%-$(VERSION).tar.gz
121+
wireguard-linux-compat: % : output/$(VERSION)/kernel.config output/$(VERSION)/barge-pkg-%-$(VERSION).tar.gz
73122
$(eval TMP_DIR=/tmp/barge-pkg-$*-$(VERSION))
74123
vagrant ssh -c ' \
75124
sudo tar -zc -f /vagrant/output/$(VERSION)/barge-pkg-$*-$(VERSION).tar.gz -C $(TMP_DIR) \
@@ -90,9 +139,8 @@ $(PACKAGES:%=output/$(VERSION)/barge-pkg-%-$(VERSION).tar.gz): \
90139
for i in bin dev/pts etc/ld.so.conf.d etc/network lib sbin usr/bin usr/lib usr/sbin var/lib/misc; do \
91140
sudo mkdir -p $(TMP_DIR)/$$i; \
92141
done; \
93-
sudo mkdir -p /opt/pkg/ccache /opt/pkg/dl && \
94142
docker run --rm -v $(TMP_DIR):/build/buildroot/output/target \
95-
-v /opt/pkg/ccache:/build/buildroot/ccache -v /opt/pkg/dl:/build/buildroot/dl \
143+
-v $(DL_DIR):/build/buildroot/dl -v $(CCACHE_DIR):/build/buildroot/ccache \
96144
$($(shell echo $* | tr a-z- A-Z_)_OPTIONS) \
97145
$(BUILDER):$(VERSION) sh -c " \
98146
cp .config .config.org && \

build.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
set -e
3+
4+
make BR2_EXTERNAL=${SRC_DIR}/extra oldconfig
5+
make --quiet
6+
7+
# Make the libstdcxx package
8+
find output/target/ -name 'libstdc++.so*' | tar zcf ${SRC_DIR}/libstdcxx.tar.gz --transform 's?output/target?.?g' -T -
9+
10+
# Clean intermediate objects
11+
find output/build -mindepth 2 -not -name '.stamp_*' | xargs rm -rf
12+
rm -rf board/* configs/* output/images/* output/target/*

0 commit comments

Comments
 (0)