Skip to content

Commit edeaf1c

Browse files
committed
Add back code to push kernel to hub
- Accidentally removed from top level Makefile, now in kernel Makefile. Signed-off-by: Justin Cormack <[email protected]>
1 parent 07c130c commit edeaf1c

File tree

4 files changed

+43
-22
lines changed

4 files changed

+43
-22
lines changed

kernel/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ etc/
33
lib/
44
usr/
55
sbin/
6+
bzImage

kernel/Makefile

+40-20
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,58 @@
11
DEBUG ?= 0
22

3-
TAR2INITRD_IMAGE=mobylinux/tar2initrd:d5711601eb5b89de0f052d87365e18388ff3f1b5@sha256:58d377e65845f91400e173ce9fca93462f2f237947eef2b0d2c17bb4f2da5ee8
4-
5-
all: x86_64/vmlinuz64 x86_64/kernel.img
6-
7-
x86_64/kernel.tar: x86_64/bzImage
8-
tar cf - etc lib usr sbin > $@
9-
10-
x86_64/kernel.img: x86_64/kernel.tar x86_64/vmlinuz64
11-
cat $< | docker run --rm --read-only --net=none --log-driver=none --tmpfs /tmp -i $(TAR2INITRD_IMAGE) > $@
3+
all: bzImage push
124

135
ifdef AUFS
14-
kernel.tag: Dockerfile.aufs kernel_config kernel_config.debug kernel_config.aufs patches-4.9
6+
DEPS=Dockerfile.aufs kernel_config kernel_config.debug kernel_config.aufs patches-4.9
157
else
168
ifdef LTS4.4
17-
kernel.tag: Dockerfile.4.4 kernel_config kernel_config.debug kernel_config.4.4 patches-4.4
9+
DEPS=Dockerfile.4.4 kernel_config kernel_config.debug kernel_config.4.4 patches-4.4
1810
else
19-
kernel.tag: Dockerfile kernel_config kernel_config.debug patches-4.9
11+
DEPS=Dockerfile kernel_config kernel_config.debug patches-4.9
2012
endif
2113
endif
14+
kernel.tag: $(DEPS)
2215
BUILD=$$( tar cf - $^ | docker build -f $< --build-arg DEBUG=$(DEBUG) -q - ) && [ -n "$$BUILD" ] && echo "Built $$BUILD" && echo "$$BUILD" > $@
2316

24-
x86_64/vmlinuz64: x86_64/bzImage
25-
cp -a $< $@
26-
27-
x86_64/bzImage: kernel.tag
17+
bzImage: kernel.tag
2818
rm -rf etc/kernel-patches
2919
mkdir -p x86_64 etc lib usr sbin etc/kernel-patches
30-
docker run --rm --net=none --log-driver=none $(shell cat kernel.tag) cat kernel-source-info > etc/kernel-source-info
3120
docker run --rm --net=none --log-driver=none $(shell cat kernel.tag) tar cf - bzImage kernel-dev.tar kernel-headers.tar vmlinux kernel-modules.tar | tar xf - -C x86_64
32-
docker run --rm --net=none --log-driver=none $(shell cat kernel.tag) tar cf - -C patches . | tar xf - -C etc/kernel-patches
33-
tar xf x86_64/kernel-modules.tar
21+
cp x86_64/kernel-modules.tar kernel.tar
22+
cp x86_64/bzImage $@
23+
24+
.PHONY: push tag
25+
26+
MEDIA_TOYBOX=mobylinux/toybox-media:0a26fe5f574e444849983f9c4148ef74b3804d55@sha256:5ac38f77b66deb194c9016591b9b096e81fcdc9f7c3e6d01566294a6b4b4ebd2
27+
SHASUM=alpine:3.5
28+
29+
BASE="$MEDIA_TOYBOX"
30+
IMAGE=kernel
31+
32+
default: push
33+
34+
Dockerfile.media:
35+
printf "FROM $(MEDIA_TOYBOX)\nADD . /\n" > $@
36+
37+
hash: Dockerfile.media bzImage kernel.tar $(DEPS)
38+
tar cf - $^ | docker build --no-cache -t $(IMAGE):build -f Dockerfile.media -
39+
tar cf - $^ | DOCKER_CONTENT_TRUST=1 docker run --rm -i $(SHASUM) sha1sum | sed 's/ .*//' > $@
40+
41+
push: hash
42+
docker pull mobylinux/$(IMAGE):$(shell cat hash) || \
43+
(docker tag $(IMAGE):build mobylinux/$(IMAGE):$(shell cat hash) && \
44+
docker push mobylinux/$(IMAGE):$(shell cat hash))
45+
docker rmi $(IMAGE):build
46+
rm -f hash
47+
48+
tag: hash
49+
docker pull mobylinux/$(IMAGE):$(shell cat hash) || \
50+
docker tag $(IMAGE):build mobylinux/$(IMAGE):$(shell cat hash)
51+
docker rmi $(IMAGE):build
52+
rm -f hash
3453

54+
.PHONY: clean
3555
clean:
36-
rm -rf x86_64 lib etc usr sbin kernel.tag
56+
rm -rf x86_64 lib usr sbin kernel.tag hash Dockerfile.media bzImage kernel.tar
3757

3858
.DELETE_ON_ERROR:

moby.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
kernel: "mobylinux/kernel:7fa748810d7866797fd807a5682d5cb3c9c98111"
1+
kernel: "mobylinux/kernel:598481c08deafa37dccb33c88ad69fdecda57909"
22
init: "mobylinux/init:99cd639fa724a706e2d85575cabc4b645b71a727"
33
system:
44
- name: binfmt

test.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
kernel: "mobylinux/kernel:7fa748810d7866797fd807a5682d5cb3c9c98111"
1+
kernel: "mobylinux/kernel:598481c08deafa37dccb33c88ad69fdecda57909"
22
init: "mobylinux/init:99cd639fa724a706e2d85575cabc4b645b71a727"
33
system:
44
- name: binfmt

0 commit comments

Comments
 (0)