fixing huge initrd by defaulting to a smaller linker page-size
This commit is contained in:
parent
0e6f7b1e32
commit
4ec5733de0
1 changed files with 19 additions and 13 deletions
|
@ -1,74 +1,80 @@
|
|||
ARCH = x86
|
||||
BIT = 32
|
||||
|
||||
NEWLIB = ../x86/i586-metalsvm-elf32
|
||||
MAKE = make
|
||||
STRIP_DEBUG = --strip-debug
|
||||
KEEP_DEBUG = --only-keep-debug
|
||||
LDFLAGS =
|
||||
|
||||
# Default section offsets in x86-64 ELF files are aligned to the page-size.
|
||||
# For x86-64 the pagesize is huge (2 MB) with the consquence of large sparse
|
||||
# ELF files (which lead to a huge initrd). To solve this, we manually set the page-size to 4 KB.
|
||||
override LDFLAGS += -T link.ld -Wl,-n,-z,max-page-size=0x1000
|
||||
|
||||
# other implicit rules
|
||||
%.o : %.c
|
||||
$(CC_FOR_TARGET) -c $(CFLAGS) -o $@ $<
|
||||
|
||||
default: all
|
||||
|
||||
|
||||
all: memtest hello tests jacobi mshell server client rlogind fork
|
||||
|
||||
jacobi: jacobi.o
|
||||
$(CC_FOR_TARGET) -T link.ld -o $@ $(LDFLAGS) $< -lm
|
||||
$(CC_FOR_TARGET) $(LDFLAGS) -o $@ $< -lm
|
||||
$(OBJCOPY_FOR_TARGET) $(KEEP_DEBUG) $@ $@.sym
|
||||
$(OBJCOPY_FOR_TARGET) $(STRIP_DEBUG) $@
|
||||
chmod a-x $@.sym
|
||||
|
||||
memtest: memtest.o
|
||||
$(CC_FOR_TARGET) -T link.ld -o $@ $(LDFLAGS) $<
|
||||
$(CC_FOR_TARGET) $(LDFLAGS) -o $@ $<
|
||||
$(OBJCOPY_FOR_TARGET) $(KEEP_DEBUG) $@ $@.sym
|
||||
$(OBJCOPY_FOR_TARGET) $(STRIP_DEBUG) $@
|
||||
chmod a-x $@.sym
|
||||
|
||||
fork: fork.o
|
||||
$(CC_FOR_TARGET) -T link.ld -o $@ $(LDFLAGS) $<
|
||||
$(CC_FOR_TARGET) $(LDFLAGS) -o $@ $<
|
||||
$(OBJCOPY_FOR_TARGET) $(KEEP_DEBUG) $@ $@.sym
|
||||
$(OBJCOPY_FOR_TARGET) $(STRIP_DEBUG) $@
|
||||
chmod a-x $@.sym
|
||||
|
||||
tests: tests.o
|
||||
$(CC_FOR_TARGET) -T link.ld -o $@ $(LDFLAGS) $<
|
||||
$(CC_FOR_TARGET) $(LDFLAGS) -o $@ $<
|
||||
$(OBJCOPY_FOR_TARGET) $(KEEP_DEBUG) $@ $@.sym
|
||||
$(OBJCOPY_FOR_TARGET) $(STRIP_DEBUG) $@
|
||||
chmod a-x $@.sym
|
||||
|
||||
hello: hello.o
|
||||
$(CC_FOR_TARGET) -T link.ld -o $@ $(LDFLAGS) $<
|
||||
$(CC_FOR_TARGET) $(LDFLAGS) -o $@ $<
|
||||
$(OBJCOPY_FOR_TARGET) $(KEEP_DEBUG) $@ $@.sym
|
||||
$(OBJCOPY_FOR_TARGET) $(STRIP_DEBUG) $@
|
||||
chmod a-x $@.sym
|
||||
|
||||
mshell: mshell.o
|
||||
$(CC_FOR_TARGET) -T link.ld -o $@ $(LDFLAGS) $<
|
||||
$(CC_FOR_TARGET) $(LDFLAGS) -o $@ $<
|
||||
$(OBJCOPY_FOR_TARGET) $(KEEP_DEBUG) $@ $@.sym
|
||||
$(OBJCOPY_FOR_TARGET) $(STRIP_DEBUG) $@
|
||||
chmod a-x $@.sym
|
||||
|
||||
rlogind: rlogind.o
|
||||
$(CC_FOR_TARGET) -T link.ld -o $@ $(LDFLAGS) $< -lsocket
|
||||
$(CC_FOR_TARGET) $(LDFLAGS) -o $@ $< -lsocket
|
||||
$(OBJCOPY_FOR_TARGET) $(KEEP_DEBUG) $@ $@.sym
|
||||
$(OBJCOPY_FOR_TARGET) $(STRIP_DEBUG) $@
|
||||
chmod a-x $@.sym
|
||||
|
||||
server: server.o
|
||||
$(CC_FOR_TARGET) -T link.ld -o $@ $(LDFLAGS) $< -lsocket
|
||||
$(CC_FOR_TARGET) $(LDFLAGS) -o $@ $< -lsocket
|
||||
$(OBJCOPY_FOR_TARGET) $(KEEP_DEBUG) $@ $@.sym
|
||||
$(OBJCOPY_FOR_TARGET) $(STRIP_DEBUG) $@
|
||||
chmod a-x $@.sym
|
||||
|
||||
client: client.o
|
||||
$(CC_FOR_TARGET) -T link.ld -o $@ $(LDFLAGS) $< -lsocket
|
||||
$(CC_FOR_TARGET) $(LDFLAGS) -o $@ $< -lsocket
|
||||
$(OBJCOPY_FOR_TARGET) $(KEEP_DEBUG) $@ $@.sym
|
||||
$(OBJCOPY_FOR_TARGET) $(STRIP_DEBUG) $@
|
||||
chmod a-x $@.sym
|
||||
|
||||
|
||||
clean:
|
||||
$(RM) hello tests server client rlogind memtest mshell jacobi hello *.sym *.o *~
|
||||
$(RM) hello tests server client rlogind memtest fork mshell jacobi hello *.sym *.o *~
|
||||
|
||||
depend:
|
||||
$(CC_FOR_TARGET) -MM $(CFLAGS) *.c > Makefile.dep
|
||||
|
|
Loading…
Add table
Reference in a new issue