mirror of
https://github.com/systemd/systemd
synced 2026-03-31 12:14:57 +02:00
Compare commits
No commits in common. "e00324d092d6659bc0cb258c0d7043cde2e5a9ea" and "cef916c743dc5a9d3ea311b6b49cf37feaf40c96" have entirely different histories.
e00324d092
...
cef916c743
@ -52,9 +52,6 @@
|
|||||||
<listitem><para>The initial RAM disk (initrd) will be looked for in the <literal>.initrd</literal> PE
|
<listitem><para>The initial RAM disk (initrd) will be looked for in the <literal>.initrd</literal> PE
|
||||||
section.</para></listitem>
|
section.</para></listitem>
|
||||||
|
|
||||||
<listitem><para>A compiled binary DeviceTree will be looked for in the <literal>.dtb</literal> PE
|
|
||||||
section.</para></listitem>
|
|
||||||
|
|
||||||
<listitem><para>The kernel command line to pass to the invoked kernel will be looked for in the
|
<listitem><para>The kernel command line to pass to the invoked kernel will be looked for in the
|
||||||
<literal>.cmdline</literal> PE section.</para></listitem>
|
<literal>.cmdline</literal> PE section.</para></listitem>
|
||||||
|
|
||||||
@ -68,10 +65,6 @@
|
|||||||
SecureBoot, or don't include a kernel command line PE section in the kernel image file. If a command line
|
SecureBoot, or don't include a kernel command line PE section in the kernel image file. If a command line
|
||||||
is accepted via EFI invocation parameters to the EFI binary it is measured into TPM PCR 8 (if a TPM is
|
is accepted via EFI invocation parameters to the EFI binary it is measured into TPM PCR 8 (if a TPM is
|
||||||
present).</para>
|
present).</para>
|
||||||
|
|
||||||
<para>If a DeviceTree is embedded in the <literal>.dtb</literal> section, it replaces an existing
|
|
||||||
DeviceTree in the corresponding EFI configuration table. systemd-stub will ask the firmware via the
|
|
||||||
<literal>EFI_DT_FIXUP_PROTOCOL</literal> for hardware specific fixups to the DeviceTree.</para>
|
|
||||||
</refsect1>
|
</refsect1>
|
||||||
|
|
||||||
<refsect1>
|
<refsect1>
|
||||||
@ -170,8 +163,7 @@
|
|||||||
<programlisting>objcopy \
|
<programlisting>objcopy \
|
||||||
--add-section .osrel=os-release --change-section-vma .osrel=0x20000 \
|
--add-section .osrel=os-release --change-section-vma .osrel=0x20000 \
|
||||||
--add-section .cmdline=cmdline.txt --change-section-vma .cmdline=0x30000 \
|
--add-section .cmdline=cmdline.txt --change-section-vma .cmdline=0x30000 \
|
||||||
--add-section .dtb=devicetree.dtb --change-section-vma .dtb=0x40000 \
|
--add-section .splash=splash.bmp --change-section-vma .splash=0x40000 \
|
||||||
--add-section .splash=splash.bmp --change-section-vma .splash=0x100000 \
|
|
||||||
--add-section .linux=vmlinux --change-section-vma .linux=0x2000000 \
|
--add-section .linux=vmlinux --change-section-vma .linux=0x2000000 \
|
||||||
--add-section .initrd=initrd.cpio --change-section-vma .initrd=0x3000000 \
|
--add-section .initrd=initrd.cpio --change-section-vma .initrd=0x3000000 \
|
||||||
/usr/lib/systemd/boot/efi/linuxx64.efi.stub \
|
/usr/lib/systemd/boot/efi/linuxx64.efi.stub \
|
||||||
|
|||||||
@ -109,31 +109,6 @@ EFI_STATUS devicetree_install(struct devicetree_state *state,
|
|||||||
return uefi_call_wrapper(BS->InstallConfigurationTable, 2, &EfiDtbTableGuid, PHYSICAL_ADDRESS_TO_POINTER(state->addr));
|
return uefi_call_wrapper(BS->InstallConfigurationTable, 2, &EfiDtbTableGuid, PHYSICAL_ADDRESS_TO_POINTER(state->addr));
|
||||||
}
|
}
|
||||||
|
|
||||||
EFI_STATUS devicetree_install_from_memory(struct devicetree_state *state,
|
|
||||||
const VOID *dtb_buffer, UINTN dtb_length) {
|
|
||||||
|
|
||||||
EFI_STATUS err;
|
|
||||||
|
|
||||||
assert(state);
|
|
||||||
assert(dtb_buffer && dtb_length > 0);
|
|
||||||
|
|
||||||
err = LibGetSystemConfigurationTable(&EfiDtbTableGuid, &state->orig);
|
|
||||||
if (EFI_ERROR(err))
|
|
||||||
return EFI_UNSUPPORTED;
|
|
||||||
|
|
||||||
err = devicetree_allocate(state, dtb_length);
|
|
||||||
if (EFI_ERROR(err))
|
|
||||||
return err;
|
|
||||||
|
|
||||||
CopyMem(PHYSICAL_ADDRESS_TO_POINTER(state->addr), dtb_buffer, dtb_length);
|
|
||||||
|
|
||||||
err = devicetree_fixup(state, dtb_length);
|
|
||||||
if (EFI_ERROR(err))
|
|
||||||
return err;
|
|
||||||
|
|
||||||
return uefi_call_wrapper(BS->InstallConfigurationTable, 2, &EfiDtbTableGuid, PHYSICAL_ADDRESS_TO_POINTER(state->addr));
|
|
||||||
}
|
|
||||||
|
|
||||||
void devicetree_cleanup(struct devicetree_state *state) {
|
void devicetree_cleanup(struct devicetree_state *state) {
|
||||||
EFI_STATUS err;
|
EFI_STATUS err;
|
||||||
|
|
||||||
|
|||||||
@ -8,6 +8,4 @@ struct devicetree_state {
|
|||||||
};
|
};
|
||||||
|
|
||||||
EFI_STATUS devicetree_install(struct devicetree_state *state, EFI_FILE_HANDLE root_dir, CHAR16 *name);
|
EFI_STATUS devicetree_install(struct devicetree_state *state, EFI_FILE_HANDLE root_dir, CHAR16 *name);
|
||||||
EFI_STATUS devicetree_install_from_memory(
|
|
||||||
struct devicetree_state *state, const VOID *dtb_buffer, UINTN dtb_length);
|
|
||||||
void devicetree_cleanup(struct devicetree_state *state);
|
void devicetree_cleanup(struct devicetree_state *state);
|
||||||
|
|||||||
@ -20,7 +20,6 @@ efi_headers = files('''
|
|||||||
|
|
||||||
common_sources = '''
|
common_sources = '''
|
||||||
assert.c
|
assert.c
|
||||||
devicetree.c
|
|
||||||
disk.c
|
disk.c
|
||||||
graphics.c
|
graphics.c
|
||||||
measure.c
|
measure.c
|
||||||
@ -32,6 +31,7 @@ common_sources = '''
|
|||||||
systemd_boot_sources = '''
|
systemd_boot_sources = '''
|
||||||
boot.c
|
boot.c
|
||||||
console.c
|
console.c
|
||||||
|
devicetree.c
|
||||||
drivers.c
|
drivers.c
|
||||||
random-seed.c
|
random-seed.c
|
||||||
shim.c
|
shim.c
|
||||||
|
|||||||
@ -4,7 +4,6 @@
|
|||||||
#include <efilib.h>
|
#include <efilib.h>
|
||||||
|
|
||||||
#include "cpio.h"
|
#include "cpio.h"
|
||||||
#include "devicetree.h"
|
|
||||||
#include "disk.h"
|
#include "disk.h"
|
||||||
#include "graphics.h"
|
#include "graphics.h"
|
||||||
#include "linux.h"
|
#include "linux.h"
|
||||||
@ -142,7 +141,6 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) {
|
|||||||
SECTION_LINUX,
|
SECTION_LINUX,
|
||||||
SECTION_INITRD,
|
SECTION_INITRD,
|
||||||
SECTION_SPLASH,
|
SECTION_SPLASH,
|
||||||
SECTION_DTB,
|
|
||||||
_SECTION_MAX,
|
_SECTION_MAX,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -151,15 +149,12 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) {
|
|||||||
[SECTION_LINUX] = (const CHAR8*) ".linux",
|
[SECTION_LINUX] = (const CHAR8*) ".linux",
|
||||||
[SECTION_INITRD] = (const CHAR8*) ".initrd",
|
[SECTION_INITRD] = (const CHAR8*) ".initrd",
|
||||||
[SECTION_SPLASH] = (const CHAR8*) ".splash",
|
[SECTION_SPLASH] = (const CHAR8*) ".splash",
|
||||||
[SECTION_DTB] = (const CHAR8*) ".dtb",
|
|
||||||
NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
UINTN cmdline_len = 0, linux_size, initrd_size, dt_size;
|
UINTN cmdline_len = 0, linux_size, initrd_size, credential_initrd_size = 0, sysext_initrd_size = 0;
|
||||||
UINTN credential_initrd_size = 0, sysext_initrd_size = 0;
|
|
||||||
_cleanup_freepool_ VOID *credential_initrd = NULL, *sysext_initrd = NULL;
|
_cleanup_freepool_ VOID *credential_initrd = NULL, *sysext_initrd = NULL;
|
||||||
EFI_PHYSICAL_ADDRESS linux_base, initrd_base, dt_base;
|
EFI_PHYSICAL_ADDRESS linux_base, initrd_base;
|
||||||
_cleanup_(devicetree_cleanup) struct devicetree_state dt_state = {};
|
|
||||||
EFI_LOADED_IMAGE *loaded_image;
|
EFI_LOADED_IMAGE *loaded_image;
|
||||||
UINTN addrs[_SECTION_MAX] = {};
|
UINTN addrs[_SECTION_MAX] = {};
|
||||||
UINTN szs[_SECTION_MAX] = {};
|
UINTN szs[_SECTION_MAX] = {};
|
||||||
@ -233,9 +228,6 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) {
|
|||||||
initrd_size = szs[SECTION_INITRD];
|
initrd_size = szs[SECTION_INITRD];
|
||||||
initrd_base = initrd_size != 0 ? POINTER_TO_PHYSICAL_ADDRESS(loaded_image->ImageBase) + addrs[SECTION_INITRD] : 0;
|
initrd_base = initrd_size != 0 ? POINTER_TO_PHYSICAL_ADDRESS(loaded_image->ImageBase) + addrs[SECTION_INITRD] : 0;
|
||||||
|
|
||||||
dt_size = szs[SECTION_DTB];
|
|
||||||
dt_base = dt_size != 0 ? POINTER_TO_PHYSICAL_ADDRESS(loaded_image->ImageBase) + addrs[SECTION_DTB] : 0;
|
|
||||||
|
|
||||||
if (credential_initrd || sysext_initrd) {
|
if (credential_initrd || sysext_initrd) {
|
||||||
/* If we have generated initrds dynamically, let's combine them with the built-in initrd. */
|
/* If we have generated initrds dynamically, let's combine them with the built-in initrd. */
|
||||||
err = combine_initrd(
|
err = combine_initrd(
|
||||||
@ -258,13 +250,6 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dt_size > 0) {
|
|
||||||
err = devicetree_install_from_memory(
|
|
||||||
&dt_state, PHYSICAL_ADDRESS_TO_POINTER(dt_base), dt_size);
|
|
||||||
if (EFI_ERROR(err))
|
|
||||||
log_error_stall(L"Error loading embedded devicetree: %r", err);
|
|
||||||
}
|
|
||||||
|
|
||||||
err = linux_exec(image, cmdline, cmdline_len,
|
err = linux_exec(image, cmdline, cmdline_len,
|
||||||
PHYSICAL_ADDRESS_TO_POINTER(linux_base), linux_size,
|
PHYSICAL_ADDRESS_TO_POINTER(linux_base), linux_size,
|
||||||
PHYSICAL_ADDRESS_TO_POINTER(initrd_base), initrd_size);
|
PHYSICAL_ADDRESS_TO_POINTER(initrd_base), initrd_size);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user