aboutsummaryrefslogtreecommitdiffstats
path: root/target/sdk
diff options
context:
space:
mode:
authorJames <>2015-11-04 11:49:21 +0000
committerJames <>2015-11-04 11:49:21 +0000
commit716ca530e1c4515d8683c9d5be3d56b301758b66 (patch)
tree700eb5bcc1a462a5f21dcec15ce7c97ecfefa772 /target/sdk
downloadtrunk-47381-716ca530e1c4515d8683c9d5be3d56b301758b66.tar.gz
trunk-47381-716ca530e1c4515d8683c9d5be3d56b301758b66.tar.bz2
trunk-47381-716ca530e1c4515d8683c9d5be3d56b301758b66.zip
trunk-47381HEADmaster
Diffstat (limited to 'target/sdk')
-rw-r--r--target/sdk/Config.in9
-rw-r--r--target/sdk/Makefile130
-rwxr-xr-xtarget/sdk/convert-config.pl41
-rw-r--r--target/sdk/files/Config.in7
-rw-r--r--target/sdk/files/Makefile59
-rw-r--r--target/sdk/files/README.SDK7
-rw-r--r--target/sdk/files/include/prepare.mk17
7 files changed, 270 insertions, 0 deletions
diff --git a/target/sdk/Config.in b/target/sdk/Config.in
new file mode 100644
index 0000000..28c6f3e
--- /dev/null
+++ b/target/sdk/Config.in
@@ -0,0 +1,9 @@
+config SDK
+ bool "Build the OpenWrt SDK"
+ depends on !EXTERNAL_TOOLCHAIN
+ help
+ This is essentially a stripped-down version of the buildroot
+ with a precompiled toolchain. It can be used to develop and
+ test packages for OpenWrt before including them in the buildroot
+
+
diff --git a/target/sdk/Makefile b/target/sdk/Makefile
new file mode 100644
index 0000000..d81c237
--- /dev/null
+++ b/target/sdk/Makefile
@@ -0,0 +1,130 @@
+#
+# Copyright (C) 2006-2014 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+include $(INCLUDE_DIR)/kernel.mk
+include $(INCLUDE_DIR)/host.mk
+include $(INCLUDE_DIR)/version.mk
+
+override MAKEFLAGS=
+
+SDK_NAME:=OpenWrt-SDK-$(if $(CONFIG_VERSION_FILENAMES),$(VERSION_NUMBER)-)$(BOARD)$(if $(SUBTARGET),-$(SUBTARGET))_gcc-$(GCCV)$(DIR_SUFFIX).$(HOST_OS)-$(HOST_ARCH)
+SDK_BUILD_DIR:=$(BUILD_DIR)/$(SDK_NAME)
+
+STAGING_SUBDIR_HOST := staging_dir/host
+STAGING_SUBDIR_TARGET := staging_dir/target-$(ARCH)$(ARCH_SUFFIX)_$(LIBC)-$(LIBCV)$(if $(CONFIG_arm),_eabi)
+STAGING_SUBDIR_TOOLCHAIN := staging_dir/toolchain-$(ARCH)$(ARCH_SUFFIX)_gcc-$(GCCV)_$(LIBC)-$(LIBCV)$(if $(CONFIG_arm),_eabi)
+
+EXCLUDE_DIRS:=*/ccache \
+ */stamp \
+ */stampfiles \
+ */man \
+ */info \
+ */root-* \
+ initial \
+ *.install.clean \
+ *.install.flags \
+ *.install \
+ */doc
+
+SDK_DIRS = \
+ $(STAGING_SUBDIR_HOST) \
+ $(STAGING_SUBDIR_TARGET) \
+ $(STAGING_SUBDIR_TOOLCHAIN)
+
+BASE_FEED:=$(shell git config --get remote.origin.url 2>/dev/null | sed -ne 's/^/src-git base /p')
+BASE_FEED:=$(if $(BASE_FEED),$(BASE_FEED),$(shell cd $(TOPDIR); LC_ALL=C git svn info 2>/dev/null | sed -ne 's/^URL: /src-gitsvn base /p'))
+BASE_FEED:=$(if $(BASE_FEED),$(BASE_FEED),$(shell cd $(TOPDIR); LC_ALL=C svn info 2>/dev/null | sed -ne 's/^URL: /src-svn base /p'))
+
+KDIR_BASE = $(patsubst $(TOPDIR)/%,%,$(LINUX_DIR))
+
+KERNEL_FILES_ARCH = \
+ Makefile* \
+ module.lds \
+ Kbuild.platforms \
+ */Platform \
+ include \
+ */include \
+ scripts \
+ kernel/asm-offsets.s
+
+KERNEL_FILES_BASE := \
+ .config \
+ Makefile \
+ scripts \
+ include \
+ Module.symvers \
+ $(addprefix arch/$(LINUX_KARCH)/,$(KERNEL_FILES_ARCH))
+
+KERNEL_FILES := $(patsubst $(TOPDIR)/%,%,$(wildcard $(addprefix $(LINUX_DIR)/,$(KERNEL_FILES_BASE))))
+
+all: compile
+
+$(BIN_DIR)/$(SDK_NAME).tar.bz2: clean
+ mkdir -p $(SDK_BUILD_DIR)/dl $(SDK_BUILD_DIR)/package
+ $(CP) $(INCLUDE_DIR) $(SCRIPT_DIR) $(TOPDIR)/docs $(SDK_BUILD_DIR)/
+ $(TAR) -cf - -C $(TOPDIR) \
+ $(foreach exclude,$(EXCLUDE_DIRS),--exclude="$(exclude)") \
+ $(SDK_DIRS) $(KERNEL_FILES) | \
+ $(TAR) -xf - -C $(SDK_BUILD_DIR)
+
+ @-( \
+ find \
+ $(SDK_BUILD_DIR)/$(STAGING_SUBDIR_HOST)/bin \
+ $(SDK_BUILD_DIR)/$(STAGING_SUBDIR_HOST)/usr/bin \
+ $(SDK_BUILD_DIR)/$(STAGING_SUBDIR_TOOLCHAIN)/bin \
+ $(SDK_BUILD_DIR)/$(STAGING_SUBDIR_TOOLCHAIN)/*/bin \
+ $(SDK_BUILD_DIR)/$(STAGING_SUBDIR_TOOLCHAIN)/libexec \
+ -type f; \
+ find \
+ $(SDK_BUILD_DIR)/$(STAGING_SUBDIR_HOST)/lib \
+ $(SDK_BUILD_DIR)/$(STAGING_SUBDIR_HOST)/usr/lib \
+ -type f -name \*.so\* -or -name \*.a; \
+ ) | xargs strip 2>/dev/null >/dev/null
+
+ mkdir -p $(SDK_BUILD_DIR)/target/linux
+ $(CP) $(GENERIC_PLATFORM_DIR) $(PLATFORM_DIR) $(SDK_BUILD_DIR)/target/linux/
+ rm -rf \
+ $(SDK_BUILD_DIR)/target/linux/*/files* \
+ $(SDK_BUILD_DIR)/target/linux/*/patches*
+ ./convert-config.pl $(TOPDIR)/.config > $(SDK_BUILD_DIR)/Config-build.in
+ $(CP) -L \
+ $(TOPDIR)/LICENSE \
+ $(TOPDIR)/rules.mk \
+ $(TOPDIR)/.config \
+ ./files/Config.in \
+ ./files/Makefile \
+ ./files/include/prepare.mk \
+ ./files/README.SDK \
+ $(SDK_BUILD_DIR)/
+ $(CP) \
+ $(TOPDIR)/package/Makefile \
+ $(SDK_BUILD_DIR)/package/
+
+ -rm -f $(SDK_BUILD_DIR)/feeds.conf.default
+ $(if $(BASE_FEED),echo "$(BASE_FEED)" > $(SDK_BUILD_DIR)/feeds.conf.default)
+ if [ -f $(TOPDIR)/feeds.conf ]; then \
+ cat $(TOPDIR)/feeds.conf >> $(SDK_BUILD_DIR)/feeds.conf.default; \
+ else \
+ cat $(TOPDIR)/feeds.conf.default >> $(SDK_BUILD_DIR)/feeds.conf.default; \
+ fi
+ $(SED) 's,^# REVISION:=.*,REVISION:=$(REVISION),g' $(SDK_BUILD_DIR)/include/version.mk
+ $(SED) '/LINUX_VERMAGIC:=/ { s,unknown,$(LINUX_VERMAGIC),g }' $(SDK_BUILD_DIR)/include/kernel.mk
+ find $(SDK_BUILD_DIR) -name .git | $(XARGS) rm -rf
+ find $(SDK_BUILD_DIR) -name .svn | $(XARGS) rm -rf
+ find $(SDK_BUILD_DIR) -name CVS | $(XARGS) rm -rf
+ (cd $(BUILD_DIR); \
+ tar cfj $@ $(SDK_NAME); \
+ )
+
+download:
+prepare:
+compile: $(BIN_DIR)/$(SDK_NAME).tar.bz2
+install: compile
+
+clean:
+ rm -rf $(SDK_BUILD_DIR) $(BIN_DIR)/$(SDK_NAME).tar.bz2
diff --git a/target/sdk/convert-config.pl b/target/sdk/convert-config.pl
new file mode 100755
index 0000000..e701b42
--- /dev/null
+++ b/target/sdk/convert-config.pl
@@ -0,0 +1,41 @@
+#!/usr/bin/env perl
+use strict;
+
+print <<EOF;
+config ALL
+ bool
+ default y
+
+EOF
+
+while (<>) {
+ chomp;
+ next if /^CONFIG_SIGNED_PACKAGES/;
+ next unless /^CONFIG_([^=]+)=(.*)$/;
+
+ my $var = $1;
+ my $val = $2;
+ my $type;
+
+ next if $var eq 'ALL';
+
+ if ($val eq 'y') {
+ $type = "bool";
+ } elsif ($val eq 'm') {
+ $type = "tristate";
+ } elsif ($val =~ /^".*"$/) {
+ $type = "string";
+ } elsif ($val =~ /^\d+$/) {
+ $type = "int";
+ } else {
+ warn "WARNING: no type found for symbol CONFIG_$var=$val\n";
+ next;
+ }
+
+ print <<EOF;
+config $var
+ $type
+ default $val
+
+EOF
+}
diff --git a/target/sdk/files/Config.in b/target/sdk/files/Config.in
new file mode 100644
index 0000000..6cb3fe8
--- /dev/null
+++ b/target/sdk/files/Config.in
@@ -0,0 +1,7 @@
+config MODULES
+ bool
+ default y
+ option modules
+
+source "Config-build.in"
+source "tmp/.config-package.in"
diff --git a/target/sdk/files/Makefile b/target/sdk/files/Makefile
new file mode 100644
index 0000000..2edf7b3
--- /dev/null
+++ b/target/sdk/files/Makefile
@@ -0,0 +1,59 @@
+# Makefile for OpenWrt
+#
+# Copyright (C) 2007-2015 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+TOPDIR:=${CURDIR}
+LC_ALL:=C
+LANG:=C
+SDK:=1
+export TOPDIR LC_ALL LANG SDK
+
+world:
+
+include $(TOPDIR)/include/host.mk
+
+ifneq ($(OPENWRT_BUILD),1)
+ override OPENWRT_BUILD=1
+ export OPENWRT_BUILD
+
+ empty:=
+ space:= $(empty) $(empty)
+ _SINGLE=export MAKEFLAGS=$(space);
+
+ include $(TOPDIR)/include/debug.mk
+ include $(TOPDIR)/include/depends.mk
+ include $(TOPDIR)/include/toplevel.mk
+else
+ include rules.mk
+ include $(INCLUDE_DIR)/depends.mk
+ include $(INCLUDE_DIR)/subdir.mk
+ include package/Makefile
+
+$(package/stamp-compile): $(BUILD_DIR)/.prepared
+$(BUILD_DIR)/.prepared: Makefile
+ @mkdir -p $$(dirname $@)
+ @touch $@
+
+clean: FORCE
+ git clean -f -d $(STAGING_DIR); true
+ git clean -f -d $(BUILD_DIR); true
+ git clean -f -d $(BIN_DIR); true
+
+dirclean: clean
+ git reset --hard HEAD
+ git clean -f -d
+ rm -rf feeds/
+
+# check prerequisites before starting to build
+prereq: $(package/stamp-prereq) ;
+
+world: prepare $(package/stamp-compile) FORCE
+ @$(MAKE) package/index
+
+.PHONY: clean dirclean prereq prepare world
+
+endif
diff --git a/target/sdk/files/README.SDK b/target/sdk/files/README.SDK
new file mode 100644
index 0000000..454e32b
--- /dev/null
+++ b/target/sdk/files/README.SDK
@@ -0,0 +1,7 @@
+This is the OpenWrt SDK. It contains a stripped-down version of
+the buildroot. You can use it to test/develop packages without
+having to compile your own toolchain or any of the libraries
+included with OpenWrt.
+
+To use it, just put your buildroot-compatible package directory
+in the subdir 'package/' and run 'make' from this directory.
diff --git a/target/sdk/files/include/prepare.mk b/target/sdk/files/include/prepare.mk
new file mode 100644
index 0000000..76bad05
--- /dev/null
+++ b/target/sdk/files/include/prepare.mk
@@ -0,0 +1,17 @@
+#
+# Copyright (C) 2015 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+prepare: .git/config
+
+.git/config:
+ @( \
+ printf "Initializing SDK ... "; \
+ git init -q .; \
+ find . -mindepth 1 -maxdepth 1 -not -name feeds | xargs git add; \
+ git commit -q -m "Initial state"; \
+ echo "ok."; \
+ )