]> git.corax.cc Git - corax/commitdiff
sys: Use the _binary_*_size symbol to determine the size of binaries in the initfs
authorMatthias Kruk <m@m10k.eu>
Mon, 4 May 2020 08:52:34 +0000 (17:52 +0900)
committerMatthias Kruk <m@m10k.eu>
Mon, 4 May 2020 08:52:34 +0000 (17:52 +0900)
include/corax/initfs.h
sys/Makefile
sys/initfs.c

index 3018b9f9857e317ad46d73cc3916d0c0f2d19986..47d3842464af40782245be073a6bcb1edd0b4b0d 100644 (file)
@@ -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 {
index d80116485e99c49678f376240fcddeaa84c095df..1170973749d0f4b1cf18d0e33abf9bb1073d8cd5 100644 (file)
@@ -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)
index 7273d774429057cde379e632f31895ed42ac5671..c7f4d1f2a213a193f69a70137614df9c10f3e541 100644 (file)
@@ -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
 };