On 21/10/2018 17:55, Max Filippov wrote: > bFLT format header doesn't have enough information to register a handler > for a specific architecture. Add switch -f / --flat that registers one > of the qemu binaries as a handler for bFLT executable images. > > Signed-off-by: Max Filippov <jcmvb...@gmail.com> > --- > Changes v2->v3: > - fix bFLT in the patch subject > > Changes v1->v2: > - drop unintended changes to dtc; > > scripts/qemu-binfmt-conf.sh | 32 ++++++++++++++++++++++++++++++-- > 1 file changed, 30 insertions(+), 2 deletions(-)
BTW, I'm not sure it's the good way to do that. The script has been written with ELF in mind and no other alternative format. Perhaps we can add a format parameter, like "--format elf" (default), "--format bflt" and then take the availabled CPU and mask/magic from the list corresponding for the selected format. And then rename qemu_set_binfmts() to qemu_elf_set_binfmts(), add function qemu_bflt_set_binfmt() and call the one you you need according the format you have selected. Somehing like: FORMAT_BINFMT_MISC_SET=qemu_elf_set_binfmts ... -F|--format) shift FORMAT_BINFMT_MISC_SET=qemu_$1_set_binfmts ;; ... $CHECK $FORMAT_BINFMT_MISC_SET and then qemu_bflt_set_binfmts() { for cpu in ${qemu_target_list} ; do magic='bFLT\x00\x00\x00\x04' mask='\xff\xff\xff\xff\xff\xff\xff\xff' qemu="$QEMU_PATH/qemu-$cpu" qemu="$qemu$QEMU_SUFFIX" $BINFMT_SET done } Then with --systemd you provide only the cpu you want to generate, with --debian you use update-binfmts to select the only one to import, for /proc case we could add another parameter to only register one interpreter (--proc CPU ?) Thanks, Laurent