manifest: add OSTreeDeployment config options

Adding support for config options to OSTreeDeployment that are required
by the IoT raw image:
- Kernel command line options
- Keyboard layout
- Locale

Test manifests updated.
This commit is contained in:
Achilleas Koutsou 2022-08-18 11:58:30 +02:00 committed by Tom Gundersen
parent ce7b251b54
commit 76031d4104
9 changed files with 128 additions and 8 deletions

View file

@ -283,6 +283,10 @@ func iotRawImage(workload workload.Workload,
img := image.NewOSTreeRawImage()
img.KernelOptionsAppend = []string{"modprobe.blacklist=vc4"}
img.Keyboard = "us"
img.Locale = "C.UTF-8"
img.Platform = t.platform
img.Workload = workload

View file

@ -14,6 +14,7 @@ import (
type OSTreeRawImage struct {
Base
Platform platform.Platform
Workload workload.Workload
PartitionTable *disk.PartitionTable
@ -25,6 +26,10 @@ type OSTreeRawImage struct {
Remote string
OSName string
KernelOptionsAppend []string
Keyboard string
Locale string
Filename string
}
@ -43,6 +48,9 @@ func (img *OSTreeRawImage) InstantiateManifest(m *manifest.Manifest,
osPipeline := manifest.NewOSTreeDeployment(m, buildPipeline, img.OSTreeRef, img.OSTreeCommit, img.OSTreeURL, img.OSName, img.Remote, img.Platform)
osPipeline.PartitionTable = img.PartitionTable
osPipeline.KernelOptionsAppend = img.KernelOptionsAppend
osPipeline.Keyboard = img.Keyboard
osPipeline.Locale = img.Locale
imagePipeline := manifest.NewRawOStreeImage(m, buildPipeline, img.Platform, osPipeline)

View file

@ -13,14 +13,20 @@ import (
// on a deployed ostree commit.
type OSTreeDeployment struct {
Base
OSVersion string
osTreeCommit string
osTreeURL string
osTreeRef string
osName string
remote string
osName string
remote string
KernelOptionsAppend []string
Keyboard string
Locale string
platform platform.Platform
PartitionTable *disk.PartitionTable
@ -102,6 +108,8 @@ func (p *OSTreeDeployment) serialize() osbuild.Pipeline {
},
}))
kernelOpts := osbuild.GenImageKernelOptions(p.PartitionTable)
kernelOpts = append(kernelOpts, p.KernelOptionsAppend...)
pipeline.AddStage(osbuild.NewOSTreeDeployStage(
&osbuild.OSTreeDeployStageOptions{
OsName: p.osName,
@ -147,6 +155,22 @@ func (p *OSTreeDeployment) serialize() osbuild.Pipeline {
}
pipeline.AddStage(osbuild.NewFSTabStage(fstabOptions))
if p.Keyboard != "" {
options := &osbuild.KeymapStageOptions{
Keymap: p.Keyboard,
}
keymapStage := osbuild.NewKeymapStage(options)
pipeline.AddStage(keymapStage)
}
if p.Locale != "" {
options := &osbuild.LocaleStageOptions{
Language: p.Locale,
}
localeStage := osbuild.NewLocaleStage(options)
pipeline.AddStage(localeStage)
}
// TODO: Add users?
// NOTE: Users can be embedded in a commit, but we should also support adding them at deploy time.

View file

@ -1831,7 +1831,9 @@
"rootfs": {
"label": "root"
},
"kernel_opts": []
"kernel_opts": [
"modprobe.blacklist=vc4"
]
}
},
{
@ -1891,6 +1893,18 @@
}
}
},
{
"type": "org.osbuild.keymap",
"options": {
"keymap": "us"
}
},
{
"type": "org.osbuild.locale",
"options": {
"language": "C.UTF-8"
}
},
{
"type": "org.osbuild.grub2",
"options": {

View file

@ -1855,7 +1855,9 @@
"rootfs": {
"label": "root"
},
"kernel_opts": []
"kernel_opts": [
"modprobe.blacklist=vc4"
]
}
},
{
@ -1915,6 +1917,18 @@
}
}
},
{
"type": "org.osbuild.keymap",
"options": {
"keymap": "us"
}
},
{
"type": "org.osbuild.locale",
"options": {
"language": "C.UTF-8"
}
},
{
"type": "org.osbuild.grub2",
"options": {

View file

@ -2079,7 +2079,9 @@
"rootfs": {
"label": "root"
},
"kernel_opts": []
"kernel_opts": [
"modprobe.blacklist=vc4"
]
}
},
{
@ -2139,6 +2141,18 @@
}
}
},
{
"type": "org.osbuild.keymap",
"options": {
"keymap": "us"
}
},
{
"type": "org.osbuild.locale",
"options": {
"language": "C.UTF-8"
}
},
{
"type": "org.osbuild.grub2",
"options": {

View file

@ -2103,7 +2103,9 @@
"rootfs": {
"label": "root"
},
"kernel_opts": []
"kernel_opts": [
"modprobe.blacklist=vc4"
]
}
},
{
@ -2163,6 +2165,18 @@
}
}
},
{
"type": "org.osbuild.keymap",
"options": {
"keymap": "us"
}
},
{
"type": "org.osbuild.locale",
"options": {
"language": "C.UTF-8"
}
},
{
"type": "org.osbuild.grub2",
"options": {

View file

@ -2087,7 +2087,9 @@
"rootfs": {
"label": "root"
},
"kernel_opts": []
"kernel_opts": [
"modprobe.blacklist=vc4"
]
}
},
{
@ -2147,6 +2149,18 @@
}
}
},
{
"type": "org.osbuild.keymap",
"options": {
"keymap": "us"
}
},
{
"type": "org.osbuild.locale",
"options": {
"language": "C.UTF-8"
}
},
{
"type": "org.osbuild.grub2",
"options": {

View file

@ -2111,7 +2111,9 @@
"rootfs": {
"label": "root"
},
"kernel_opts": []
"kernel_opts": [
"modprobe.blacklist=vc4"
]
}
},
{
@ -2171,6 +2173,18 @@
}
}
},
{
"type": "org.osbuild.keymap",
"options": {
"keymap": "us"
}
},
{
"type": "org.osbuild.locale",
"options": {
"language": "C.UTF-8"
}
},
{
"type": "org.osbuild.grub2",
"options": {