Page MenuHomeFreeBSD

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

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

Details

Summary

This patch extends embed_mfs.sh 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

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

Event Timeline

sys/tools/embed_mfs.sh
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

else

  1. generic case

fi

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.

Hi

I am getting this error now:

sh ./sys/tools/embed_mfs.sh /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/embed_mfs.sh /usr/home/br/obj/usr/home/br/dev/freebsd-riscv/riscv.riscv64/sys/GENERIC/kernel

file -b ./sys/tools/embed_mfs.sh /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 @worldofzak_gmail.com, sorry I didn't reference the followup commit here. This should have been fixed by rS326992