Documentation ¶
Index ¶
- Variables
- func DriversTreeDir(rootdir, kernelName string, rev snap.Revision) string
- func EnsureKernelDriversTree(kMntPts MountPoints, compsMntPts []ModulesCompMountPoints, destDir string, ...) (err error)
- func KernelVersionFromModulesDir(mountPoint string) (string, error)
- func RemoveKernelDriversTree(treeRoot string) (err error)
- func Validate(kernelRoot string) error
- type Asset
- type Info
- type KernelDriversTreeOptions
- type ModulesCompMountPoints
- type MountPoints
Constants ¶
This section is empty.
Variables ¶
var ValidAssetName = regexp.MustCompile("^[a-zA-Z0-9][a-zA-Z0-9-]*$")
ValidAssetName is a regular expression matching valid asset name.
Functions ¶
func DriversTreeDir ¶
DriversTreeDir returns the directory for a given kernel and revision under rootdir.
func EnsureKernelDriversTree ¶
func EnsureKernelDriversTree(kMntPts MountPoints, compsMntPts []ModulesCompMountPoints, destDir string, opts *KernelDriversTreeOptions) (err error)
EnsureKernelDriversTree creates a drivers tree that can include modules/fw from kernel-modules components. opts.KernelInstall tells the function if this is a kernel install (which might be installing components at the same time) or an only components install.
For kernel installs, this function creates a tree in destDir (should be of the form <somedir>/var/lib/snapd/kernel/<ksnapName>/<rev>), which is bind-mounted after a reboot to /usr/lib/{modules,firmware} (the currently active kernel is using a different path as it has a different revision). This tree contains files from the kernel snap content in kSnapRoot, as well as symlinks to it. Information from modules is found by looking at comps slice.
For components-only install, we want the components to be available without rebooting. For this, we work on a temporary tree, and after finishing it we swap atomically the affected modules/firmware folders with those of the currently active kernel drivers tree.
To make this work in all cases we need to know the current mounts of the kernel snap / components to be installed and the final mounts when the system is run after installation (as the installing system might be classic while the installed system could be hybrid or UC, or we could be installing from the initramfs). To consider all cases, we need to run depmod with links to the currently available content, and then replace those links with the expected mounts in the running system.
func KernelVersionFromModulesDir ¶
KernelVersionFromModulesDir returns the kernel version for a mounted kernel snap (this would be the output if "uname -r" for a running kernel). It assumes that there is a folder named modules/$(uname -r) inside the snap.
func RemoveKernelDriversTree ¶
RemoveKernelDriversTree cleans-up the writable kernel tree in snapd data folder, under kernelSubdir/<rev> (kernelSubdir is usually the snap name). When called from the kernel package <rev> might be <rev>_tmp.
Types ¶
type Info ¶
type Info struct { // DynamicModules points to a folder containing {modules,firmware} // subfolders that are created by snap or component hooks. The only // valid value at the moment is $SNAP_DATA (or ${SNAP_DATA}). DynamicModules string `yaml:"dynamic-modules,omitempty"` Assets map[string]*Asset `yaml:"assets,omitempty"` }
func InfoFromKernelYaml ¶
InfoFromKernelYaml reads the provided kernel metadata.
type KernelDriversTreeOptions ¶
type KernelDriversTreeOptions struct { // Set if we are building the tree for a kernel we are installing right now KernelInstall bool }
type ModulesCompMountPoints ¶
type ModulesCompMountPoints struct { // LinkName is the name of the symlink in the drivers tree that will // point to the component modules. LinkName string MountPoints }
ModulesCompMountPoints contains mount points for a component plus its name.
type MountPoints ¶
type MountPoints struct { // Current is where the container to be installed is currently // available Current string // Target is where the container will be found in a running system Target string }
MountPoints describes mount points for a snap or a component.
func (*MountPoints) CurrentEqualsTarget ¶
func (mp *MountPoints) CurrentEqualsTarget() bool
func (*MountPoints) UnderCurrentPath ¶
func (mp *MountPoints) UnderCurrentPath(dirs ...string) string
func (*MountPoints) UnderTargetPath ¶
func (mp *MountPoints) UnderTargetPath(dirs ...string) string
Directories ¶
Path | Synopsis |
---|---|
package fde implements helper used by low level parts like secboot in snap-bootstrap and high level parts like DeviceManager in snapd.
|
package fde implements helper used by low level parts like secboot in snap-bootstrap and high level parts like DeviceManager in snapd. |