blob: f95e16f733e923b01e135cc55319a562690b1c67 [file] [log] [blame]
Leopold Schabel5c80aca2019-10-22 15:48:58 +02001genrule(
Lorenz Brun0bcaaee2019-11-06 12:42:39 +01002 name = "kernel",
Leopold Schabel5c80aca2019-10-22 15:48:58 +02003 srcs = [
4 "@linux_kernel//:all",
Leopold Schabel5c80aca2019-10-22 15:48:58 +02005 "linux-smalltown.config",
6 ],
7 outs = [
8 "bzImage",
9 ],
10 cmd = """
11 DIR=external/linux_kernel
12
13 mkdir $$DIR/.bin
14
15 cp $(location linux-smalltown.config) $$DIR/.config
Leopold Schabel5c80aca2019-10-22 15:48:58 +020016
Leopold Schabelf08704a2019-11-06 12:34:53 +000017 (cd $$DIR && make -j $$(nproc)) >/dev/null
Leopold Schabel5c80aca2019-10-22 15:48:58 +020018
19 cp $$DIR/arch/x86/boot/bzImage $(RULEDIR)
20 """,
21 visibility = ["//visibility:public"],
22)
Lorenz Brun0bcaaee2019-11-06 12:42:39 +010023
24genrule(
25 name = "initramfs",
26 srcs = [
27 "@//core/cmd/init",
28 "@//core/build/utils:mkfs.xfs",
29 "@kubernetes//cmd/kube-apiserver",
30 ],
31 outs = [
32 "initramfs.cpio.lz4",
33 ],
34 cmd = """
35 $(location @linux_kernel//:gen_init_cpio) - <<- 'EOF' | lz4 -l > \"$@\"
36dir /dev 0755 0 0
37nod /dev/console 0600 0 0 c 5 1
38nod /dev/null 0644 0 0 c 1 3
39file /init $(location @//core/cmd/init) 0755 0 0
40dir /bin 0755 0 0
41file /bin/mkfs.xfs $(location @//core/build/utils:mkfs.xfs) 0755 0 0
42file /bin/kube-apiserver $(location @kubernetes//cmd/kube-apiserver) 0755 0 0
43EOF
44 """,
45 tools = [
46 "@linux_kernel//:gen_init_cpio",
47 ],
48 visibility = ["//visibility:public"],
49)