blob: d94831cabcd06ad3968b45ff187714bb6dfcb5c9 [file] [log] [blame]
Lorenz Brun547b33f2020-04-23 15:27:06 +02001load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
Serge Bazanski77cb6c52020-12-19 00:09:22 +01002load("//metropolis/node/build/kconfig-patcher:kconfig-patcher.bzl", "kconfig_patch")
Lorenz Brun547b33f2020-04-23 15:27:06 +02003
4go_library(
5 name = "go_default_library",
6 srcs = ["main.go"],
Serge Bazanski77cb6c52020-12-19 00:09:22 +01007 importpath = "git.monogon.dev/source/nexantic.git/metropolis/test/ktest",
Lorenz Brun547b33f2020-04-23 15:27:06 +02008 visibility = ["//visibility:private"],
Serge Bazanski77cb6c52020-12-19 00:09:22 +01009 deps = ["//metropolis/test/launch:go_default_library"],
Lorenz Brun547b33f2020-04-23 15:27:06 +020010)
11
12go_binary(
13 name = "ktest",
14 embed = [":go_default_library"],
15 pure = "on",
16 visibility = ["//visibility:public"],
17)
18
19kconfig_patch(
20 name = "testing-config",
21 src = "//third_party/linux:kernel-config",
22 out = "testing.config",
23 override_configs = {
24 # Unlock command line
25 "CONFIG_CMDLINE_OVERRIDE": "n",
26 "CONFIG_CMDLINE_BOOL": "n",
27 # Shave off 1 second from boot time
28 "CONFIG_SERIO_I8042": "",
29 "CONFIG_KEYBOARD_ATKBD": "",
30 "CONFIG_RTC_DRV_CMOS": "",
31 # Shave off an additional 18ms (half of the boot time)
32 "CONFIG_DEBUG_WX": "",
33 },
34)
35
36genrule(
37 name = "linux-testing",
38 srcs = [
39 "@linux//:all",
40 ":testing-config",
41 ],
42 outs = [
43 "linux-testing.elf",
44 ],
45 cmd = """
46 DIR=external/linux
47
48 mkdir $$DIR/.bin
49
50 cp $(location :testing-config) $$DIR/.config
51
52 (cd $$DIR && make -j $$(nproc) vmlinux >/dev/null)
53
54 cp $$DIR/vmlinux $@
55 """,
56 visibility = ["//visibility:public"],
57)
58
59filegroup(
60 name = "test-script",
61 srcs = ["run_ktest.sh"],
62 visibility = ["//visibility:public"],
63)