From: Matthias Kruk Date: Mon, 4 May 2020 08:52:34 +0000 (+0900) Subject: sys: Use the _binary_*_size symbol to determine the size of binaries in the initfs X-Git-Url: https://git.corax.cc/?a=commitdiff_plain;h=826bdc0de9e6ab28b5e78ae04d8083e62a391255;p=corax sys: Use the _binary_*_size symbol to determine the size of binaries in the initfs --- diff --git a/include/corax/initfs.h b/include/corax/initfs.h index 3018b9f..47d3842 100644 --- a/include/corax/initfs.h +++ b/include/corax/initfs.h @@ -21,7 +21,7 @@ struct initfs_entry { const char * const ife_name; const void * const ife_base; - const void * const ife_limit; + const unsigned long ife_limit; }; struct initfs { diff --git a/sys/Makefile b/sys/Makefile index d801164..1170973 100644 --- a/sys/Makefile +++ b/sys/Makefile @@ -7,8 +7,10 @@ CFLAGS = -m32 -Wall -nostdlib -nodefaultlibs -nostartfiles -ffreestanding \ all: $(OUTPUT) -$(OUTPUT): initfs.o - ar r $@ $^ *.ko +kbd.ko: kbd + +$(OUTPUT): initfs.o kbd.ko + ar -rc $@ $^ updateinitfs: gcc -o initfs.o $(CFLAGS) initfs.c *.ko @@ -17,6 +19,6 @@ $(DEPS): $(MAKE) -C $@ $(MAKECMDGOALS) clean: $(DEPS) - rm -f $(OUTPUT) + rm -f $(OUTPUT) *.ko .PHONY: $(PHONY) diff --git a/sys/initfs.c b/sys/initfs.c index 7273d77..c7f4d1f 100644 --- a/sys/initfs.c +++ b/sys/initfs.c @@ -4,11 +4,13 @@ #if FEATURE(KBD) extern const char _binary_kbd_end[]; extern const char _binary_kbd_start[]; +extern const unsigned long _binary_kbd_size; #endif /* FEATURE(KBD) */ #if FEATURE(VGA) extern const char _binary_vga_end[]; extern const char _binary_vga_start[]; +extern const unsigned long _binary_vga_size; #endif /* FEATURE(VGA) */ static struct initfs_entry _ifs_entries[] = { @@ -16,14 +18,14 @@ static struct initfs_entry _ifs_entries[] = { { .ife_name = "kbd", .ife_base = &_binary_kbd_start, - .ife_limit = &_binary_kbd_end + .ife_limit = (unsigned long)&_binary_kbd_size }, #endif #if FEATURE(VGA) { .ife_name = "vga", .ife_base = &_binary_vga_start, - .ife_limit = &_binary_vga_end + .ife_limit = (unsigned long)&_binary_vga_size }, #endif };