Commit 5ca983fb authored by Kai Germaschewski's avatar Kai Germaschewski

kbuild: Fix UML build

Not perfectly clean yet, but uses the standard way to descend into subdirs
and gives me working vmlinux and linux targets without spurious rebuilds.
parent e7cf1b65
......@@ -51,14 +51,6 @@ LINK_WRAPS = -Wl,--wrap,malloc -Wl,--wrap,free -Wl,--wrap,calloc
SIZE = (($(CONFIG_NEST_LEVEL) + $(CONFIG_KERNEL_HALF_GIGS)) * 0x20000000)
$(ARCH_DIR)/uml.lds.s : $(ARCH_DIR)/uml.lds.S
$(call if_changed_dep,as_s_S)
AFLAGS_uml.lds.o = -U$(SUBARCH) -DSTART=$$(($(TOP_ADDR) - $(SIZE))) \
-DELF_ARCH=$(ELF_ARCH) -DELF_FORMAT=\"$(ELF_FORMAT)\" -P -C -Uum
LDFLAGS_vmlinux = -r $(ARCH_DIR)/main.o
SYMLINK_HEADERS = include/asm-um/archparam.h include/asm-um/system.h \
include/asm-um/sigcontext.h include/asm-um/processor.h \
include/asm-um/ptrace.h include/asm-um/arch-signal.h
......@@ -71,11 +63,25 @@ GEN_HEADERS = $(ARCH_DIR)/include/task.h
$(ARCH_DIR)/vmlinux.lds.S :
touch $@
linux: scripts $(ARCH_SYMLINKS) $(SYS_HEADERS) $(GEN_HEADERS) \
arch/um/uml.lds.s $(ARCH_DIR)/main.o vmlinux
prepare: $(ARCH_SYMLINKS) $(GEN_HEADERS)
LDFLAGS_vmlinux = -r $(ARCH_DIR)/main.o
vmlinux: $(ARCH_DIR)/main.o
$(ARCH_DIR)/uml.lds.s : $(ARCH_DIR)/uml.lds.S
$(call if_changed_dep,as_s_S)
AFLAGS_uml.lds.o = -U$(SUBARCH) -DSTART=$$(($(TOP_ADDR) - $(SIZE))) \
-DELF_ARCH=$(ELF_ARCH) -DELF_FORMAT=\"$(ELF_FORMAT)\" -P -C -Uum
linux: arch/um/uml.lds.s vmlinux
$(CC) -Wl,-T,arch/um/uml.lds.s -o $@ $(LINK_PROFILE) \
$(LINK_WRAPS) -static vmlinux -L/usr/lib -lutil
USER_CFLAGS := $(patsubst -I%,,$(CFLAGS))
USER_CFLAGS := $(patsubst -Derrno=kernel_errno,,$(USER_CFLAGS))
USER_CFLAGS := $(patsubst -D__KERNEL__,,$(USER_CFLAGS)) -I$(ARCH_INCLUDE)
......@@ -125,8 +131,9 @@ arch/um/os:
$(ARCH_DIR)/include/task.h : $(ARCH_DIR)/util/mk_task
$< > $@
$(ARCH_DIR)/util/mk_task : $(ARCH_DIR)/util/mk_task_user.c \
$(ARCH_DIR)/util/mk_task_kern.c
$(MAKE) $(MFLAGS) -C $(ARCH_DIR)/util all
$(ARCH_DIR)/util/mk_task : $(ARCH_DIR)/util FORCE ;
$(ARCH_DIR)/util: FORCE
@$(call descend,$@,)
export SUBARCH USER_CFLAGS OS
......@@ -8,27 +8,24 @@ ARCH_CFLAGS = -U__$(SUBARCH)__ -U$(SUBARCH)
ELF_ARCH = $(SUBARCH)
ELF_FORMAT = elf32-$(SUBARCH)
SYS_DIR := $(ARCH_DIR)/include/sysdep-i386
SYS_UTIL_DIR := $(ARCH_DIR)/sys-i386/util
SYS_HEADERS = $(ARCH_DIR)/include/sysdep-i386/sc.h \
$(ARCH_DIR)/include/sysdep-i386/thread.h
SYS_HEADERS = $(SYS_DIR)/sc.h $(SYS_DIR)/thread.h
$(ARCH_DIR)/include/sysdep-i386/sc.h : $(ARCH_DIR)/sys-i386/util/mk_sc \
include/asm
$(ARCH_DIR)/sys-i386/util/mk_sc > $@
prepare: $(SYS_HEADERS)
$(ARCH_DIR)/include/sysdep-i386/thread.h : $(ARCH_DIR)/sys-i386/util/mk_thread\
include/asm
$(ARCH_DIR)/sys-i386/util/mk_thread > $@
$(SYS_DIR)/sc.h: $(SYS_UTIL_DIR)/mk_sc
$< > $@
$(ARCH_DIR)/sys-i386/util/mk_sc : $(ARCH_DIR)/sys-i386/util/mk_sc.c \
include/asm
$(MAKE) -C $(ARCH_DIR)/sys-i386/util mk_sc
$(SYS_DIR)/thread.h: $(SYS_UTIL_DIR)/mk_thread
$< > $@
$(ARCH_DIR)/sys-i386/util/mk_thread : \
$(ARCH_DIR)/sys-i386/util/mk_thread_user.c \
$(ARCH_DIR)/sys-i386/util/mk_thread_kern.c
$(MAKE) -C $(ARCH_DIR)/sys-i386/util mk_thread
$(SYS_UTIL_DIR)/mk_sc $(SYS_UTIL_DIR)/mk_thread: $(SYS_UTIL_DIR) FORCE ;
$(SYS_UTIL_DIR): include/asm FORCE
@$(call descend,$@,)
sysclean :
rm -f $(SYS_HEADERS)
make -C $(ARCH_DIR)/sys-i386/util clean
@$(call descend,$(SYS_DIR),clean)
host-progs = mk_sc
EXTRA_TARGETS := mk_sc mk_thread mk_thread_kern.o
mk_sc-objs = mk_sc.o
host-progs := mk_sc
mk_sc-objs := mk_sc.o
include $(TOPDIR)/Rules.make
mk_thread : mk_thread_kern.o mk_thread_user.o
$(CC) $(CFLAGS) -o $@ mk_thread_user.o mk_thread_kern.o
$(obj)/mk_thread : $(obj)/mk_thread_kern.o $(obj)/mk_thread_user.o
$(CC) $(CFLAGS) -o $@ $^
mk_thread_user.o : mk_thread_user.c
$(obj)/mk_thread_user.o : $(src)/mk_thread_user.c
$(CC) $(USER_CFLAGS) -c -o $@ $<
clean :
$(RM) $(host-progs) mk_thread
$(RM) -f $(EXTRA_TARGETS)
archmrproper : clean
include $(TOPDIR)/Rules.make
EXTRA_TARGETS := mk_task mk_task_kern.o
all : mk_task
include $(TOPDIR)/Rules.make
mk_task : mk_task_user.o mk_task_kern.o
$(CC) -o mk_task mk_task_user.o mk_task_kern.o
$(obj)/mk_task: $(obj)/mk_task_user.o $(obj)/mk_task_kern.o
$(CC) -o $@ $^
mk_task_user.o : mk_task_user.c
$(CC) -c $<
$(obj)/mk_task_user.o: $(src)/mk_task_user.c
$(CC) -o $@ -c $<
clean :
$(RM) mk_task *.o *~
clean:
$(RM) $(EXTRA_TARGETS)
archmrproper : clean
archmrproper:
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment