Page MenuHomeFreeBSD

modify to embed an MFS image into either loader.efi or the kernel

Authored by on Oct 20 2017, 8:00 PM.



This patch extends so that it can be used to embed an MFS image into the efi loader or the kernel.

Test Plan
  • build loader with the option MD_IMAGE_SIZE defined
  • use makefs to create an FS image
  • use this script to embed the FS image in loader.efi

Diff Detail

rS FreeBSD src repository - subversion
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

50 ↗(On Diff #34193)

I think we should switch the sense -- e.g.
if file -b $1 | grep -q '^ELF ..-bit .SB executable'; then

  1. ELF case


  1. generic case


81 ↗(On Diff #34193)

for a continuation FreeBSD typically uses four space 2nd level indent

fixed formatting errors. swapped if statement.

This revision was not accepted when it landed; it landed in state Needs Review.Dec 19 2017, 7:44 PM
This revision was automatically updated to reflect the committed changes.


I am getting this error now:

sh ./sys/tools/ /usr/home/br/obj/usr/home/br/dev/freebsd-riscv/riscv.riscv64/sys/GENERIC/kernel riscv.img
Can't locate mfs section within /usr/home/br/obj/usr/home/br/dev/freebsd-riscv/riscv.riscv64/sys/GENERIC/kernel

this script now thinks my kernel is not ELF

@br , can you post the output of:

file -b ./sys/tools/ /usr/home/br/obj/usr/home/br/dev/freebsd-riscv/riscv.riscv64/sys/GENERIC/kernel

file -b ./sys/tools/ /usr/home/br/obj/usr/home/br/dev/freebsd-riscv/riscv.riscv64/sys/GENERIC/kernel
POSIX shell script, ASCII text executable
ELF 64-bit LSB executable, UCB RISC-V, version 1 (SYSV), dynamically linked, interpreter /red/herring, BuildID[sha1]=cfcb61ddf3a05dc0d59ba084b79d4194b40cf46b, not stripped

Yes, it works fine if I revert this change.

@br are you able to provide the exact files you used to generate this error? If not, can you give me an overview of how you created the kernel you're using? I'll try and replicate it myself. my email is the same a my username.

Hi, sorry I didn't reference the followup commit here. This should have been fixed by rS326992