#735 move cbfs creation to libreboot

Open
opened 3 weeks ago by swiftgeek · 0 comments

CAR bootblock is most likely fixing a lot of the issues here, decreasing amount of binaries that need to be located at exact offset to bootblock (not checked).
Moving cbfs creation to libreboot would lower the space required, accelerate the build process, and decrease cost of adding new board to about 128KiB or less.
When libreboot would save individual binaries instead of entire image, it's important to check contents of cbfs generated by coreboot system, and in case libreboot didn't save a copy of everything - throw an error.

if you look at the comments in x86/memlayout.ld, cbfstool needs some magic for XIP to work

readelf -h build/cbfs/fallback/*.elf

File: build/cbfs/fallback/bootblock.elf
ELF Header:
  Magic:   7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00 
  Class:                             ELF32
  Data:                              2's complement, little endian
  Version:                           1 (current)
  OS/ABI:                            UNIX - System V
  ABI Version:                       0
  Type:                              EXEC (Executable file)
  Machine:                           Intel 80386
  Version:                           0x1
  Entry point address:               0xfffffff0
  Start of program headers:          52 (bytes into file)
  Start of section headers:          83248 (bytes into file)
  Flags:                             0x0
  Size of this header:               52 (bytes)
  Size of program headers:           32 (bytes)
  Number of program headers:         1
  Size of section headers:           40 (bytes)
  Number of section headers:         11
  Section header string table index: 10

File: build/cbfs/fallback/bootblock.raw.elf
ELF Header:
  Magic:   7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00 
  Class:                             ELF32
  Data:                              2's complement, little endian
  Version:                           1 (current)
  OS/ABI:                            UNIX - System V
  ABI Version:                       0
  Type:                              EXEC (Executable file)
  Machine:                           Intel 80386
  Version:                           0x1
  Entry point address:               0xfffffff0
  Start of program headers:          52 (bytes into file)
  Start of section headers:          83248 (bytes into file)
  Flags:                             0x0
  Size of this header:               52 (bytes)
  Size of program headers:           32 (bytes)
  Number of program headers:         1
  Size of section headers:           40 (bytes)
  Number of section headers:         11
  Section header string table index: 10

File: build/cbfs/fallback/postcar.elf
ELF Header:
  Magic:   7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00 
  Class:                             ELF32
  Data:                              2's complement, little endian
  Version:                           1 (current)
  OS/ABI:                            UNIX - System V
  ABI Version:                       0
  Type:                              EXEC (Executable file)
  Machine:                           Intel 80386
  Version:                           0x1
  Entry point address:               0x2000000
  Start of program headers:          372 (bytes into file)
  Start of section headers:          52 (bytes into file)
  Flags:                             0x0
  Size of this header:               52 (bytes)
  Size of program headers:           32 (bytes)
  Number of program headers:         1
  Size of section headers:           40 (bytes)
  Number of section headers:         8
  Section header string table index: 1

File: build/cbfs/fallback/ramstage.elf
ELF Header:
  Magic:   7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00 
  Class:                             ELF32
  Data:                              2's complement, little endian
  Version:                           1 (current)
  OS/ABI:                            UNIX - System V
  ABI Version:                       0
  Type:                              EXEC (Executable file)
  Machine:                           Intel 80386
  Version:                           0x1
  Entry point address:               0xe00000
  Start of program headers:          372 (bytes into file)
  Start of section headers:          52 (bytes into file)
  Flags:                             0x0
  Size of this header:               52 (bytes)
  Size of program headers:           32 (bytes)
  Number of program headers:         1
  Size of section headers:           40 (bytes)
  Number of section headers:         8
  Section header string table index: 1

File: build/cbfs/fallback/romstage.elf
ELF Header:
  Magic:   7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00 
  Class:                             ELF32
  Data:                              2's complement, little endian
  Version:                           1 (current)
  OS/ABI:                            UNIX - System V
  ABI Version:                       0
  Type:                              EXEC (Executable file)
  Machine:                           Intel 80386
  Version:                           0x1
  Entry point address:               0x2000000
  Start of program headers:          52 (bytes into file)
  Start of section headers:          83452 (bytes into file)
  Flags:                             0x0
  Size of this header:               52 (bytes)
  Size of program headers:           32 (bytes)
  Number of program headers:         1
  Size of section headers:           40 (bytes)
  Number of section headers:         8
  Section header string table index: 7

CAR bootblock is most likely fixing a lot of the issues here, decreasing amount of binaries that need to be located at exact offset to bootblock (not checked). Moving cbfs creation to libreboot would lower the space required, accelerate the build process, and decrease cost of adding new board to about 128KiB or less. When libreboot would save individual binaries instead of entire image, it's important to check contents of cbfs generated by coreboot system, and in case libreboot didn't save a copy of everything - throw an error. > if you look at the comments in x86/memlayout.ld, cbfstool needs some magic for XIP to work ``` readelf -h build/cbfs/fallback/*.elf File: build/cbfs/fallback/bootblock.elf ELF Header: Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00 Class: ELF32 Data: 2's complement, little endian Version: 1 (current) OS/ABI: UNIX - System V ABI Version: 0 Type: EXEC (Executable file) Machine: Intel 80386 Version: 0x1 Entry point address: 0xfffffff0 Start of program headers: 52 (bytes into file) Start of section headers: 83248 (bytes into file) Flags: 0x0 Size of this header: 52 (bytes) Size of program headers: 32 (bytes) Number of program headers: 1 Size of section headers: 40 (bytes) Number of section headers: 11 Section header string table index: 10 File: build/cbfs/fallback/bootblock.raw.elf ELF Header: Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00 Class: ELF32 Data: 2's complement, little endian Version: 1 (current) OS/ABI: UNIX - System V ABI Version: 0 Type: EXEC (Executable file) Machine: Intel 80386 Version: 0x1 Entry point address: 0xfffffff0 Start of program headers: 52 (bytes into file) Start of section headers: 83248 (bytes into file) Flags: 0x0 Size of this header: 52 (bytes) Size of program headers: 32 (bytes) Number of program headers: 1 Size of section headers: 40 (bytes) Number of section headers: 11 Section header string table index: 10 File: build/cbfs/fallback/postcar.elf ELF Header: Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00 Class: ELF32 Data: 2's complement, little endian Version: 1 (current) OS/ABI: UNIX - System V ABI Version: 0 Type: EXEC (Executable file) Machine: Intel 80386 Version: 0x1 Entry point address: 0x2000000 Start of program headers: 372 (bytes into file) Start of section headers: 52 (bytes into file) Flags: 0x0 Size of this header: 52 (bytes) Size of program headers: 32 (bytes) Number of program headers: 1 Size of section headers: 40 (bytes) Number of section headers: 8 Section header string table index: 1 File: build/cbfs/fallback/ramstage.elf ELF Header: Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00 Class: ELF32 Data: 2's complement, little endian Version: 1 (current) OS/ABI: UNIX - System V ABI Version: 0 Type: EXEC (Executable file) Machine: Intel 80386 Version: 0x1 Entry point address: 0xe00000 Start of program headers: 372 (bytes into file) Start of section headers: 52 (bytes into file) Flags: 0x0 Size of this header: 52 (bytes) Size of program headers: 32 (bytes) Number of program headers: 1 Size of section headers: 40 (bytes) Number of section headers: 8 Section header string table index: 1 File: build/cbfs/fallback/romstage.elf ELF Header: Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00 Class: ELF32 Data: 2's complement, little endian Version: 1 (current) OS/ABI: UNIX - System V ABI Version: 0 Type: EXEC (Executable file) Machine: Intel 80386 Version: 0x1 Entry point address: 0x2000000 Start of program headers: 52 (bytes into file) Start of section headers: 83452 (bytes into file) Flags: 0x0 Size of this header: 52 (bytes) Size of program headers: 32 (bytes) Number of program headers: 1 Size of section headers: 40 (bytes) Number of section headers: 8 Section header string table index: 7 ```
Sign in to join this conversation.
Loading...
Cancel
Save
There is no content yet.