codeblog code is freedom — patching my itch

March 8, 2008

instaELF via GNU as

Filed under: Ubuntu — kees @ 2:47 pm

Today I needed to generate a fake ELF file with specific section contents (I was testing “modinfo”, which expects to read the “.modinfo” ELF section). For future reference, here’s how to create an empty .ko file that claims to have a GPL license:

$ cat <<EOM | as - -o /tmp/fake.ko
> .section .modinfo
> .string "license=GPL"
> EOM
$ modinfo /tmp/fake.ko
filename:       /tmp/fake.ko
license:        GPL

© 2008, Kees Cook. This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 License.
CC BY-SA 4.0

No Comments

No comments yet.

Powered by WordPress