qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v3] scripts/qemu-binfmt-conf.sh: add bFLT handle


From: Laurent Vivier
Subject: Re: [Qemu-devel] [PATCH v3] scripts/qemu-binfmt-conf.sh: add bFLT handler registration
Date: Wed, 24 Oct 2018 17:34:49 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0

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 <address@hidden>
> ---
> 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]