Initial commit
This commit is contained in:
10
target/sdk/Config.in
Normal file
10
target/sdk/Config.in
Normal file
@@ -0,0 +1,10 @@
|
||||
config SDK
|
||||
bool "Build the OpenWrt SDK"
|
||||
depends on !EXTERNAL_TOOLCHAIN
|
||||
default BUILDBOT
|
||||
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
|
||||
|
||||
|
||||
177
target/sdk/Makefile
Normal file
177
target/sdk/Makefile
Normal file
@@ -0,0 +1,177 @@
|
||||
#
|
||||
# Copyright (C) 2006-2014 OpenWrt.org
|
||||
# Copyright (C) 2016 LEDE Project
|
||||
#
|
||||
# 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)/version.mk
|
||||
include $(INCLUDE_DIR)/download.mk
|
||||
|
||||
override MAKEFLAGS=
|
||||
|
||||
SDK_NAME:=$(VERSION_DIST_SANITIZED)-sdk-$(if $(CONFIG_VERSION_FILENAMES),$(VERSION_NUMBER)-)$(BOARD)$(if $(SUBTARGET),-$(SUBTARGET))$(if $(GCCV),_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_DIR_NAME)
|
||||
STAGING_SUBDIR_TOOLCHAIN := staging_dir/toolchain-$(ARCH)$(ARCH_SUFFIX)_gcc-$(GCCV)_$(LIBC)$(if $(CONFIG_arm),_eabi)
|
||||
|
||||
BUNDLER_PATH := $(subst $(space),:,$(filter-out $(TOPDIR)/%,$(subst :,$(space),$(PATH))))
|
||||
BUNDLER_COMMAND := PATH=$(BUNDLER_PATH) $(XARGS) $(SCRIPT_DIR)/bundle-libraries.sh $(SDK_BUILD_DIR)/$(STAGING_SUBDIR_HOST)
|
||||
|
||||
EXCLUDE_DIRS:= \
|
||||
*/stamp \
|
||||
*/stampfiles \
|
||||
*/man \
|
||||
*/info \
|
||||
*/root-* \
|
||||
initial \
|
||||
*.install.clean \
|
||||
*.install.flags \
|
||||
*.install \
|
||||
*/doc \
|
||||
*/share/locale
|
||||
|
||||
SDK_DIRS = \
|
||||
$(STAGING_SUBDIR_HOST) \
|
||||
$(STAGING_SUBDIR_TOOLCHAIN)
|
||||
|
||||
GIT_URL:=$(shell git config --get remote.origin.url 2>/dev/null)
|
||||
GIT_URL:=$(if $(CONFIG_BUILDBOT),$(filter git://% http://% https://%,$(GIT_URL)),$(GIT_URL))
|
||||
GIT_COMMIT:=$(shell git rev-parse HEAD 2>/dev/null)
|
||||
GIT_BRANCH:=$(filter-out master HEAD,$(shell git rev-parse --abbrev-ref HEAD 2>/dev/null))
|
||||
GIT_TAGNAME:=$(shell git show-ref --tags --dereference 2>/dev/null | sed -ne '/^$(GIT_COMMIT) / { s|^.*/||; s|\^.*||; p }')
|
||||
|
||||
BASE_FEED:=$(if $(GIT_URL),src-git base $(GIT_URL)$(if $(GIT_BRANCH),;$(GIT_BRANCH),$(if $(GIT_TAGNAME),;$(GIT_TAGNAME))))
|
||||
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'))
|
||||
BASE_FEED:=$(if $(BASE_FEED),$(BASE_FEED),src-git base $(PROJECT_GIT)/openwrt/openwrt.git$(if $(GIT_BRANCH),;$(GIT_BRANCH),$(if $(GIT_TAGNAME),;$(GIT_TAGNAME))))
|
||||
|
||||
KDIR_BASE = $(patsubst $(TOPDIR)/%,%,$(LINUX_DIR))
|
||||
KDIR_ARCHES = $(LINUX_KARCH)
|
||||
|
||||
# arch/arm64/ includes reference files in arch/arm/, so we'll need both
|
||||
ifeq ($(LINUX_KARCH),arm64)
|
||||
KDIR_ARCHES += arm
|
||||
endif
|
||||
|
||||
KERNEL_FILES_ARCH = \
|
||||
Makefile* \
|
||||
module.lds \
|
||||
Kbuild.platforms \
|
||||
*/Platform \
|
||||
include \
|
||||
*/include \
|
||||
scripts \
|
||||
kernel/asm-offsets.s \
|
||||
kernel/module.lds
|
||||
|
||||
KERNEL_FILES_BASE := \
|
||||
.config \
|
||||
Makefile \
|
||||
scripts \
|
||||
tools/objtool \
|
||||
include \
|
||||
Module.symvers \
|
||||
modules.builtin \
|
||||
$(foreach arch,$(KDIR_ARCHES),$(addprefix arch/$(arch)/,$(KERNEL_FILES_ARCH)))
|
||||
|
||||
KERNEL_FILES := $(patsubst $(TOPDIR)/%,%,$(wildcard $(addprefix $(LINUX_DIR)/,$(KERNEL_FILES_BASE))))
|
||||
|
||||
all: compile
|
||||
|
||||
$(BIN_DIR)/$(SDK_NAME).tar.xz: clean
|
||||
mkdir -p \
|
||||
$(SDK_BUILD_DIR)/dl \
|
||||
$(SDK_BUILD_DIR)/package \
|
||||
$(SDK_BUILD_DIR)/$(STAGING_SUBDIR_TARGET)/include \
|
||||
$(SDK_BUILD_DIR)/$(STAGING_SUBDIR_TARGET)/usr/include
|
||||
|
||||
$(CP) -L $(INCLUDE_DIR) $(SCRIPT_DIR) $(SDK_BUILD_DIR)/
|
||||
$(TAR) -cf - -C $(TOPDIR) \
|
||||
`cd $(TOPDIR); find $(KDIR_BASE)/ -name \*.ko` \
|
||||
`cd $(TOPDIR); find $(KDIR_BASE)/firmware/ -newer $(KDIR_BASE)/firmware/Makefile \
|
||||
-type f -name '*.bin' -or -name '*.cis' -or -name '*.csp' -or -name '*.dsp' -or -name '*.fw'` \
|
||||
$(foreach exclude,$(EXCLUDE_DIRS),--exclude="$(exclude)") \
|
||||
$(SDK_DIRS) $(KERNEL_FILES) | \
|
||||
$(TAR) -xf - -C $(SDK_BUILD_DIR)
|
||||
|
||||
# Copy usbip sources, this is required for the usbip userspace packages to be buildable by the SDK.
|
||||
$(TAR) -cf - -C $(TOPDIR) $(KDIR_BASE)/tools/usb/usbip/ | \
|
||||
$(TAR) -xf - -C $(SDK_BUILD_DIR)
|
||||
|
||||
(cd $(SDK_BUILD_DIR); find $(STAGING_SUBDIR_HOST)/bin $(STAGING_SUBDIR_HOST)/usr/bin \
|
||||
$(STAGING_SUBDIR_TOOLCHAIN)/bin $(STAGING_SUBDIR_TOOLCHAIN)/*/bin $(STAGING_SUBDIR_TOOLCHAIN)/libexec \
|
||||
$(KDIR_BASE) \
|
||||
-type f | $(BUNDLER_COMMAND))
|
||||
|
||||
@-( \
|
||||
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\*; \
|
||||
) | 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)/LICENSES \
|
||||
$(TOPDIR)/COPYING \
|
||||
$(TOPDIR)/rules.mk \
|
||||
./files/Config.in \
|
||||
./files/Makefile \
|
||||
./files/include/prepare.mk \
|
||||
./files/README.SDK \
|
||||
$(SDK_BUILD_DIR)/
|
||||
mkdir -p $(SDK_BUILD_DIR)/package/kernel
|
||||
$(CP) \
|
||||
$(TOPDIR)/package/Makefile \
|
||||
$(TOPDIR)/package/libs/toolchain \
|
||||
$(SDK_BUILD_DIR)/package/
|
||||
$(CP) \
|
||||
$(TOPDIR)/package/kernel/linux \
|
||||
$(SDK_BUILD_DIR)/package/kernel/
|
||||
|
||||
-rm -rf $(SDK_BUILD_DIR)/$(STAGING_SUBDIR_HOST)/.prereq-build
|
||||
|
||||
-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) 's,^# SOURCE_DATE_EPOCH:=.*,SOURCE_DATE_EPOCH:=$(SOURCE_DATE_EPOCH),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
|
||||
-make -C $(SDK_BUILD_DIR)/scripts/config clean
|
||||
(cd $(BUILD_DIR); \
|
||||
tar -I '$(STAGING_DIR_HOST)/bin/xz -7e -T$(if $(filter 1,$(NPROC)),2,0)' -cf $@ $(SDK_NAME) \
|
||||
--mtime="$(shell date --date=@$(SOURCE_DATE_EPOCH))"; \
|
||||
)
|
||||
|
||||
download:
|
||||
prepare:
|
||||
compile: $(BIN_DIR)/$(SDK_NAME).tar.xz
|
||||
install: compile
|
||||
|
||||
clean:
|
||||
rm -rf $(SDK_BUILD_DIR) $(BIN_DIR)/$(SDK_NAME).tar.xz
|
||||
65
target/sdk/convert-config.pl
Executable file
65
target/sdk/convert-config.pl
Executable file
@@ -0,0 +1,65 @@
|
||||
#!/usr/bin/env perl
|
||||
use strict;
|
||||
|
||||
while (<>) {
|
||||
my $match;
|
||||
my $var;
|
||||
my $val;
|
||||
my $type;
|
||||
chomp;
|
||||
next if /^CONFIG_SIGNED_PACKAGES/;
|
||||
|
||||
if (/^CONFIG_((BINARY)|(DOWNLOAD))_FOLDER=(.*)$/) {
|
||||
# We don't want to preserve the build setting of
|
||||
# BINARY_FOLDER and DOWNLOAD_FOLDER.
|
||||
$var = "$1_FOLDER";
|
||||
$val = '""';
|
||||
$type = "string";
|
||||
} elsif (/^CONFIG_([^=]+)=(.*)$/) {
|
||||
$var = $1;
|
||||
$val = $2;
|
||||
|
||||
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;
|
||||
}
|
||||
} elsif (/^# CONFIG_BUSYBOX_(.*) is not set/) {
|
||||
$var = "BUSYBOX_$1";
|
||||
$val = 'n';
|
||||
$type = "bool";
|
||||
} else {
|
||||
# We don't want to preserve a record of deselecting
|
||||
# packages because we may want build them in the SDK.
|
||||
# non-package configs however may be important to preserve
|
||||
# the same compilation settings for packages that get
|
||||
# recompiled in the SDK.
|
||||
# Also we want avoid preserving image generation settings
|
||||
# because we set those while in ImageBuilder
|
||||
next if /^(# )?CONFIG_PACKAGE/;
|
||||
next if /^(# )?CONFIG_TARGET/;
|
||||
if (/^# CONFIG_(.*) is not set/) {
|
||||
$var = $1;
|
||||
$val = 'n';
|
||||
$type = "bool";
|
||||
}
|
||||
}
|
||||
|
||||
if (($var ne '') && ($type ne '') && ($val ne '')) {
|
||||
print <<EOF;
|
||||
config $var
|
||||
$type
|
||||
default $val
|
||||
|
||||
EOF
|
||||
}
|
||||
}
|
||||
136
target/sdk/files/Config.in
Normal file
136
target/sdk/files/Config.in
Normal file
@@ -0,0 +1,136 @@
|
||||
mainmenu "OpenWrt Configuration"
|
||||
|
||||
menu "Global build settings"
|
||||
|
||||
config ALL_NONSHARED
|
||||
bool "Select all target specific packages by default"
|
||||
default ALL
|
||||
|
||||
config ALL_KMODS
|
||||
bool "Select all kernel module packages by default"
|
||||
default ALL
|
||||
|
||||
config ALL
|
||||
bool "Select all userspace packages by default"
|
||||
default y
|
||||
|
||||
config SIGNED_PACKAGES
|
||||
bool "Cryptographically sign package lists"
|
||||
default y
|
||||
|
||||
comment "Package build options"
|
||||
|
||||
config DEBUG
|
||||
bool
|
||||
prompt "Compile packages with debugging info"
|
||||
default n
|
||||
help
|
||||
Adds -g3 to the CFLAGS.
|
||||
|
||||
comment "Stripping options"
|
||||
|
||||
choice
|
||||
prompt "Binary stripping method"
|
||||
default USE_STRIP if EXTERNAL_TOOLCHAIN
|
||||
default USE_STRIP if USE_GLIBC
|
||||
default USE_SSTRIP
|
||||
help
|
||||
Select the binary stripping method you wish to use.
|
||||
|
||||
config NO_STRIP
|
||||
bool "none"
|
||||
help
|
||||
This will install unstripped binaries (useful for native
|
||||
compiling/debugging).
|
||||
|
||||
config USE_STRIP
|
||||
bool "strip"
|
||||
help
|
||||
This will install binaries stripped using strip from binutils.
|
||||
|
||||
config USE_SSTRIP
|
||||
bool "sstrip"
|
||||
depends on !USE_GLIBC
|
||||
help
|
||||
This will install binaries stripped using sstrip.
|
||||
endchoice
|
||||
|
||||
config STRIP_ARGS
|
||||
string
|
||||
prompt "Strip arguments"
|
||||
depends on USE_STRIP
|
||||
default "--strip-unneeded --remove-section=.comment --remove-section=.note" if DEBUG
|
||||
default "--strip-all"
|
||||
help
|
||||
Specifies arguments passed to the strip command when stripping binaries.
|
||||
|
||||
endmenu
|
||||
|
||||
menu "Advanced configuration options (for developers)"
|
||||
|
||||
config BROKEN
|
||||
bool "Show broken packages"
|
||||
default n
|
||||
|
||||
config DOWNLOAD_FOLDER
|
||||
string "Download folder"
|
||||
default ""
|
||||
help
|
||||
Store downloaded source bundles in this directory.
|
||||
If not set then defaults to './dl', which is removed by operations such as
|
||||
'git clean -xdf' or 'make distclean'.
|
||||
This option is useful if you have a low bandwidth Internet connection, and by
|
||||
setting a path outside the OpenWrt tree downloads will be saved.
|
||||
|
||||
config LOCALMIRROR
|
||||
string "Local mirror for source packages"
|
||||
default ""
|
||||
|
||||
config AUTOREBUILD
|
||||
bool "Automatic rebuild of packages"
|
||||
default y
|
||||
help
|
||||
Automatically rebuild packages when their files change.
|
||||
|
||||
config AUTOREMOVE
|
||||
bool "Automatic removal of build directories"
|
||||
default y
|
||||
help
|
||||
Automatically delete build directories after make target completed.
|
||||
This allows you to symlink build_dir into a scratch location, e.g. a ramdisk,
|
||||
which does not have enough space to keep a complete build_dir.
|
||||
|
||||
config CCACHE
|
||||
bool "Use ccache"
|
||||
default n
|
||||
help
|
||||
Compiler cache; see https://ccache.samba.org/
|
||||
|
||||
config BUILD_LOG
|
||||
bool "Enable log files during build process"
|
||||
default n
|
||||
help
|
||||
If enabled, log files will be written to the ./log directory.
|
||||
|
||||
config SRC_TREE_OVERRIDE
|
||||
bool "Enable package source tree override"
|
||||
default n
|
||||
help
|
||||
If enabled, you can force a package to use a git tree as source
|
||||
code instead of the normal tarball. Create a symlink 'git-src'
|
||||
in the package directory, pointing to the .git tree that you want
|
||||
to pull the source code from.
|
||||
|
||||
endmenu
|
||||
|
||||
config IN_SDK
|
||||
default y
|
||||
bool
|
||||
|
||||
config MODULES
|
||||
bool
|
||||
default y
|
||||
option modules
|
||||
|
||||
source "Config-build.in"
|
||||
source "tmp/.config-package.in"
|
||||
60
target/sdk/files/Makefile
Normal file
60
target/sdk/files/Makefile
Normal file
@@ -0,0 +1,60 @@
|
||||
# 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:
|
||||
|
||||
DISTRO_PKG_CONFIG:=$(shell which -a pkg-config | grep -E '\/usr' | head -n 1)
|
||||
export PATH:=$(TOPDIR)/staging_dir/host/bin:$(PATH)
|
||||
|
||||
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
|
||||
11
target/sdk/files/README.SDK
Normal file
11
target/sdk/files/README.SDK
Normal file
@@ -0,0 +1,11 @@
|
||||
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
|
||||
(including its dependencies) in the subdir 'package/' and run
|
||||
'make' from this directory.
|
||||
|
||||
To make dependency handling easier, you can use ./scripts/feeds
|
||||
to install any core package that you need
|
||||
17
target/sdk/files/include/prepare.mk
Normal file
17
target/sdk/files/include/prepare.mk
Normal file
@@ -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."; \
|
||||
)
|
||||
Reference in New Issue
Block a user