blob: a7f1119ec3064a64f060599d5b9695222d6cf8c2 [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"],
Lorenz Brun3ff5af32020-06-24 16:34:11 +02009 deps = ["//core/internal/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)