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