Skip to content

Commit 2462095

Browse files
committed
build: Add target for pulling base images
Now that building doesn't automatically pull, add a target to pull all base images. This iterates over all images, which is inefficient because many of the images are shared, but will do for now.
1 parent e0d572c commit 2462095

2 files changed

Lines changed: 25 additions & 19 deletions

File tree

build/Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ VERSION:
3232
define MAIN_TEMPLATE =
3333
image@${1}@${2} rebuild-image@${1}@${2}: VERSION
3434

35-
image@${1}@${2} rebuild-image@${1}@${2} pull-image@${1}@${2} push-image@${1}@${2}:
35+
image@${1}@${2} rebuild-image@${1}@${2} pull-image@${1}@${2} push-image@${1}@${2} pull-base-image@${1}@${2}:
3636
@./scripts/image.sh $$@
3737

3838
clean@${1}@${2}:
@@ -43,6 +43,7 @@ IMAGES += image@${1}@${2}
4343
PULL_IMAGES += pull-image@${1}@${2}
4444
REBUILD_IMAGES += rebuild-image@${1}@${2}
4545
PUSH_IMAGES += push-image@${1}@${2}
46+
PULL_BASE_IMAGES += pull-base-image@${1}@${2}
4647
endef
4748

4849
define KERNEL_TEMPLATE =
@@ -141,6 +142,7 @@ images: ${IMAGES}
141142
pull-images: ${PULL_IMAGES}
142143
rebuild-images: ${REBUILD_IMAGES}
143144
push-images: ${PUSH_IMAGES}
145+
pull-base-images: ${PULL_BASE_IMAGES}
144146
docs: ${DOCS}
145147

146148
ALL_TARGETS = ${KERNEL} ${PPCTESTS} ${SELFTESTS} ${IMAGES} ${PULL_IMAGES} ${DOCS} ${CLEAN}

build/scripts/image.sh

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,23 @@ fi
1717

1818
image="linuxppc/build:$distro-$version"
1919

20+
from="docker.io/$distro:$version"
21+
22+
if [[ "$distro" == "docs" ]]; then
23+
from="docker.io/ubuntu:$version"
24+
elif [[ "$distro" == "ubuntu-allcross" ]]; then
25+
from="linuxppc/build:ubuntu-$version"
26+
elif [[ "$distro" == "korg" ]]; then
27+
# Use an older distro for the 5.x toolchains.
28+
if [[ "$version" == 5.* ]]; then
29+
from="docker.io/ubuntu:16.04"
30+
elif [[ "$version" == 13.* ]]; then
31+
from="docker.io/ubuntu:23.04"
32+
else
33+
from="docker.io/ubuntu:20.04"
34+
fi
35+
fi
36+
2037
if [[ "$task" == "image" ]]; then
2138
cmd="$DOCKER images -q --filter=reference=$image"
2239
echo "+ $cmd" # fake set -x display
@@ -82,6 +99,10 @@ elif [[ "$task" == "push-image" ]]; then
8299
fi
83100

84101
exit 0
102+
elif [[ "$task" == "pull-base-image" ]]; then
103+
cmd="$DOCKER pull $from"
104+
(set -x; $cmd)
105+
exit $?
85106
fi
86107

87108
cmd="$DOCKER build -f $distro/Dockerfile "
@@ -102,28 +123,11 @@ if [[ -z "$GID" ]]; then
102123
GID=$(id -g)
103124
fi
104125

105-
from="docker.io/$distro:$version"
106-
107-
if [[ "$distro" == "docs" ]]; then
108-
from="docker.io/ubuntu:$version"
109-
elif [[ "$distro" == "ubuntu-allcross" ]]; then
110-
from="linuxppc/build:ubuntu-$version"
111-
elif [[ "$distro" == "korg" ]]; then
126+
if [[ "$distro" == "korg" ]]; then
112127
cmd+="--build-arg compiler_version=$version "
113-
114128
arch=$(uname -m)
115-
116129
cmd+="--build-arg base_url=https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/${arch}/${version}/ "
117130
cmd+="--build-arg tar_file=${arch}-gcc-${version}-nolibc-powerpc64-linux.tar.xz "
118-
119-
# Use an older distro for the 5.x toolchains.
120-
if [[ "$version" == 5.* ]]; then
121-
from="docker.io/ubuntu:16.04"
122-
elif [[ "$version" == 13.* ]]; then
123-
from="docker.io/ubuntu:23.04"
124-
else
125-
from="docker.io/ubuntu:20.04"
126-
fi
127131
fi
128132

129133
cmd+="--build-arg uid=$UID "

0 commit comments

Comments
 (0)