Next: , Previous: internals-mm, Up: Internals


6.2 Kernel Scripts

The kernel script is inlined in binary representation together with the gnufi kernel in the firmware image. It is up to the `gnufi-mkimage' utility to merge modules and build a kscript structure that the loader can later pass to the kernel.

In binary representation is a kernel script a list of TLV-records, in native endianess. Signature of the kscript generic header;

     struct efi_kscript
     {
       efi_uint16_t type;
       efi_uint16_t subtype;
       efi_uint32_t offset;
     };

type specifies what kind of script record it is. The last entry must be of type EFI_KSCRIPT_END_TYPE. subtype is a type specific. offset gives the number of bytes from this script record to the next.

EFI_KSCRIPT_END_TYPE
Defines the end of the script.
EFI_KSCRIPT_LOAD_TYPE
Load and start a module. The modules contents is inlined in the record. Also provided is the command line, which will be passed to the module as a load option. Signature of the record:
          struct efi_kscript_load
          {
            efi_kscript_t header;
            efi_uint32_t cmdline;
            efi_uint32_t size;
            efi_uint8_t data[0];
          };
     

cmdline is an offset from the record to a NUL-terminated unicode string. size is the length of the module data in bytes.

EFI_KSCRIPT_CONNECT_TYPE
Connect drivers to the device path that is inlined in the record.
          struct efi_kscript_connect
          {
            efi_kscript_t header;
            efi_device_path_t path;
          };
     

EFI_KSCRIPT_SET_TYPE
Set variable to point to the handle specified by the inlined device path.
          struct efi_kscript_set
          {
            efi_kscript_t header;
            efi_device_path_t path;
          };
     

The subtype if the generic header specifies what variable is to be set. The following variables are available;