diff --git a/modules/kernel/cmd/kernel-tools/bootentries_test.go b/modules/kernel/cmd/kernel-tools/bootentries_test.go index ada33169..f6df9c78 100644 --- a/modules/kernel/cmd/kernel-tools/bootentries_test.go +++ b/modules/kernel/cmd/kernel-tools/bootentries_test.go @@ -236,3 +236,22 @@ func TestTheBootEntriesUnitAndHookAreTheModules(t *testing.T) { t.Fatalf("apply: %v", apply) } } + +// The fallback kernel and its headers are declared after the boot-entries service, so the entry is placed +// before the kernel is installed and every DKMS module is built for it (ADR 0508 ยง9). +func TestTheFallbackKernelAndItsHeadersAreDeclaredAfterTheBootEntriesUnit(t *testing.T) { + m := manifest(t) + at := map[string]int{} + for i, r := range m.Resources { + at[r["id"].(string)] = i + } + for id, pkg := range map[string]string{"linux-lts": "linux-lts", "linux-lts-headers": "linux-lts-headers"} { + r := m.resource(t, id) + if r["type"] != "package" || r["package"] != pkg || r["absent"] == true { + t.Errorf("%s: %v", id, r) + } + if at[id] < at["boot-apply"] || at[id] < at["boot-hook"] { + t.Errorf("%s is declared before the boot-entries unit and hook", id) + } + } +} diff --git a/modules/kernel/cmd/kernel-tools/manifest_test.go b/modules/kernel/cmd/kernel-tools/manifest_test.go index 359ea904..aad91fc6 100644 --- a/modules/kernel/cmd/kernel-tools/manifest_test.go +++ b/modules/kernel/cmd/kernel-tools/manifest_test.go @@ -24,7 +24,7 @@ func TestTheDefaultIsMadviseAndTheUnitFollowsTheSetting(t *testing.T) { for _, r := range m.Resources { ids = append(ids, r["id"].(string)) } - if strings.Join(ids, " ") != "state huge-pages unit apply boot-entries boot-unit boot-hook boot-apply" { + if strings.Join(ids, " ") != "state huge-pages unit apply boot-entries boot-unit boot-hook boot-apply linux-lts linux-lts-headers" { t.Fatalf("order: %v", ids) } script := m.resource(t, "huge-pages") diff --git a/modules/kernel/module.json b/modules/kernel/module.json index ea26522d..50cddebe 100644 --- a/modules/kernel/module.json +++ b/modules/kernel/module.json @@ -89,6 +89,16 @@ "health": { "kind": "unit" } + }, + { + "id": "linux-lts", + "type": "package", + "package": "linux-lts" + }, + { + "id": "linux-lts-headers", + "type": "package", + "package": "linux-lts-headers" } ], "build": {