Files
snapd/bootloader/assets/export_test.go
alfonsosanchezbeato d5b3bcc309 b/a: do not set console in kernel command line for arm64
* b/assets: use different kernel command line for arm64

Do not set console in the kernel command line for arm64. The defaults
are better than setting ttyS0 as in x86, also this is our choice in
server images. The kernel will choose the preferred console depending
on whether dtb or ACPI is available:

1. When having a device tree, it will take the content of the
   /chosen/stdout-path node [1]. This node is properly filled in most
   of the cases.

2. If using ACPI tables, it will look for the console in the ACPI SPCR
   table [2,3]. This is different to what is done in x86 [4], as in that
   case the SPCR table is used only if earlycon is set.

[1] https://www.kernel.org/doc/Documentation/devicetree/bindings/chosen.txt
[2] https://docs.microsoft.com/en-us/windows-hardware/drivers/serports/serial-port-console-redirection-table
[3] https://elixir.bootlin.com/linux/v5.17/source/arch/arm64/kernel/acpi.c#L229
[4] https://elixir.bootlin.com/linux/v5.17/source/arch/x86/kernel/acpi/boot.c#L1615

* b/assets: register different grub snippets per arch

This is needed now as the kernel command line parameters will differ
across architectures.

* b/a/grub.go: fix tests for ubuntu-18.04-32

Co-authored-by: Michael Vogt <mvo@ubuntu.com>
2022-04-05 11:27:25 +02:00

38 lines
1.2 KiB
Go

// -*- Mode: Go; indent-tabs-mode: t -*-
/*
* Copyright (C) 2020 Canonical Ltd
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package assets
var (
RegisterInternal = registerInternal
RegisterSnippetForEditions = registerSnippetForEditions
RegisterGrubSnippets = registerGrubSnippets
)
func MockCleanState() (restore func()) {
oldRegisteredAssets := registeredAssets
oldRegisteredEditionAssets := registeredEditionSnippets
registeredAssets = map[string][]byte{}
registeredEditionSnippets = map[string][]ForEditions{}
return func() {
registeredAssets = oldRegisteredAssets
registeredEditionSnippets = oldRegisteredEditionAssets
}
}