mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-21 10:09:07 +00:00
Merge pull request #1261 from justincormack/kernel-push
Add back code to push kernel to hub
This commit is contained in:
commit
4bee477f51
1
kernel/.gitignore
vendored
1
kernel/.gitignore
vendored
@ -3,3 +3,4 @@ etc/
|
|||||||
lib/
|
lib/
|
||||||
usr/
|
usr/
|
||||||
sbin/
|
sbin/
|
||||||
|
bzImage
|
||||||
|
@ -1,38 +1,58 @@
|
|||||||
DEBUG ?= 0
|
DEBUG ?= 0
|
||||||
|
|
||||||
TAR2INITRD_IMAGE=mobylinux/tar2initrd:d5711601eb5b89de0f052d87365e18388ff3f1b5@sha256:58d377e65845f91400e173ce9fca93462f2f237947eef2b0d2c17bb4f2da5ee8
|
all: bzImage push
|
||||||
|
|
||||||
all: x86_64/vmlinuz64 x86_64/kernel.img
|
|
||||||
|
|
||||||
x86_64/kernel.tar: x86_64/bzImage
|
|
||||||
tar cf - etc lib usr sbin > $@
|
|
||||||
|
|
||||||
x86_64/kernel.img: x86_64/kernel.tar x86_64/vmlinuz64
|
|
||||||
cat $< | docker run --rm --read-only --net=none --log-driver=none --tmpfs /tmp -i $(TAR2INITRD_IMAGE) > $@
|
|
||||||
|
|
||||||
ifdef AUFS
|
ifdef AUFS
|
||||||
kernel.tag: Dockerfile.aufs kernel_config kernel_config.debug kernel_config.aufs patches-4.9
|
DEPS=Dockerfile.aufs kernel_config kernel_config.debug kernel_config.aufs patches-4.9
|
||||||
else
|
else
|
||||||
ifdef LTS4.4
|
ifdef LTS4.4
|
||||||
kernel.tag: Dockerfile.4.4 kernel_config kernel_config.debug kernel_config.4.4 patches-4.4
|
DEPS=Dockerfile.4.4 kernel_config kernel_config.debug kernel_config.4.4 patches-4.4
|
||||||
else
|
else
|
||||||
kernel.tag: Dockerfile kernel_config kernel_config.debug patches-4.9
|
DEPS=Dockerfile kernel_config kernel_config.debug patches-4.9
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
kernel.tag: $(DEPS)
|
||||||
BUILD=$$( tar cf - $^ | docker build -f $< --build-arg DEBUG=$(DEBUG) -q - ) && [ -n "$$BUILD" ] && echo "Built $$BUILD" && echo "$$BUILD" > $@
|
BUILD=$$( tar cf - $^ | docker build -f $< --build-arg DEBUG=$(DEBUG) -q - ) && [ -n "$$BUILD" ] && echo "Built $$BUILD" && echo "$$BUILD" > $@
|
||||||
|
|
||||||
x86_64/vmlinuz64: x86_64/bzImage
|
bzImage: kernel.tag
|
||||||
cp -a $< $@
|
|
||||||
|
|
||||||
x86_64/bzImage: kernel.tag
|
|
||||||
rm -rf etc/kernel-patches
|
rm -rf etc/kernel-patches
|
||||||
mkdir -p x86_64 etc lib usr sbin etc/kernel-patches
|
mkdir -p x86_64 etc lib usr sbin etc/kernel-patches
|
||||||
docker run --rm --net=none --log-driver=none $(shell cat kernel.tag) cat kernel-source-info > etc/kernel-source-info
|
|
||||||
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
|
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
|
||||||
docker run --rm --net=none --log-driver=none $(shell cat kernel.tag) tar cf - -C patches . | tar xf - -C etc/kernel-patches
|
cp x86_64/kernel-modules.tar kernel.tar
|
||||||
tar xf x86_64/kernel-modules.tar
|
cp x86_64/bzImage $@
|
||||||
|
|
||||||
|
.PHONY: push tag
|
||||||
|
|
||||||
|
MEDIA_TOYBOX=mobylinux/toybox-media:0a26fe5f574e444849983f9c4148ef74b3804d55@sha256:5ac38f77b66deb194c9016591b9b096e81fcdc9f7c3e6d01566294a6b4b4ebd2
|
||||||
|
SHASUM=alpine:3.5
|
||||||
|
|
||||||
|
BASE="$MEDIA_TOYBOX"
|
||||||
|
IMAGE=kernel
|
||||||
|
|
||||||
|
default: push
|
||||||
|
|
||||||
|
Dockerfile.media:
|
||||||
|
printf "FROM $(MEDIA_TOYBOX)\nADD . /\n" > $@
|
||||||
|
|
||||||
|
hash: Dockerfile.media bzImage kernel.tar $(DEPS)
|
||||||
|
tar cf - $^ | docker build --no-cache -t $(IMAGE):build -f Dockerfile.media -
|
||||||
|
tar cf - $^ | DOCKER_CONTENT_TRUST=1 docker run --rm -i $(SHASUM) sha1sum | sed 's/ .*//' > $@
|
||||||
|
|
||||||
|
push: hash
|
||||||
|
docker pull mobylinux/$(IMAGE):$(shell cat hash) || \
|
||||||
|
(docker tag $(IMAGE):build mobylinux/$(IMAGE):$(shell cat hash) && \
|
||||||
|
docker push mobylinux/$(IMAGE):$(shell cat hash))
|
||||||
|
docker rmi $(IMAGE):build
|
||||||
|
rm -f hash
|
||||||
|
|
||||||
|
tag: hash
|
||||||
|
docker pull mobylinux/$(IMAGE):$(shell cat hash) || \
|
||||||
|
docker tag $(IMAGE):build mobylinux/$(IMAGE):$(shell cat hash)
|
||||||
|
docker rmi $(IMAGE):build
|
||||||
|
rm -f hash
|
||||||
|
|
||||||
|
.PHONY: clean
|
||||||
clean:
|
clean:
|
||||||
rm -rf x86_64 lib etc usr sbin kernel.tag
|
rm -rf x86_64 lib usr sbin kernel.tag hash Dockerfile.media bzImage kernel.tar
|
||||||
|
|
||||||
.DELETE_ON_ERROR:
|
.DELETE_ON_ERROR:
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
kernel: "mobylinux/kernel:7fa748810d7866797fd807a5682d5cb3c9c98111"
|
kernel: "mobylinux/kernel:598481c08deafa37dccb33c88ad69fdecda57909"
|
||||||
init: "mobylinux/init:99cd639fa724a706e2d85575cabc4b645b71a727"
|
init: "mobylinux/init:99cd639fa724a706e2d85575cabc4b645b71a727"
|
||||||
system:
|
system:
|
||||||
- name: binfmt
|
- name: binfmt
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
kernel: "mobylinux/kernel:7fa748810d7866797fd807a5682d5cb3c9c98111"
|
kernel: "mobylinux/kernel:598481c08deafa37dccb33c88ad69fdecda57909"
|
||||||
init: "mobylinux/init:99cd639fa724a706e2d85575cabc4b645b71a727"
|
init: "mobylinux/init:99cd639fa724a706e2d85575cabc4b645b71a727"
|
||||||
system:
|
system:
|
||||||
- name: binfmt
|
- name: binfmt
|
||||||
|
Loading…
Reference in New Issue
Block a user