From: Daniel Dickinson <[email protected]>

In keeping with the theme of building a common base and branching
out we introduce the concept of a minimal SDK which is essentially
the build machinery plus the kernel and it's dependencies (e.g.
hostapd on which mac80211 depends, and usign on which package
signing depends).  The minimal package selection may be tailored
further (e.g. if one does not want to build all kernel modules)
via the usual means as the minimal SDK package selection is
done via defaults, not requirements.

The same build that builds the minimal SDK would be used to
build a non-standalone SDK (since by default with minimal SDK
not all packages required for a working image are built) which
can be used with repositories containing the packages built at
the various stages to create viable images.

Signed-off-by: Daniel Dickinson <[email protected]>
---
 config/Config-build.in      |  13 +++++
 config/Config-images.in     |  13 +++++
 include/target.mk           | 124 ++++++++++++++++++++++++++++++++++++++++++++
 scripts/metadata.pl         |  19 ++++++-
 scripts/metadata.pm         |   1 +
 target/convert-config.pl    |   3 ++
 target/sdk/Config-in-sdk.in |   4 ++
 7 files changed, 176 insertions(+), 1 deletion(-)

diff --git a/config/Config-build.in b/config/Config-build.in
index bf10922..46ac59a 100644
--- a/config/Config-build.in
+++ b/config/Config-build.in
@@ -8,12 +8,25 @@ menu "Global build settings"
 
        config ALL_KMODS
                bool "Select all kernel module packages by default"
+               default y if SDK_CORE
                default ALL
 
        config ALL
                bool "Select all userspace packages by default"
                default n
 
+       config NO_KMODS
+               bool "Deselect all kernel module packages by default"
+               default n
+               depends on !ALL_KMODS
+               depends on !SDK_CORE
+
+       config NONE
+               bool "Deselect all userspace packages by default"
+               default y if SDK_CORE
+               default n
+               depends on !ALL
+
        config SIGNED_PACKAGES
                bool "Cryptographically signed package lists"
                default y
diff --git a/config/Config-images.in b/config/Config-images.in
index a60dd50..1731f94 100644
--- a/config/Config-images.in
+++ b/config/Config-images.in
@@ -8,6 +8,7 @@ menu "Target Images"
 
        menuconfig TARGET_ROOTFS_INITRAMFS
                bool "ramdisk"
+               default n if SDK_CORE
                default y if USES_INITRAMFS
                help
                  Embed the root filesystem into the kernel (initramfs).
@@ -54,12 +55,14 @@ menu "Target Images"
 
        config TARGET_ROOTFS_CPIOGZ
                bool "cpio.gz"
+               default n if SDK_CORE
                default y if USES_CPIOGZ
                help
                  Build a compressed cpio archive of the root filesystem.
 
        config TARGET_ROOTFS_TARGZ
                bool "tar.gz"
+               default n if SDK_CORE
                default y if USES_TARGZ
                help
                  Build a compressed tar archive of the root filesystem.
@@ -68,6 +71,7 @@ menu "Target Images"
 
        menuconfig TARGET_ROOTFS_EXT4FS
                bool "ext4"
+               default n if SDK_CORE
                default y if USES_EXT4
                help
                  Build an ext4 root filesystem.
@@ -119,6 +123,7 @@ menu "Target Images"
 
        config TARGET_ROOTFS_ISO
                bool "iso"
+               default n if SDK_CORE
                default n
                depends on TARGET_x86_generic
                help
@@ -126,12 +131,14 @@ menu "Target Images"
 
        config TARGET_ROOTFS_JFFS2
                bool "jffs2"
+               default n if SDK_CORE
                default y if USES_JFFS2
                help
                  Build a JFFS2 root filesystem.
 
        config TARGET_ROOTFS_JFFS2_NAND
                bool "jffs2 for NAND"
+               default n if SDK_CORE
                default y if USES_JFFS2_NAND
                depends on USES_JFFS2_NAND
                help
@@ -139,6 +146,7 @@ menu "Target Images"
 
        menuconfig TARGET_ROOTFS_SQUASHFS
                bool "squashfs"
+               default n if SDK_CORE
                default y if USES_SQUASHFS
                help
                  Build a squashfs-lzma root filesystem.
@@ -151,6 +159,7 @@ menu "Target Images"
 
        menuconfig TARGET_ROOTFS_UBIFS
                bool "ubifs"
+               default n if SDK_CORE
                default y if USES_UBIFS
                depends on USES_UBIFS
                help
@@ -186,6 +195,7 @@ menu "Target Images"
 
        config GRUB_IMAGES
                bool "Build GRUB images (Linux x86 or x86_64 host only)"
+               default n if SDK_CORE
                depends on TARGET_x86_64 || (TARGET_x86 && !TARGET_x86_rdc)
                depends on TARGET_ROOTFS_EXT4FS || TARGET_ROOTFS_ISO || 
TARGET_ROOTFS_JFFS2 || TARGET_ROOTFS_SQUASHFS
                select PACKAGE_grub2
@@ -226,6 +236,7 @@ menu "Target Images"
 
        config VDI_IMAGES
                bool "Build VirtualBox image files (VDI)"
+               default n if SDK_CORE
                depends on TARGET_x86 || TARGET_x86_64
                select GRUB_IMAGES
                select TARGET_IMAGES_PAD
@@ -233,6 +244,7 @@ menu "Target Images"
 
        config VMDK_IMAGES
                bool "Build VMware image files (VMDK)"
+               default n if SDK_CORE
                depends on TARGET_x86 || TARGET_x86_64
                select GRUB_IMAGES
                select TARGET_IMAGES_PAD
@@ -245,6 +257,7 @@ menu "Target Images"
        config TARGET_IMAGES_GZIP
                bool "GZip images"
                depends on TARGET_IMAGES_PAD || TARGET_ROOTFS_EXT4FS
+               default n if SDK_CORE
                default y
 
        comment "Image Options"
diff --git a/include/target.mk b/include/target.mk
index f129298..30c02de 100644
--- a/include/target.mk
+++ b/include/target.mk
@@ -11,6 +11,129 @@ __target_inc=1
 # default device type
 DEVICE_TYPE?=router
 
+# Default packages when building SDK_CORE (minimal set of source packages
+# required by a 'build machinery plus all kernel module build', but do build
+# all packages of the same variant from dependency chain source packages
+# by default).  This approach is taken to avoid potentially conflicting 
packages,
+# which could be an issue with multiple builds of the same variant (e.g. due to
+# one binary package of the variant built for the SDK and another by the SDK in
+# a separate build).
+#   Hostapd source package is required by mac80211, ubus by hostapd, libubox
+#   by ubus, lua by ubus, libjson-c by libubox,
+#   usign is required for package signing, and wireless-tools is required by
+#   broadcom-wl and hostap-driver, toolchain by the toolchain, various firmware
+#   are required by kernel packages, iptables by netfilter kernel modules,
+#  and opkg by by build system, and signing-key is required for the signing key
+#
+# Note this is done one package per-line for both ease of editing
+# and because as one long line it exceed's git send-email's line
+# length limit.
+DEFAULT_SDK_CORE_PACKAGES:=\
+hostapd-common \
+hostadp-common-old \
+hostapd-mini \
+hostapd-utils \
+wpad-mini \
+wpa-supplicant-mini \
+wpa-cli \
+libubus \
+libubus-lua \
+ubus \
+ubusd \
+libubox \
+libblobmsg-json \
+jshn \
+libjson-script \
+libubox-lua \
+liblua \
+lua \
+luac \
+lua-examples \
+usign \
+wireless-tools \
+libiw \
+libgcc \
+libatomic \
+libssp \
+libstdcpp \
+libc \
+libpthread \
+libphtread-db \
+librt \
+libgfortran \
+ldd \
+ldconfig \
+glibc \
+musl \
+uClibc \
+wlc \
+wl \
+nas \
+om-watchdog \
+ltq-vdsl-vr9 \
+kmod-ltq-adsl-danube-fw-a \
+kmod-ltq-adsl-danube-fw-ba \
+kmod-ltq-adsl-ase-fw-a \
+kmod-ltq-adsl-ase-fw-b \
+kmod-ltq-adsl-ar9-fw-a \
+kmod-ltq-adsl-ar9-fw-b \
+ltq-vsdl-mei_test \
+ar3k-firmware \
+ibt-firmware \
+r8169-firmware \
+r8189eu-firmware \
+iptables \
+iptables-mod-conntrack-extra \
+iptables-mod-extra \
+iptables-mod-filter \
+iptables-mod-ipopt \
+iptables-mod-ipsec \
+iptables-mod-ipset \
+iptables-mod-nat-extra \
+iptables-mod-iprange \
+iptables-mod-cluster \
+iptables-mod-clusterip \
+iptables-mod-ulog \
+iptables-mod-hashlimit \
+iptables-mod-led \
+iptables-mod-tproxy \
+iptables-mod-tee \
+iptables-mod-u32 \
+iptables-mod-nflog \
+iptables-mod-nfqueue \
+ip6tables \
+ip6tables-extra \
+ip6tables-mod-nat \
+libiptc \
+libip4tc \
+libip6tc \
+libxtables \
+iptables-mod-compat-xtables \
+iptables-mod-nathelper-rtsp \
+iptables-mod-account \
+iptables-mod-chaos \
+iptables-mod-condition \
+iptables-mod-delude \
+iptables-mod-dhcpmac \
+iptables-mod-dnetmap \
+iptables-mod-fuzzy \
+iptables-mod-geoip \
+iptables-mod-iface \
+iptables-mod-ipmark \
+iptables-mod-ipp2p \
+iptables-mod-ipv4options \
+iptables-mod-length2 \
+iptables-mod-logmark \
+iptables-mod-lscan \
+iptables-mod-lua \
+iptables-mod-psd \
+iptables-mod-quota2 \
+iptables-mod-sysrq \
+iptables-mod-tarpit \
+iptaccount \
+opkg \
+signing-key
+
 # Default packages - the really basic set
 DEFAULT_PACKAGES:=base-files libc libgcc busybox dropbear mtd uci opkg netifd 
fstools
 # For nas targets
@@ -290,6 +413,7 @@ define BuildTargets/DumpCurrent
         echo "$$$$DESCRIPTION"; \
         echo '@@'; \
         echo 'Default-Packages: $(DEFAULT_PACKAGES) $(call 
extra_packages,$(DEFAULT_PACKAGES))'; \
+         echo 'Default-SDK-Core-Packages: $(DEFAULT_SDK_CORE_PACKAGES)'; \
         $(DUMPINFO)
        $(if $(SUBTARGET),,@$(foreach SUBTARGET,$(SUBTARGETS),$(SUBMAKE) -s 
DUMP=1 SUBTARGET=$(SUBTARGET); ))
 endef
diff --git a/scripts/metadata.pl b/scripts/metadata.pl
index 54341c4..a5d6abe 100755
--- a/scripts/metadata.pl
+++ b/scripts/metadata.pl
@@ -232,6 +232,7 @@ sub gen_target_config() {
        my $file = shift @ARGV;
        my @target = parse_target_metadata($file);
        my %defaults;
+       my %sdk_core_defaults;
 
        my @target_sort = sort {
                target_name($a) cmp target_name($b);
@@ -295,6 +296,10 @@ EOF
                                print "\tselect DEFAULT_$pkg\n";
                                $defaults{$pkg} = 1;
                        }
+                       foreach my $sdk_core_pkg 
(@{$target->{sdk_core_packages}}) {
+                               print "\tselect 
DEFAULT_SDK_CORE_$sdk_core_pkg\n";
+                               $sdk_core_defaults{$sdk_core_pkg} = 1;
+                       }
                        my $help = $profile->{desc};
                        if ($help =~ /\w+/) {
                                $help =~ s/^\s*/\t  /mg;
@@ -365,6 +370,10 @@ EOF
                print "\tconfig DEFAULT_".$def."\n";
                print "\t\tbool\n\n";
        }
+       foreach my $sdk_core_def (sort keys %sdk_core_defaults) {
+               print "\tconfig DEFAULT_SDK_CORE_".$sdk_core_def."\n";
+               print "\t\tbool\n\n";
+       }
 }
 
 my %dep_check;
@@ -543,12 +552,15 @@ sub print_package_config_category($) {
                        print "config PACKAGE_".$pkg->{name}."\n";
                        $pkg->{hidden} and $title = "";
                        print "\t\t".($pkg->{tristate} ? 'tristate' : 'bool')." 
$title\n";
-                       print "\t\tdefault y if DEFAULT_".$pkg->{name}."\n";
+                       print "\t\tdefault y if ( 
DEFAULT_SDK_CORE_".$pkg->{name}." && SDK_CORE ) \n";
+                       print "\t\tdefault y if ( DEFAULT_".$pkg->{name}." && 
!SDK_CORE )\n";
                        unless ($pkg->{hidden}) {
                                if ($pkg->{name} =~ /^kmod-/) {
                                        $pkg->{default} ||= "m if ALL_KMODS";
+                                       $pkg->{defaultno} ||= "n if NO_KMODS";
                                } else {
                                        $pkg->{default} ||= "m if ALL";
+                                       $pkg->{defaultno} ||= "n if NONE";
                                }
                        }
                        if ($pkg->{default}) {
@@ -556,6 +568,11 @@ sub print_package_config_category($) {
                                        print "\t\tdefault $default\n";
                                }
                        }
+                       if ($pkg->{defaultno}) {
+                               foreach my $default (split /\s*,\s*/, 
$pkg->{defaultno}) {
+                                       print "\t\tdefault $default\n";
+                               }
+                       }
                        print mconf_depends($pkg->{name}, $pkg->{depends}, 0);
                        print mconf_depends($pkg->{name}, $pkg->{mdepends}, 0);
                        print mconf_conflicts($pkg->{name}, $pkg->{conflicts});
diff --git a/scripts/metadata.pm b/scripts/metadata.pm
index 09273df..8d7defa 100644
--- a/scripts/metadata.pm
+++ b/scripts/metadata.pm
@@ -80,6 +80,7 @@ sub parse_target_metadata($) {
                /^Linux-Kernel-Arch:\s*(.+)\s*$/ and $target->{karch} = $1;
                /^Default-Subtarget:\s*(.+)\s*$/ and $target->{def_subtarget} = 
$1;
                /^Default-Packages:\s*(.+)\s*$/ and $target->{packages} = [ 
split(/\s+/, $1) ];
+               /^Default-SDK-Core-Packages:\s*(.+)\s*$/ and 
$target->{sdk_core_packages} = [ split(/\s+/, $1) ];
                /^Target-Profile:\s*(.+)\s*$/ and do {
                        $profile = {
                                id => $1,
diff --git a/target/convert-config.pl b/target/convert-config.pl
index e701b42..3bbc5fa 100755
--- a/target/convert-config.pl
+++ b/target/convert-config.pl
@@ -18,6 +18,9 @@ while (<>) {
        my $type;
 
        next if $var eq 'ALL';
+       next if $var eq 'ALL_KMODS';
+       next if $var eq 'NONE';
+       next if $var eq 'NO_KMODS';
 
        if ($val eq 'y') {
                $type = "bool";
diff --git a/target/sdk/Config-in-sdk.in b/target/sdk/Config-in-sdk.in
index 7ed95dc..cd33055 100644
--- a/target/sdk/Config-in-sdk.in
+++ b/target/sdk/Config-in-sdk.in
@@ -6,3 +6,7 @@ config SDK
          SDK plus the STAGING_DIR results of compiling packages
          selected for build.
 
+config SDK_CORE
+       bool
+       default n
+
-- 
2.4.3
_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel

Reply via email to