diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2019-10-16 22:47:45 +0200 |
---|---|---|
committer | Paolo Bonzini <bonzini@gnu.org> | 2019-12-13 15:40:03 +0100 |
commit | fd2aada36b98bba7476d060c448055c7180b9020 (patch) | |
tree | bb56d8595618e228cac6d5d24291e5f5ba557f25 | |
parent | 94d3b1b5d1fc30bd7b63af9d07cb8db89a5f4868 (diff) | |
download | qboot-fd2aada36b98bba7476d060c448055c7180b9020.zip qboot-fd2aada36b98bba7476d060c448055c7180b9020.tar.gz qboot-fd2aada36b98bba7476d060c448055c7180b9020.tar.bz2 |
Add meson build
That should provide same build results as the Makefile.
tags targets are pending review for meson:
https://github.com/mesonbuild/meson/pull/6058
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
-rw-r--r-- | Makefile | 57 | ||||
-rw-r--r-- | code32seg.c | 2 | ||||
-rw-r--r-- | meson.build | 52 |
3 files changed, 54 insertions, 57 deletions
diff --git a/Makefile b/Makefile deleted file mode 100644 index b5970a8..0000000 --- a/Makefile +++ /dev/null @@ -1,57 +0,0 @@ -obj-y = code16.o entry.o main.o string.o printf.o cstart.o fw_cfg.o -obj-y += linuxboot.o malloc.o tables.o hwsetup.o pci.o code32seg.o -obj-y += mptable.o smbios.o - -all-y = bios.bin -all: $(all-y) - -CFLAGS := -O2 -g - -BIOS_CFLAGS += $(autodepend-flags) -Wall -BIOS_CFLAGS += -m32 -BIOS_CFLAGS += -march=i386 -BIOS_CFLAGS += -mregparm=3 -BIOS_CFLAGS += -fno-stack-protector -fno-delete-null-pointer-checks -BIOS_CFLAGS += -ffreestanding -BIOS_CFLAGS += -mstringop-strategy=rep_byte -minline-all-stringops -BIOS_CFLAGS += -Iinclude -BIOS_CFLAGS += -fno-pic - -code32seg.o-cflags = -fno-jump-tables - -dummy := $(shell mkdir -p .deps) -autodepend-flags = -MMD -MF .deps/cc-$(patsubst %/,%,$(dir $*))-$(notdir $*).d --include .deps/*.d - -.PRECIOUS: %.o -%.o: %.c - $(CC) $(CFLAGS) $(BIOS_CFLAGS) $($@-cflags) -c -s $< -o $@ -%.o: %.S - $(CC) $(CFLAGS) $(BIOS_CFLAGS) -c -s $< -o $@ - -bios.bin.elf: $(obj-y) flat.lds - $(LD) -T flat.lds -o bios.bin.elf $(obj-y) - -bios.bin: bios.bin.elf - objcopy -O binary bios.bin.elf bios.bin - -clean: - rm -f $(obj-y) $(all-y) bios.bin.elf - rm -f cscope.* tags TAGS - rm -rf .deps - -.PHONY: cscope -cscope: - rm -f cscope.* - find . -name "*.[chsS]" -print | sed 's,^\./,,' > cscope.files - cscope -b -i cscope.files - -.PHONY: ctags -ctags: - rm -f tags - find . -name "*.[ch]" -exec ctags --append {} + - -.PHONY: TAGS -TAGS: - rm -f TAGS - find . -name "*.[ch]" -exec etags --append {} + diff --git a/code32seg.c b/code32seg.c index 213bf44..e829c03 100644 --- a/code32seg.c +++ b/code32seg.c @@ -21,6 +21,8 @@ static inline void *from_flat_ptr(void *p) #define FLAT_VAR(x) (*(typeof(&(x))) from_flat_ptr(&(x))) +#pragma GCC optimize("no-jump-tables") + bioscall void pcibios_handler(struct bios32regs *args) { switch (args->eax) { diff --git a/meson.build b/meson.build new file mode 100644 index 0000000..ce291a3 --- /dev/null +++ b/meson.build @@ -0,0 +1,52 @@ +project('qboot', 'c') + +cc = meson.get_compiler('c') +objcopy = find_program('objcopy') + +c_args = [ + '-m32', + '-march=i386', + '-mregparm=3', + '-fno-stack-protector', + '-fno-delete-null-pointer-checks', + '-ffreestanding', + '-mstringop-strategy=rep_byte', + '-minline-all-stringops', + '-fno-pic', +] + +link_args = ['-nostdlib', '-m32'] +link_args += cc.get_supported_link_arguments('-Wl,--build-id=none') +link_args += '-Wl,-T' + meson.current_source_dir() / 'flat.lds' + +elf = executable( + 'bios.bin.elf', + files( + 'code16.c', + 'code32seg.c', + 'cstart.S', + 'entry.S', + 'fw_cfg.c', + 'hwsetup.c', + 'linuxboot.c', + 'main.c', + 'malloc.c', + 'mptable.c', + 'pci.c', + 'printf.c', + 'string.c', + 'smbios.c', + 'tables.c', + ), + c_args: c_args, + include_directories: include_directories('include'), + link_args: link_args, +) + +bin = custom_target( + 'bios.bin', + output: 'bios.bin', + input: elf, + command: [objcopy, '-O', 'binary', '@INPUT@', '@OUTPUT@'], + build_by_default: true, +) |