build: add a config option for enabling a testing version of the target kernel
[openwrt/openwrt.git] / scripts / target-metadata.pl
index 123958799fe3fc0ca34192f175bccd92622c96a9..d183e943f6c03e42b7df9874de8059042c8a7d8e 100755 (executable)
@@ -42,6 +42,7 @@ sub target_config_features(@) {
                /^virtio$/ and $ret .= "\tselect VIRTIO_SUPPORT\n";
                /^rootfs-part$/ and $ret .= "\tselect USES_ROOTFS_PART\n";
                /^boot-part$/ and $ret .= "\tselect USES_BOOT_PART\n";
+               /^testing-kernel$/ and $ret .= "\tselect HAS_TESTING_KERNEL\n";
        }
        return $ret;
 }
@@ -83,11 +84,14 @@ sub print_target($) {
        }
 
        my $v = kver($target->{version});
+       my $tv = kver($target->{testing_version});
+       $tv or $tv = $v;
        if (@{$target->{subtargets}} == 0) {
        $confstr = <<EOF;
 config TARGET_$target->{conf}
        bool "$target->{name}"
-       select LINUX_$v
+       select LINUX_$v if !TESTING_KERNEL
+       select LINUX_$tv if TESTING_KERNEL
 EOF
        }
        else {
@@ -387,15 +391,18 @@ EOF
 
        my %kver;
        foreach my $target (@target) {
-               my $v = kver($target->{version});
-               next if $kver{$v};
-               $kver{$v} = 1;
-               print <<EOF;
+               foreach my $tv ($target->{version}, $target->{testing_version}) {
+                       next unless $tv;
+                       my $v = kver($tv);
+                       next if $kver{$v};
+                       $kver{$v} = 1;
+                       print <<EOF;
 
 config LINUX_$v
        bool
 
 EOF
+               }
        }
        foreach my $def (sort keys %defaults) {
                print <<EOF;