Skip to content
This repository was archived by the owner on Feb 8, 2021. It is now read-only.

Commit 3b06e32

Browse files
committed
update building kernel
Signed-off-by: Gao feng <omarapazanadi@gmail.com>
1 parent f989612 commit 3b06e32

File tree

4 files changed

+39
-7
lines changed

4 files changed

+39
-7
lines changed

.gitignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@ build/hyper-initrd.img
1515
data/hyperstart.service
1616
build/cbfs.rom
1717
build/root/*
18-
build/*iso
1918
build/daemon
20-
build/kernel_config.old
19+
build/Dockerfile
20+
build/arch/aarch64/kernel_config.old
21+
build/arch/x86_64/kernel_config.old
2122
build/.*
2223
src/.*
2324
Makefile

build/Dockerfile.aarch64

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
FROM centos:7
2+
MAINTAINER Hyper Developers <dev@hyper.sh>
3+
4+
RUN yum install -y patch gcc ncurses-devel make openssl-devel bc perl
5+
6+
ENV KERNEL_VERSION 4.9.51
7+
ENV LOCALVERSION -hyper
8+
ENV KERNEL_RELEASE ${KERNEL_VERSION}${LOCALVERSION}
9+
10+
ENV KBUILD_BUILD_USER dev
11+
ENV KBUILD_BUILD_HOST hyper.sh
12+
ENV KBUILD_BUILD_VERSION 1
13+
14+
RUN mkdir /root/build/ && mkdir /root/build/result/
15+
RUN curl -fSL https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-${KERNEL_VERSION}.tar.gz | tar -zx -C /root/build
16+
17+
COPY kernel_config /root/build/linux-${KERNEL_VERSION}/.config
18+
COPY kernel_patch/ /root/build/kernel_patch/
19+
20+
RUN cd /root/build/linux-${KERNEL_VERSION}/ && for patch in /root/build/kernel_patch/*.patch; do patch -p1 <$patch || exit 1; done
21+
RUN cd /root/build/linux-${KERNEL_VERSION}/ && make silentoldconfig && make -j 8
22+
23+
# install to /root/build/result/ so that we can get them from it
24+
RUN cp /root/build/linux-${KERNEL_VERSION}/arch/arm64/boot/Image.gz /root/build/result/kernel
25+
RUN mkdir /root/build/result/modules &&\
26+
cd /root/build/linux-${KERNEL_VERSION}/ && make modules_install INSTALL_MOD_PATH="/root/build/result/modules" &&\
27+
cd /root/build/result/modules/lib/modules/ && rm -f ${KERNEL_RELEASE}/{build,source} &&\
28+
tar -cf /root/build/result/modules.tar ${KERNEL_RELEASE}/ && rm -rf /root/build/result/modules
29+
RUN cp /root/build/linux-${KERNEL_VERSION}/.config /root/build/result/kernel_config
File renamed without changes.

build/Makefile.am

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
AUTOMAKE_OPTIONS = -Wno-portability
22
SHELL=/bin/bash
3-
ARCHPATH=arch/$(shell uname -m)
3+
ARCH=$(shell uname -m)
4+
ARCHPATH=arch/$(ARCH)
45

56
all-local: initrd
67

@@ -16,9 +17,10 @@ cbfs-local:
1617

1718
kernel-local:
1819
cp $(ARCHPATH)/kernel_config ./kernel_config
19-
hyperctl build -t hyperstart-dev:latest .
20-
hyperctl run --rm hyperstart-dev:latest cat /root/build/result/kernel >kernel.new && mv -f kernel.new $(ARCHPATH)/kernel
21-
hyperctl run --rm hyperstart-dev:latest cat /root/build/result/modules.tar > $(ARCHPATH)/modules.tar
20+
cp Dockerfile.$(ARCH) Dockerfile
21+
hyperctl build -t hyperstart-dev-$(ARCH):latest -f Dockerfile .
22+
hyperctl run --rm hyperstart-dev-$(ARCH):latest cat /root/build/result/kernel >kernel.new && mv -f kernel.new $(ARCHPATH)/kernel
23+
hyperctl run --rm hyperstart-dev-$(ARCH):latest cat /root/build/result/modules.tar > $(ARCHPATH)/modules.tar
2224
mv $(ARCHPATH)/kernel_config $(ARCHPATH)/kernel_config.old
23-
hyperctl run --rm hyperstart-dev:latest cat /root/build/result/kernel_config > $(ARCHPATH)/kernel_config
25+
hyperctl run --rm hyperstart-dev-$(ARCH):latest cat /root/build/result/kernel_config > $(ARCHPATH)/kernel_config
2426
rm ./kernel_config

0 commit comments

Comments
 (0)