--include $(top_builddir)/.config.cmd
-include $(patsubst %,%/Makefile.in, $(SRC_DIRS))
-
-endif # ifneq ($(strip $(HAVE_DOT_CONFIG)),y)
-
--include $(top_builddir)/.config
--include $(top_builddir)/.depend
-
-
-ifeq ($(strip $(CONFIG_BUILD_AT_ONCE)),y)
-libraries-y:=
-# Which parts of the internal libs are requested?
-# Per default we only want what was actually selected.
-# -a denotes all while -y denotes the selected ones.
-ifeq ($(strip $(CONFIG_FEATURE_FULL_LIBBUSYBOX)),y)
-LIBRARY_DEFINE:=$(LIBRARY_DEFINE-a)
-LIBRARY_SRC :=$(LIBRARY_SRC-a)
-else # CONFIG_FEATURE_FULL_LIBBUSYBOX
-LIBRARY_DEFINE:=$(LIBRARY_DEFINE-y)
-LIBRARY_SRC :=$(LIBRARY_SRC-y)
-endif # CONFIG_FEATURE_FULL_LIBBUSYBOX
-APPLET_SRC:=$(APPLET_SRC-y)
-APPLETS_DEFINE:=$(APPLETS_DEFINE-y)
-else # CONFIG_BUILD_AT_ONCE
-# no --combine, build archives out of the individual .o
-# This was the old way the binary was built.
-libbusybox-obj:=archival/libunarchive/libunarchive.a \
- networking/libiproute/libiproute.a \
- libpwdgrp/libpwdgrp.a \
- coreutils/libcoreutils/libcoreutils.a \
- libbb/libbb.a
-libbusybox-obj:=$(patsubst %,$(top_builddir)/%,$(libbusybox-obj))
-
-ifeq ($(strip $(CONFIG_FEATURE_SHARED_BUSYBOX)),y)
-# linking against libbusybox, so don't build the .a already contained in the .so
-libraries-y:=$(filter-out $(libbusybox-obj),$(libraries-y))
-endif # CONFIG_FEATURE_SHARED_BUSYBOX
-endif # CONFIG_BUILD_AT_ONCE
-
-
-ifeq ($(strip $(CONFIG_BUILD_LIBBUSYBOX)),y)
-LD_LIBBUSYBOX:=libbusybox.so
-LIBBUSYBOX_SONAME:=$(LD_LIBBUSYBOX).$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL_VERSION)
-DO_INSTALL_LIBS:=$(LD_LIBBUSYBOX) \
- $(LD_LIBBUSYBOX).$(MAJOR_VERSION) \
- $(LD_LIBBUSYBOX).$(MAJOR_VERSION).$(MINOR_VERSION)
-endif # CONFIG_BUILD_LIBBUSYBOX
-
-ifeq ($(strip $(CONFIG_BUILD_AT_ONCE)),y)
-ifneq ($(strip $(CONFIG_FEATURE_SHARED_BUSYBOX)),y)
-# --combine but not linking against libbusybox, so compile all
-BUSYBOX_SRC := $(LIBRARY_SRC)
-BUSYBOX_DEFINE:= $(LIBRARY_DEFINE)
-endif # !CONFIG_FEATURE_SHARED_BUSYBOX
-$(LIBBUSYBOX_SONAME): $(LIBRARY_SRC)
-else # CONFIG_BUILD_AT_ONCE
-$(LIBBUSYBOX_SONAME): $(libbusybox-obj)
-endif # CONFIG_BUILD_AT_ONCE
-
-ifeq ($(strip $(CONFIG_FEATURE_SHARED_BUSYBOX)),y)
-LDBUSYBOX:=-L$(top_builddir) -lbusybox
+
+# Read in dependencies to all Kconfig* files, make sure to run
+# oldconfig if changes are detected.
+-include .kconfig.d
+
+-include .config
+
+# If .config needs to be updated, it will be done via the dependency
+# that autoconf has on .config.
+# To avoid any implicit rule to kick in, define an empty command
+.config .kconfig.d: ;
+
+# Now we can define CFLAGS etc according to .config
+include $(srctree)/Makefile.flags
+
+# If .config is newer than include/autoconf.h, someone tinkered
+# with it and forgot to run make oldconfig.
+# If kconfig.d is missing then we are probarly in a cleaned tree so
+# we execute the config step to be sure to catch updated Kconfig files
+include/autoconf.h: .kconfig.d .config
+ $(Q)$(MAKE) -f $(srctree)/Makefile silentoldconfig
+
+else
+# Dummy target needed, because used as prerequisite
+include/autoconf.h: ;
+endif
+
+# The all: target is the default when no target is given on the
+# command line.
+# This allow a user to issue only 'make' to build a kernel including modules
+# Defaults busybox but it is usually overriden in the arch makefile
+all: busybox
+
+-include $(srctree)/arch/$(ARCH)/Makefile
+
+# arch Makefile may override CC so keep this after arch Makefile is included
+#bbox# NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include)
+CHECKFLAGS += $(NOSTDINC_FLAGS)
+
+# warn about C99 declaration after statement
+CFLAGS += $(call cc-option,-Wdeclaration-after-statement,)
+
+# disable pointer signedness warnings in gcc 4.0
+CFLAGS += $(call cc-option,-Wno-pointer-sign,)
+
+# Default kernel image to build when no specific target is given.
+# KBUILD_IMAGE may be overruled on the commandline or
+# set in the environment
+# Also any assignments in arch/$(ARCH)/Makefile take precedence over
+# this default value
+export KBUILD_IMAGE ?= busybox
+
+#
+# INSTALL_PATH specifies where to place the updated kernel and system map
+# images. Default is /boot, but you can set it to other values
+export INSTALL_PATH ?= /boot
+
+#
+# INSTALL_MOD_PATH specifies a prefix to MODLIB for module directory
+# relocations required by build roots. This is not defined in the
+# makefile but the arguement can be passed to make if needed.
+#
+
+MODLIB = $(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE)
+export MODLIB
+
+
+ifeq ($(KBUILD_EXTMOD),)
+busybox-dirs := $(patsubst %/,%,$(filter %/, $(core-y) $(core-m) $(libs-y) $(libs-m)))
+
+busybox-alldirs := $(sort $(busybox-dirs) $(patsubst %/,%,$(filter %/, \
+ $(core-n) $(core-) $(libs-n) $(libs-) \
+ )))
+
+core-y := $(patsubst %/, %/built-in.o, $(core-y))
+libs-y1 := $(patsubst %/, %/lib.a, $(libs-y))
+libs-y2 := $(patsubst %/, %/built-in.o, $(libs-y))
+libs-y := $(libs-y1) $(libs-y2)
+
+
+# Build busybox
+# ---------------------------------------------------------------------------
+# busybox is build from the objects selected by $(busybox-init) and
+# $(busybox-main). Most are built-in.o files from top-level directories
+# in the kernel tree, others are specified in arch/$(ARCH)Makefile.
+# Ordering when linking is important, and $(busybox-init) must be first.
+#
+# busybox
+# ^
+# |
+# +-< $(busybox-init)
+# | +--< init/version.o + more
+# |
+# +--< $(busybox-main)
+# | +--< driver/built-in.o mm/built-in.o + more
+# |
+# +-< kallsyms.o (see description in CONFIG_KALLSYMS section)
+#
+# busybox version (uname -v) cannot be updated during normal
+# descending-into-subdirs phase since we do not yet know if we need to
+# update busybox.
+# Therefore this step is delayed until just before final link of busybox -
+# except in the kallsyms case where it is done just before adding the
+# symbols to the kernel.
+#
+# System.map is generated to document addresses of all kernel symbols
+
+busybox-all := $(core-y) $(libs-y)
+
+# Rule to link busybox - also used during CONFIG_KALLSYMS
+# May be overridden by arch/$(ARCH)/Makefile
+quiet_cmd_busybox__ ?= LINK $@
+ifdef CONFIG_STATIC
+ cmd_busybox__ ?= $(srctree)/scripts/trylink $(CC) \
+ -static \
+ -o $@ \
+ -Wl,--warn-common -Wl,--sort-common -Wl,--gc-sections \
+ -Wl,--start-group $(busybox-all) -Wl,--end-group
+else
+ cmd_busybox__ ?= $(srctree)/scripts/trylink $(CC) -o $@ \
+ -Wl,--warn-common -Wl,--sort-common -Wl,--gc-sections \
+ -Wl,--start-group $(busybox-all) -Wl,--end-group