Make UCI preconfiguration optional and disabled by default
Make UCI preconfiguration optional and disabled by default


git-svn-id: svn://svn.openwrt.org/openwrt/trunk@7095 3c298f89-4303-0410-b956-a3cf2f4a3e73

file:a/Config.in -> file:b/Config.in
--- a/Config.in
+++ b/Config.in
@@ -11,6 +11,64 @@
 	default y
 
 source "target/Config.in"
+
+menu "Target Images"
+	config TARGET_ROOTFS_INITRAMFS
+		bool "ramdisk"
+		default n
+		depends LINUX_2_6
+		help
+		  Embed the rootfs into the kernel (initramfs)
+
+	config TARGET_ROOTFS_JFFS2
+		bool "jffs2"
+		default y if USES_JFFS2
+		depends !TARGET_ROOTFS_INITRAMFS
+		help
+		  Build a jffs2 root filesystem
+
+	config TARGET_ROOTFS_SQUASHFS
+		bool "squashfs"
+		default y if USES_SQUASHFS
+		depends !TARGET_ROOTFS_INITRAMFS
+		help
+		  Build a squashfs-lzma root filesystem
+
+	config TARGET_ROOTFS_TGZ
+		bool "tgz"
+		default y if !USES_SQUASHFS && !USES_JFFS2
+		depends !TARGET_ROOTFS_INITRAMFS
+		help
+		  Build a compressed tar archive of the the root filesystem
+		  
+	config TARGET_ROOTFS_EXT2FS
+		bool "ext2"
+		default y if !USES_SQUASHFS && !USES_JFFS2
+		default y if USES_EXT2
+		depends !TARGET_ROOTFS_INITRAMFS
+		help
+		  Ext2 file system with some free space for uml images
+
+comment "Image Options"
+
+source "target/linux/*/image/Config.in"
+
+    config TARGET_ROOTFS_FSPART
+        int "Filesystem part size (in MB)"
+        depends X86_GRUB_IMAGES || TARGET_ROOTFS_EXT2FS || LINUX_2_6_RB532
+        default 16
+        help
+            Allows you to change the filesystem partition size
+
+    config TARGET_ROOTFS_MAXINODE
+        int "Maximum number of inodes in filesystem"
+        depends TARGET_ROOTFS_EXT2FS
+        default 1500
+        help
+            Allows you to change the maximum number of inodes in the filesystem
+
+endmenu
+
 
 config ALL
 	bool "Select all packages by default"
@@ -69,63 +127,6 @@
 source "target/imagebuilder/Config.in"
 source "target/sdk/Config.in"
 
-menu "Target Images"
-	config TARGET_ROOTFS_INITRAMFS
-		bool "ramdisk"
-		default n
-		depends LINUX_2_6
-		help
-		  Embed the rootfs into the kernel (initramfs)
-
-	config TARGET_ROOTFS_JFFS2
-		bool "jffs2"
-		default y if USES_JFFS2
-		depends !TARGET_ROOTFS_INITRAMFS
-		help
-		  Build a jffs2 root filesystem
-
-	config TARGET_ROOTFS_SQUASHFS
-		bool "squashfs"
-		default y if USES_SQUASHFS
-		depends !TARGET_ROOTFS_INITRAMFS
-		help
-		  Build a squashfs-lzma root filesystem
-
-	config TARGET_ROOTFS_TGZ
-		bool "tgz"
-		default y if !USES_SQUASHFS && !USES_JFFS2
-		depends !TARGET_ROOTFS_INITRAMFS
-		help
-		  Build a compressed tar archive of the the root filesystem
-		  
-	config TARGET_ROOTFS_EXT2FS
-		bool "ext2"
-		default y if !USES_SQUASHFS && !USES_JFFS2
-		default y if USES_EXT2
-		depends !TARGET_ROOTFS_INITRAMFS
-		help
-		  Ext2 file system with some free space for uml images
-
-comment "Image Options"
-
-source "target/linux/*/image/Config.in"
-
-    config TARGET_ROOTFS_FSPART
-        int "Filesystem part size (in MB)"
-        depends X86_GRUB_IMAGES || TARGET_ROOTFS_EXT2FS || LINUX_2_6_RB532
-        default 16
-        help
-            Allows you to change the filesystem partition size
-
-    config TARGET_ROOTFS_MAXINODE
-        int "Maximum number of inodes in filesystem"
-        depends TARGET_ROOTFS_EXT2FS
-        default 1500
-        help
-            Allows you to change the maximum number of inodes in the filesystem
-
-endmenu
-
 source "tmp/.config-package.in"
 
 

file:a/Makefile -> file:b/Makefile
--- a/Makefile
+++ b/Makefile
@@ -53,7 +53,7 @@
 tmpinfo-clean: FORCE
 	-rm -rf tmp/.*info
 
-tmp/.config-%.in: tmp/.%info
+tmp/.config-%.in: tmp/.%info scripts/metadata.pl
 	./scripts/metadata.pl $*_config < $< > $@ || rm -f $@
 
 .config: ./scripts/config/conf tmp/.config-target.in tmp/.config-package.in

--- a/scripts/metadata.pl
+++ b/scripts/metadata.pl
@@ -451,22 +451,20 @@
 
 sub gen_package_config() {
 	parse_package_metadata();
-	print "menu \"Image configuration\"\n";
+	print "menuconfig UCI_PRECONFIG\n\tbool \"Image configuration\"\n";
 	foreach my $preconfig (keys %preconfig) {
-		print "\tcomment \"$preconfig\"\n";
 		foreach my $cfg (@{$preconfig{$preconfig}}) {
 			my $conf = $cfg->{id};
 			$conf =~ tr/\.-/__/;
 			print <<EOF
 	config UCI_PRECONFIG_$conf
-		string "$cfg->{label}"
+		string "$cfg->{label}" if UCI_PRECONFIG
 		depends PACKAGE_$preconfig
 		default "$cfg->{default}"
 
 EOF
 		}
 	}
-	print "endmenu\n\n";
 	print_package_config_category 'Base system';
 	foreach my $cat (keys %category) {
 		print_package_config_category $cat;
@@ -542,8 +540,10 @@
 	( \\
 $cmds \\
 	) > \$@
-
-preconfig: \$(TARGET_DIR)/etc/uci-defaults/$preconfig
+	
+ifneq (\$(UCI_PRECONFIG)\$(CONFIG_UCI_PRECONFIG),)
+  preconfig: \$(TARGET_DIR)/etc/uci-defaults/$preconfig
+endif
 EOF
 	}
 }

comments