How to recompile kernel to enable BINFMT_MISC support?

I like to enable this kernel feature. What is the easiest way to accomplish this?

I can follow this instruction to build a new kernel with no problem. However, I’m not if I need to update other related stuff, such as initrd, kernel modules, kernel map, etc.

Currently I’m running image-69. Maybe the best solution is to build the same kernel as Image-69, except with BINFMT_MISC option turned on? That way I can just swap the kernel image. Does that work?

P.S., Why is this option not enabled at the first place? Anybody knows?

Reply to my own post, so that others in the same shoes know what to do:

  • I’m using Image-69, whose README says corresponding kernel tag is VF2_2.5.0
  • Check out kernel with this tag, GitHub - starfive-tech/linux
  • Follow Part 1 of this instruction to re-build kernel debian packages
    • Make sure add BINFMT_MISC option in “make menuconfig” step
    • Also make sure using the same local version, “LOCALVERSION=-starfive”
  • Then copy over ./debian/linux-image/boot/vmlinuz-5.15.0-starfive to /boot/boot directory on visionfive 2 board.

Reboot! That is it!


Also make sure you use the same kernel configs as the running image. You can find that at /proc/config.gz file on the board.

1 Like