github.com/mvdan/u-root-coreutils@v0.0.0-20230122170626-c2eef2898555/pkg/boot/linux/opts.go (about)

     1  // Copyright 2022 the u-root Authors. All rights reserved
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package linux
     6  
     7  import "io"
     8  
     9  // KexecOptions abstract a collection of options to be passed in KexecLoad.
    10  //
    11  // Arch agnostic. Each arch knows to just look for options they care about.
    12  // Alternatively, we could introduce arch specific options, so irrelevant options
    13  // won't be compiled. But for simplification, have one shared struct to begin
    14  // with, we can split when time comes.
    15  type KexecOptions struct {
    16  	// DTB is used as the device tree blob, if specified.
    17  	DTB io.ReaderAt
    18  
    19  	// Mmap kernel and initramfs, so virtual pages are directly mapped
    20  	// to page cache. Here it is agnostic to whether original kernel and
    21  	// initramfs file is in tmpfs, or other devices.
    22  	//
    23  	// *) If in tmpfs, file objects are backed by page cache.
    24  	// *) If on disk, kernel cache it during first disk I/O. In case when
    25  	//    we are mmapping a file on disk, pages frames backing the page cache
    26  	//    are only allocated when bytes are accessed, as kernel is lazy, so disk
    27  	//    I/O happens at kexec load time.
    28  	//
    29  	// MmapKernel indicates if mmap kernel kernel into virtual memory.
    30  	MmapKernel bool
    31  	// MmapRamfs indicates if mmap initramfs into virtual memory.
    32  	MmapRamfs bool
    33  }