-ifeq ($(CONFIG_HOST_2G_2G), y)
-TOP_ADDR = 0x80000000
-else
-TOP_ADDR = 0xc0000000
-endif
-
-CFLAGS += -U__$(SUBARCH)__ -U$(SUBARCH)
-ELF_ARCH = $(SUBARCH)
-ELF_FORMAT = elf32-$(SUBARCH)
+core-y += arch/um/sys-i386/ arch/i386/crypto/
-OBJCOPYFLAGS := -O binary -R .note -R .comment -S
-LDFLAGS_BLOB := --format binary --oformat elf32-i386
+TOP_ADDR := $(CONFIG_TOP_ADDR)
-SYS_DIR := $(ARCH_DIR)/include/sysdep-i386
-SYS_UTIL_DIR := $(ARCH_DIR)/sys-i386/util
+ifeq ($(CONFIG_MODE_SKAS),y)
+ ifneq ($(CONFIG_MODE_TT),y)
+ START := 0x8048000
+ endif
+endif
-SYS_HEADERS = $(SYS_DIR)/sc.h $(SYS_DIR)/thread.h
+LDFLAGS += -m elf_i386
+ELF_ARCH := $(SUBARCH)
+ELF_FORMAT := elf32-$(SUBARCH)
+OBJCOPYFLAGS := -O binary -R .note -R .comment -S
-prepare: $(SYS_HEADERS)
+ifeq ("$(origin SUBARCH)", "command line")
+ifneq ("$(shell uname -m | sed -e s/i.86/i386/)", "$(SUBARCH)")
+CFLAGS += $(call cc-option,-m32)
+AFLAGS += $(call cc-option,-m32)
+LINK-y += $(call cc-option,-m32)
+UML_OBJCOPYFLAGS += -F $(ELF_FORMAT)
-$(SYS_DIR)/sc.h: $(SYS_UTIL_DIR)/mk_sc
- $< > $@
+export LDFLAGS HOSTCFLAGS HOSTLDFLAGS UML_OBJCOPYFLAGS
+endif
+endif
-$(SYS_DIR)/thread.h: $(SYS_UTIL_DIR)/mk_thread
- $< > $@
+ARCH_KERNEL_DEFINES += -U__$(SUBARCH)__ -U$(SUBARCH)
-$(SYS_UTIL_DIR)/mk_sc: FORCE ;
- @$(call descend,$(SYS_UTIL_DIR),$@)
+# First of all, tune CFLAGS for the specific CPU. This actually sets cflags-y.
+include $(srctree)/arch/i386/Makefile.cpu
-$(SYS_UTIL_DIR)/mk_thread: $(ARCH_SYMLINKS) $(GEN_HEADERS) FORCE ;
- @$(call descend,$(SYS_UTIL_DIR),$@)
+# prevent gcc from keeping the stack 16 byte aligned. Taken from i386.
+cflags-y += $(call cc-option,-mpreferred-stack-boundary=2)
-$(SYS_UTIL_DIR): include/asm FORCE
- @$(call descend,$@,)
+# Prevent sprintf in nfsd from being converted to strcpy and resulting in
+# an unresolved reference.
+cflags-y += -ffreestanding
-sysclean :
- rm -f $(SYS_HEADERS)
+CFLAGS += $(cflags-y)