2016-05-22 19:31:37 +00:00
|
|
|
#!/usr/bin/env perl
|
|
|
|
use FindBin;
|
|
|
|
use lib "$FindBin::Bin";
|
|
|
|
use strict;
|
|
|
|
use metadata;
|
|
|
|
use Getopt::Long;
|
|
|
|
|
|
|
|
sub target_config_features(@) {
|
|
|
|
my $ret;
|
|
|
|
|
|
|
|
while ($_ = shift @_) {
|
2017-03-14 17:55:02 +00:00
|
|
|
/^arm_v(\w+)$/ and $ret .= "\tselect arm_v$1\n";
|
|
|
|
/^audio$/ and $ret .= "\tselect AUDIO_SUPPORT\n";
|
2021-08-06 22:28:08 +00:00
|
|
|
/^boot-part$/ and $ret .= "\tselect USES_BOOT_PART\n";
|
|
|
|
/^broken$/ and $ret .= "\tdepends on BROKEN\n";
|
|
|
|
/^cpiogz$/ and $ret .= "\tselect USES_CPIOGZ\n";
|
2017-03-14 17:55:02 +00:00
|
|
|
/^display$/ and $ret .= "\tselect DISPLAY_SUPPORT\n";
|
|
|
|
/^dt$/ and $ret .= "\tselect USES_DEVICETREE\n";
|
2021-08-06 22:28:08 +00:00
|
|
|
/^dt-overlay$/ and $ret .= "\tselect HAS_DT_OVERLAY_SUPPORT\n";
|
2021-12-01 15:17:55 +00:00
|
|
|
/^emmc$/ and $ret .= "\tselect EMMC_SUPPORT\n";
|
2021-08-06 22:28:08 +00:00
|
|
|
/^ext4$/ and $ret .= "\tselect USES_EXT4\n";
|
|
|
|
/^fpu$/ and $ret .= "\tselect HAS_FPU\n";
|
2017-03-14 17:55:02 +00:00
|
|
|
/^gpio$/ and $ret .= "\tselect GPIO_SUPPORT\n";
|
2021-08-06 22:28:08 +00:00
|
|
|
/^jffs2$/ and $ret .= "\tselect USES_JFFS2\n";
|
|
|
|
/^jffs2_nand$/ and $ret .= "\tselect USES_JFFS2_NAND\n";
|
base-files: rename 'sdcard' to 'legacy-sdcard'
While an image layout based on MBR and 'bootfs' partition may be easy
to understand for users who are very used to the IBM PC and always have
the option to access the SD card outside of the device (and hence don't
really depend on other recovery methods or dual-boot), in my opinion
it's a dead end for many desirable features on embedded systems,
especially when managed remotely (and hence without an easy option to
access the SD card using another device in case things go wrong, for
example).
Let me explain:
* using a MSDOS/VFAT filesystem to store kernel(s) is problematic, as a
single corruption of the bootfs can render the system into a state
that it no longer boots at all. This makes dual-boot useless, or at
least very tedious to setup with then 2 independent boot partitions
to avoid the single point of failure on a "hot" block (the FAT index
of the boot partition, written every time a file is changed in
bootfs). And well: most targets even store the bootloader environment
in a file in that very same FAT filesystem, hence it cannot be used
to script a reliable dual-boot method (as loading the environment
itself will already fail if the filesystem is corrupted).
* loading the kernel uImage from bootfs and using rootfs inside an
additional partition means the bootloader can only validate the
kernel -- if rootfs is broken or corrupted, this can lead to a reboot
loop, which is often a quite costly thing to happen in terms of
hardware lifetime.
* imitating MBR-boot behavior with a FAT-formatted bootfs partition
(like IBM PC in the 80s and 90s) is just one of many choices on
embedded targets. There are much better options with modern U-Boot
(which is what we use and build from source for all targets booting
off SD cards), see examples in mediatek/mt7622 and mediatek/mt7623.
Hence rename the 'sdcard' feature to 'legacy-sdcard', and prefix
functions with 'legacy_sdcard_' instead of 'sdcard_'.
Tested-by: Stijn Tintel <stijn@linux-ipv6.be>
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2021-08-07 13:30:53 +00:00
|
|
|
/^legacy-sdcard$/ and $ret .= "\tselect LEGACY_SDCARD_SUPPORT\n";
|
2021-08-06 22:28:08 +00:00
|
|
|
/^low_mem$/ and $ret .= "\tselect LOW_MEMORY_FOOTPRINT\n";
|
|
|
|
/^minor$/ and $ret .= "\tselect USES_MINOR\n";
|
|
|
|
/^mips16$/ and $ret .= "\tselect HAS_MIPS16\n";
|
|
|
|
/^nand$/ and $ret .= "\tselect NAND_SUPPORT\n";
|
|
|
|
/^nommu$/ and $ret .= "\tselect NOMMU\n";
|
2017-03-14 17:55:02 +00:00
|
|
|
/^pci$/ and $ret .= "\tselect PCI_SUPPORT\n";
|
|
|
|
/^pcie$/ and $ret .= "\tselect PCIE_SUPPORT\n";
|
|
|
|
/^pcmcia$/ and $ret .= "\tselect PCMCIA_SUPPORT\n";
|
2021-08-06 22:28:08 +00:00
|
|
|
/^powerpc64$/ and $ret .= "\tselect powerpc64\n";
|
2020-08-29 21:07:28 +00:00
|
|
|
/^pwm$/ and $ret .= "\select PWM_SUPPORT\n";
|
2021-08-06 22:28:08 +00:00
|
|
|
/^ramdisk$/ and $ret .= "\tselect USES_INITRAMFS\n";
|
|
|
|
/^rfkill$/ and $ret .= "\tselect RFKILL_SUPPORT\n";
|
|
|
|
/^rootfs-part$/ and $ret .= "\tselect USES_ROOTFS_PART\n";
|
2017-03-14 17:55:02 +00:00
|
|
|
/^rtc$/ and $ret .= "\tselect RTC_SUPPORT\n";
|
2021-08-06 22:28:08 +00:00
|
|
|
/^separate_ramdisk$/ and $ret .= "\tselect USES_INITRAMFS\n\tselect USES_SEPARATE_INITRAMFS\n";
|
|
|
|
/^small_flash$/ and $ret .= "\tselect SMALL_FLASH\n";
|
|
|
|
/^spe_fpu$/ and $ret .= "\tselect HAS_SPE_FPU\n";
|
2017-03-14 17:55:02 +00:00
|
|
|
/^squashfs$/ and $ret .= "\tselect USES_SQUASHFS\n";
|
|
|
|
/^targz$/ and $ret .= "\tselect USES_TARGZ\n";
|
2021-08-06 22:28:08 +00:00
|
|
|
/^testing-kernel$/ and $ret .= "\tselect HAS_TESTING_KERNEL\n";
|
2017-03-14 17:55:02 +00:00
|
|
|
/^ubifs$/ and $ret .= "\tselect USES_UBIFS\n";
|
2021-08-06 22:28:08 +00:00
|
|
|
/^usb$/ and $ret .= "\tselect USB_SUPPORT\n";
|
|
|
|
/^usbgadget$/ and $ret .= "\tselect USB_GADGET_SUPPORT\n";
|
2017-03-14 17:55:02 +00:00
|
|
|
/^virtio$/ and $ret .= "\tselect VIRTIO_SUPPORT\n";
|
2016-05-22 19:31:37 +00:00
|
|
|
}
|
|
|
|
return $ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
sub target_name($) {
|
|
|
|
my $target = shift;
|
|
|
|
my $parent = $target->{parent};
|
|
|
|
if ($parent) {
|
|
|
|
return $target->{parent}->{name}." - ".$target->{name};
|
|
|
|
} else {
|
|
|
|
return $target->{name};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
sub kver($) {
|
|
|
|
my $v = shift;
|
|
|
|
$v =~ tr/\./_/;
|
|
|
|
if (substr($v,0,2) eq "2_") {
|
|
|
|
$v =~ /(\d+_\d+_\d+)(_\d+)?/ and $v = $1;
|
|
|
|
} else {
|
|
|
|
$v =~ /(\d+_\d+)(_\d+)?/ and $v = $1;
|
|
|
|
}
|
|
|
|
return $v;
|
|
|
|
}
|
|
|
|
|
|
|
|
sub print_target($) {
|
|
|
|
my $target = shift;
|
|
|
|
my $features = target_config_features(@{$target->{features}});
|
|
|
|
my $help = $target->{desc};
|
|
|
|
my $confstr;
|
|
|
|
|
|
|
|
chomp $features;
|
|
|
|
$features .= "\n";
|
|
|
|
if ($help =~ /\w+/) {
|
|
|
|
$help =~ s/^\s*/\t /mg;
|
|
|
|
$help = "\thelp\n$help";
|
|
|
|
} else {
|
|
|
|
undef $help;
|
|
|
|
}
|
|
|
|
|
|
|
|
my $v = kver($target->{version});
|
2019-04-27 17:13:07 +00:00
|
|
|
my $tv = kver($target->{testing_version});
|
|
|
|
$tv or $tv = $v;
|
2016-05-22 19:31:37 +00:00
|
|
|
if (@{$target->{subtargets}} == 0) {
|
|
|
|
$confstr = <<EOF;
|
|
|
|
config TARGET_$target->{conf}
|
|
|
|
bool "$target->{name}"
|
2019-04-27 17:13:07 +00:00
|
|
|
select LINUX_$v if !TESTING_KERNEL
|
|
|
|
select LINUX_$tv if TESTING_KERNEL
|
2016-05-22 19:31:37 +00:00
|
|
|
EOF
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$confstr = <<EOF;
|
|
|
|
config TARGET_$target->{conf}
|
|
|
|
bool "$target->{name}"
|
|
|
|
EOF
|
|
|
|
}
|
|
|
|
if ($target->{subtarget}) {
|
|
|
|
$confstr .= "\tdepends on TARGET_$target->{boardconf}\n";
|
|
|
|
}
|
|
|
|
if (@{$target->{subtargets}} > 0) {
|
|
|
|
$confstr .= "\tselect HAS_SUBTARGETS\n";
|
|
|
|
grep { /broken/ } @{$target->{features}} and $confstr .= "\tdepends on BROKEN\n";
|
|
|
|
} else {
|
|
|
|
$confstr .= $features;
|
|
|
|
if ($target->{arch} =~ /\w/) {
|
|
|
|
$confstr .= "\tselect $target->{arch}\n";
|
|
|
|
}
|
2016-05-22 20:02:31 +00:00
|
|
|
if ($target->{has_devices}) {
|
|
|
|
$confstr .= "\tselect HAS_DEVICES\n";
|
|
|
|
}
|
2016-05-22 19:31:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
foreach my $dep (@{$target->{depends}}) {
|
|
|
|
my $mode = "depends on";
|
|
|
|
my $flags;
|
|
|
|
my $name;
|
|
|
|
|
|
|
|
$dep =~ /^([@\+\-]+)(.+)$/;
|
|
|
|
$flags = $1;
|
|
|
|
$name = $2;
|
|
|
|
|
|
|
|
next if $name =~ /:/;
|
|
|
|
$flags =~ /-/ and $mode = "deselect";
|
|
|
|
$flags =~ /\+/ and $mode = "select";
|
|
|
|
$flags =~ /@/ and $confstr .= "\t$mode $name\n";
|
|
|
|
}
|
|
|
|
$confstr .= "$help\n\n";
|
|
|
|
print $confstr;
|
|
|
|
}
|
|
|
|
|
|
|
|
sub merge_package_lists($$) {
|
|
|
|
my $list1 = shift;
|
|
|
|
my $list2 = shift;
|
|
|
|
my @l = ();
|
|
|
|
my %pkgs;
|
|
|
|
|
|
|
|
foreach my $pkg (@$list1, @$list2) {
|
2024-10-26 20:57:46 +00:00
|
|
|
$pkgs{$pkg =~ s/^~//r} = 1;
|
2016-05-22 19:31:37 +00:00
|
|
|
}
|
|
|
|
foreach my $pkg (keys %pkgs) {
|
|
|
|
push @l, $pkg unless ($pkg =~ /^-/ or $pkgs{"-$pkg"});
|
|
|
|
}
|
|
|
|
return sort(@l);
|
|
|
|
}
|
|
|
|
|
|
|
|
sub gen_target_config() {
|
|
|
|
my $file = shift @ARGV;
|
|
|
|
my @target = parse_target_metadata($file);
|
|
|
|
my %defaults;
|
|
|
|
|
|
|
|
my @target_sort = sort {
|
|
|
|
target_name($a) cmp target_name($b);
|
|
|
|
} @target;
|
|
|
|
|
2016-07-22 12:27:52 +00:00
|
|
|
foreach my $target (@target_sort) {
|
|
|
|
next if @{$target->{subtargets}} > 0;
|
|
|
|
print <<EOF;
|
|
|
|
config DEFAULT_TARGET_$target->{conf}
|
|
|
|
bool
|
|
|
|
depends on TARGET_PER_DEVICE_ROOTFS
|
|
|
|
default y if TARGET_$target->{conf}
|
|
|
|
EOF
|
|
|
|
foreach my $pkg (@{$target->{packages}}) {
|
|
|
|
print "\tselect DEFAULT_$pkg if TARGET_PER_DEVICE_ROOTFS\n";
|
|
|
|
}
|
|
|
|
}
|
2016-05-22 19:31:37 +00:00
|
|
|
|
|
|
|
print <<EOF;
|
|
|
|
choice
|
|
|
|
prompt "Target System"
|
2024-11-29 08:13:52 +00:00
|
|
|
default TARGET_mediatek
|
2016-05-22 19:31:37 +00:00
|
|
|
reset if !DEVEL
|
|
|
|
|
|
|
|
EOF
|
|
|
|
|
|
|
|
foreach my $target (@target_sort) {
|
|
|
|
next if $target->{subtarget};
|
|
|
|
print_target($target);
|
|
|
|
}
|
|
|
|
|
|
|
|
print <<EOF;
|
|
|
|
endchoice
|
|
|
|
|
|
|
|
choice
|
|
|
|
prompt "Subtarget" if HAS_SUBTARGETS
|
|
|
|
EOF
|
|
|
|
foreach my $target (@target) {
|
|
|
|
next unless $target->{def_subtarget};
|
|
|
|
print <<EOF;
|
|
|
|
default TARGET_$target->{conf}_$target->{def_subtarget} if TARGET_$target->{conf}
|
|
|
|
EOF
|
|
|
|
}
|
|
|
|
print <<EOF;
|
|
|
|
|
|
|
|
EOF
|
|
|
|
foreach my $target (@target) {
|
|
|
|
next unless $target->{subtarget};
|
|
|
|
print_target($target);
|
|
|
|
}
|
|
|
|
|
|
|
|
print <<EOF;
|
|
|
|
endchoice
|
|
|
|
|
|
|
|
choice
|
|
|
|
prompt "Target Profile"
|
2017-02-14 11:24:07 +00:00
|
|
|
default TARGET_MULTI_PROFILE if BUILDBOT
|
2016-05-22 19:31:37 +00:00
|
|
|
|
2016-05-22 20:02:31 +00:00
|
|
|
EOF
|
|
|
|
foreach my $target (@target) {
|
|
|
|
my $profile = $target->{profiles}->[0];
|
2024-11-29 08:13:52 +00:00
|
|
|
foreach my $p (@{$target->{profiles}}) {
|
|
|
|
last unless $target->{default_profile};
|
|
|
|
my $name = $p->{id};
|
|
|
|
$name =~ s/^DEVICE_//;
|
|
|
|
next unless $name eq $target->{default_profile};
|
|
|
|
$profile = $p;
|
|
|
|
last;
|
|
|
|
}
|
2016-05-22 20:02:31 +00:00
|
|
|
$profile or next;
|
|
|
|
print <<EOF;
|
2017-02-14 11:24:07 +00:00
|
|
|
default TARGET_$target->{conf}_$profile->{id} if TARGET_$target->{conf} && !BUILDBOT
|
2016-05-22 20:02:31 +00:00
|
|
|
EOF
|
|
|
|
}
|
|
|
|
|
|
|
|
print <<EOF;
|
|
|
|
|
|
|
|
config TARGET_MULTI_PROFILE
|
|
|
|
bool "Multiple devices"
|
|
|
|
depends on HAS_DEVICES
|
2016-10-12 13:51:22 +00:00
|
|
|
help
|
|
|
|
Instead of only building a single image, or all images, this allows you
|
|
|
|
to select images to be built for multiple devices in one build.
|
2016-05-22 20:02:31 +00:00
|
|
|
|
2016-05-22 19:31:37 +00:00
|
|
|
EOF
|
|
|
|
|
|
|
|
foreach my $target (@target) {
|
|
|
|
my $profiles = $target->{profiles};
|
|
|
|
foreach my $profile (@{$target->{profiles}}) {
|
|
|
|
print <<EOF;
|
|
|
|
config TARGET_$target->{conf}_$profile->{id}
|
|
|
|
bool "$profile->{name}"
|
|
|
|
depends on TARGET_$target->{conf}
|
|
|
|
EOF
|
2020-07-28 18:47:34 +00:00
|
|
|
$profile->{broken} and print "\tdepends on BROKEN\n";
|
2016-05-22 19:31:37 +00:00
|
|
|
my @pkglist = merge_package_lists($target->{packages}, $profile->{packages});
|
|
|
|
foreach my $pkg (@pkglist) {
|
|
|
|
print "\tselect DEFAULT_$pkg\n";
|
|
|
|
$defaults{$pkg} = 1;
|
|
|
|
}
|
|
|
|
my $help = $profile->{desc};
|
|
|
|
if ($help =~ /\w+/) {
|
|
|
|
$help =~ s/^\s*/\t /mg;
|
|
|
|
$help = "\thelp\n$help";
|
|
|
|
} else {
|
|
|
|
undef $help;
|
|
|
|
}
|
|
|
|
print "$help\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
print <<EOF;
|
|
|
|
endchoice
|
|
|
|
|
2016-05-22 20:02:31 +00:00
|
|
|
menu "Target Devices"
|
|
|
|
depends on TARGET_MULTI_PROFILE
|
|
|
|
|
2016-07-22 12:29:32 +00:00
|
|
|
config TARGET_ALL_PROFILES
|
|
|
|
bool "Enable all profiles by default"
|
2017-02-14 11:24:07 +00:00
|
|
|
default BUILDBOT
|
2016-07-22 12:29:32 +00:00
|
|
|
|
2016-07-22 12:27:52 +00:00
|
|
|
config TARGET_PER_DEVICE_ROOTFS
|
|
|
|
bool "Use a per-device root filesystem that adds profile packages"
|
2017-02-14 11:24:07 +00:00
|
|
|
default BUILDBOT
|
2016-10-12 13:51:22 +00:00
|
|
|
help
|
|
|
|
When disabled, all device packages from all selected devices
|
|
|
|
will be included in all images by default. (Marked as <*>) You will
|
|
|
|
still be able to manually deselect any/all packages.
|
|
|
|
When enabled, each device builds it's own image, including only the
|
|
|
|
profile packages for that device. (Marked as {M}) You will be able
|
|
|
|
to change a package to included in all images by marking as {*}, but
|
|
|
|
will not be able to disable a profile package completely.
|
|
|
|
|
|
|
|
To get the most use of this setting, you must set in a .config stub
|
|
|
|
before calling "make defconfig". Selecting TARGET_MULTI_PROFILE and
|
|
|
|
then manually selecting (via menuconfig for instance) this option
|
|
|
|
will have pre-defaulted all profile packages to included, making this
|
|
|
|
option appear to have had no effect.
|
2016-07-22 12:27:52 +00:00
|
|
|
|
2016-05-22 20:02:31 +00:00
|
|
|
EOF
|
|
|
|
foreach my $target (@target) {
|
2016-10-12 13:51:23 +00:00
|
|
|
my @profiles = sort {
|
|
|
|
my $x = $a->{name};
|
|
|
|
my $y = $b->{name};
|
|
|
|
"\L$x" cmp "\L$y";
|
|
|
|
} @{$target->{profiles}};
|
|
|
|
foreach my $profile (@profiles) {
|
2016-05-22 20:02:31 +00:00
|
|
|
next unless $profile->{id} =~ /^DEVICE_/;
|
|
|
|
print <<EOF;
|
2016-09-24 16:25:25 +00:00
|
|
|
menuconfig TARGET_DEVICE_$target->{conf}_$profile->{id}
|
2016-05-22 20:02:31 +00:00
|
|
|
bool "$profile->{name}"
|
|
|
|
depends on TARGET_$target->{conf}
|
2019-08-13 10:33:47 +00:00
|
|
|
default $profile->{default}
|
2016-05-22 20:02:31 +00:00
|
|
|
EOF
|
2020-07-28 18:47:34 +00:00
|
|
|
$profile->{broken} and print "\tdepends on BROKEN\n";
|
2016-05-22 20:02:31 +00:00
|
|
|
my @pkglist = merge_package_lists($target->{packages}, $profile->{packages});
|
|
|
|
foreach my $pkg (@pkglist) {
|
2016-07-22 12:27:52 +00:00
|
|
|
print "\tselect DEFAULT_$pkg if !TARGET_PER_DEVICE_ROOTFS\n";
|
|
|
|
print "\tselect MODULE_DEFAULT_$pkg if TARGET_PER_DEVICE_ROOTFS\n";
|
2016-05-22 20:02:31 +00:00
|
|
|
$defaults{$pkg} = 1;
|
|
|
|
}
|
2016-09-24 16:25:25 +00:00
|
|
|
|
|
|
|
print <<EOF;
|
|
|
|
|
|
|
|
|
|
|
|
config TARGET_DEVICE_PACKAGES_$target->{conf}_$profile->{id}
|
|
|
|
string "$profile->{name} additional packages"
|
|
|
|
default ""
|
|
|
|
depends on TARGET_PER_DEVICE_ROOTFS
|
|
|
|
depends on TARGET_DEVICE_$target->{conf}_$profile->{id}
|
|
|
|
|
|
|
|
EOF
|
2016-05-22 20:02:31 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
print <<EOF;
|
|
|
|
|
|
|
|
endmenu
|
|
|
|
|
2016-05-22 19:31:37 +00:00
|
|
|
config HAS_SUBTARGETS
|
|
|
|
bool
|
|
|
|
|
2016-05-22 20:02:31 +00:00
|
|
|
config HAS_DEVICES
|
|
|
|
bool
|
|
|
|
|
2016-05-22 19:31:37 +00:00
|
|
|
config TARGET_BOARD
|
|
|
|
string
|
|
|
|
|
|
|
|
EOF
|
|
|
|
foreach my $target (@target) {
|
|
|
|
$target->{subtarget} or print "\t\tdefault \"".$target->{board}."\" if TARGET_".$target->{conf}."\n";
|
|
|
|
}
|
|
|
|
print <<EOF;
|
|
|
|
config TARGET_SUBTARGET
|
|
|
|
string
|
|
|
|
default "generic" if !HAS_SUBTARGETS
|
|
|
|
|
|
|
|
EOF
|
|
|
|
|
|
|
|
foreach my $target (@target) {
|
|
|
|
foreach my $subtarget (@{$target->{subtargets}}) {
|
|
|
|
print "\t\tdefault \"$subtarget\" if TARGET_".$target->{conf}."_$subtarget\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
print <<EOF;
|
|
|
|
config TARGET_PROFILE
|
|
|
|
string
|
|
|
|
EOF
|
|
|
|
foreach my $target (@target) {
|
|
|
|
my $profiles = $target->{profiles};
|
|
|
|
foreach my $profile (@$profiles) {
|
|
|
|
print "\tdefault \"$profile->{id}\" if TARGET_$target->{conf}_$profile->{id}\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
print <<EOF;
|
|
|
|
|
|
|
|
config TARGET_ARCH_PACKAGES
|
|
|
|
string
|
|
|
|
|
|
|
|
EOF
|
|
|
|
foreach my $target (@target) {
|
|
|
|
next if @{$target->{subtargets}} > 0;
|
|
|
|
print "\t\tdefault \"".($target->{arch_packages} || $target->{board})."\" if TARGET_".$target->{conf}."\n";
|
|
|
|
}
|
|
|
|
print <<EOF;
|
|
|
|
|
|
|
|
config DEFAULT_TARGET_OPTIMIZATION
|
|
|
|
string
|
|
|
|
EOF
|
|
|
|
foreach my $target (@target) {
|
|
|
|
next if @{$target->{subtargets}} > 0;
|
|
|
|
print "\tdefault \"".$target->{cflags}."\" if TARGET_".$target->{conf}."\n";
|
|
|
|
}
|
|
|
|
print "\tdefault \"-Os -pipe -funit-at-a-time\"\n";
|
|
|
|
print <<EOF;
|
|
|
|
|
|
|
|
config CPU_TYPE
|
|
|
|
string
|
|
|
|
EOF
|
|
|
|
foreach my $target (@target) {
|
|
|
|
next if @{$target->{subtargets}} > 0;
|
|
|
|
print "\tdefault \"".$target->{cputype}."\" if TARGET_".$target->{conf}."\n";
|
|
|
|
}
|
|
|
|
print "\tdefault \"\"\n";
|
|
|
|
|
|
|
|
my %kver;
|
|
|
|
foreach my $target (@target) {
|
2019-04-27 17:13:07 +00:00
|
|
|
foreach my $tv ($target->{version}, $target->{testing_version}) {
|
|
|
|
next unless $tv;
|
|
|
|
my $v = kver($tv);
|
|
|
|
next if $kver{$v};
|
|
|
|
$kver{$v} = 1;
|
|
|
|
print <<EOF;
|
2016-05-22 19:31:37 +00:00
|
|
|
|
|
|
|
config LINUX_$v
|
|
|
|
bool
|
|
|
|
|
|
|
|
EOF
|
2019-04-27 17:13:07 +00:00
|
|
|
}
|
2016-05-22 19:31:37 +00:00
|
|
|
}
|
|
|
|
foreach my $def (sort keys %defaults) {
|
2016-07-22 12:27:52 +00:00
|
|
|
print <<EOF;
|
|
|
|
config DEFAULT_$def
|
|
|
|
bool
|
|
|
|
|
|
|
|
config MODULE_DEFAULT_$def
|
|
|
|
tristate
|
|
|
|
depends on TARGET_PER_DEVICE_ROOTFS
|
|
|
|
depends on m
|
|
|
|
default m if DEFAULT_$def
|
|
|
|
select PACKAGE_$def
|
|
|
|
|
|
|
|
EOF
|
2016-05-22 19:31:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
sub gen_profile_mk() {
|
|
|
|
my $file = shift @ARGV;
|
|
|
|
my $target = shift @ARGV;
|
|
|
|
my @targets = parse_target_metadata($file);
|
|
|
|
foreach my $cur (@targets) {
|
|
|
|
next unless $cur->{id} eq $target;
|
2020-04-15 00:49:54 +00:00
|
|
|
my @profile_ids_unique = do { my %seen; grep { !$seen{$_}++} map { $_->{id} } @{$cur->{profiles}}};
|
|
|
|
print "PROFILE_NAMES = ".join(" ", @profile_ids_unique)."\n";
|
2016-05-22 19:31:37 +00:00
|
|
|
foreach my $profile (@{$cur->{profiles}}) {
|
|
|
|
print $profile->{id}.'_NAME:='.$profile->{name}."\n";
|
2019-03-06 13:45:15 +00:00
|
|
|
print $profile->{id}.'_HAS_IMAGE_METADATA:='.$profile->{has_image_metadata}."\n";
|
2019-03-27 21:52:05 +00:00
|
|
|
if (defined($profile->{supported_devices}) and @{$profile->{supported_devices}} > 0) {
|
2019-03-11 04:32:29 +00:00
|
|
|
print $profile->{id}.'_SUPPORTED_DEVICES:='.join(' ', @{$profile->{supported_devices}})."\n";
|
|
|
|
}
|
2016-05-22 19:31:37 +00:00
|
|
|
print $profile->{id}.'_PACKAGES:='.join(' ', @{$profile->{packages}})."\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
sub parse_command() {
|
|
|
|
GetOptions("ignore=s", \@ignore);
|
|
|
|
my $cmd = shift @ARGV;
|
|
|
|
for ($cmd) {
|
|
|
|
/^config$/ and return gen_target_config();
|
|
|
|
/^profile_mk$/ and return gen_profile_mk();
|
|
|
|
}
|
|
|
|
die <<EOF
|
|
|
|
Available Commands:
|
|
|
|
$0 config [file] Target metadata in Kconfig format
|
|
|
|
$0 profile_mk [file] [target] Profile metadata in makefile format
|
|
|
|
|
|
|
|
EOF
|
|
|
|
}
|
|
|
|
|
|
|
|
parse_command();
|