diff options
author | nbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2006-11-11 23:11:02 +0000 |
---|---|---|
committer | nbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2006-11-11 23:11:02 +0000 |
commit | e158d8b6a7b3c883a8be74cb2327dda6374fc050 (patch) | |
tree | 8be2d6fbdc05c44bd84fbc88d3fb9c92c07bf179 /scripts | |
parent | b95511065669c952e554ccbe8c8054bd166019e4 (diff) |
make target/linux/* directories self-contained, use the selected kernel version for the toolchain, autogenerate menuconfig and makefile code for target selection
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@5498 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/gen_package_config.pl (renamed from scripts/gen_menuconfig.pl) | 0 | ||||
-rwxr-xr-x | scripts/gen_target_config.pl | 88 | ||||
-rwxr-xr-x | scripts/gen_target_mk.pl | 65 |
3 files changed, 153 insertions, 0 deletions
diff --git a/scripts/gen_menuconfig.pl b/scripts/gen_package_config.pl index 9c705af563..9c705af563 100755 --- a/scripts/gen_menuconfig.pl +++ b/scripts/gen_package_config.pl diff --git a/scripts/gen_target_config.pl b/scripts/gen_target_config.pl new file mode 100755 index 0000000000..c0b83963b6 --- /dev/null +++ b/scripts/gen_target_config.pl @@ -0,0 +1,88 @@ +#!/usr/bin/perl +# +# Copyright (C) 2006 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +use strict; + +my @target; +my $target; + +sub features(@) { + my $ret; + + while ($_ = shift @_) { + /broken/ and $ret .= "\tdepends BROKEN\n"; + /pci/ and $ret .= "\tselect PCI_SUPPORT\n"; + /usb/ and $ret .= "\tselect USB_SUPPORT\n"; + /atm/ and $ret .= "\tselect ATM_SUPPORT\n"; + /pcmcia/ and $ret .= "\tselect PCMCIA_SUPPORT\n"; + /squashfs/ and $ret .= "\tselect USES_SQUASHFS\n"; + /jffs2/ and $ret .= "\tselect USES_JFFS2\n"; + /ext2/ and $ret .= "\tselect USES_EXT2\n"; + } + return $ret; +} + +while (<>) { + chomp; + /^Target:\s*((.+)-(\d+\.\d+))\s*$/ and do { + $target = { + id => $1, + board => $2, + kernel => $3 + }; + push @target, $target; + }; + /^Target-Name:\s*(.+)\s*$/ and $target->{name} = $1; + /^Target-Path:\s*(.+)\s*$/ and $target->{path} = $1; + /^Target-Arch:\s*(.+)\s*$/ and $target->{arch} = $1; + /^Target-Features:\s*(.+)\s*$/ and do { + my $f = []; + $target->{features} = $f; + @$f = split /\s+/, $1; + }; + /^Target-Description:/ and do { + my $desc; + while (<>) { + last if /^@@/; + $desc .= $_; + } + $target->{desc} = $desc; + }; + /^Linux-Version:\s*(.+)\s*$/ and $target->{version} = $1; + /^Linux-Release:\s*(.+)\s*$/ and $target->{release} = $1; + /^Linux-Kernel-Arch:\s*(.+)\s*$/ and $target->{karch} = $1; +} + +@target = sort { + $a->{name} cmp $b->{name} +} @target; + + +foreach $target (@target) { + my $conf = uc $target->{kernel}.'_'.$target->{board}; + my $features = features(@{$target->{features}}); + my $help = $target->{desc}; + chomp $features; + $features .= "\n"; + $conf =~ tr/\.-/__/; + if ($help =~ /\w+/) { + $help =~ s/^\s*/\t /mg; + $help = "\thelp\n$help"; + } else { + undef $help; + } + + print <<EOF +config LINUX_$conf + bool "$target->{name}" + select $target->{arch} +$features$help + +EOF +} + diff --git a/scripts/gen_target_mk.pl b/scripts/gen_target_mk.pl new file mode 100755 index 0000000000..52f2a5c06d --- /dev/null +++ b/scripts/gen_target_mk.pl @@ -0,0 +1,65 @@ +#!/usr/bin/perl +# +# Copyright (C) 2006 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +use strict; + +my @target; +my $target; + +while (<>) { + chomp; + /^Target:\s*((.+)-(\d+\.\d+))\s*$/ and do { + $target = { + id => $1, + board => $2, + kernel => $3 + }; + push @target, $target; + }; + /^Target-Name:\s*(.+)\s*$/ and $target->{name} = $1; + /^Target-Path:\s*(.+)\s*$/ and $target->{path} = $1; + /^Target-Arch:\s*(.+)\s*$/ and $target->{arch} = $1; + /^Target-Features:\s*(.+)\s*$/ and do { + my $f = []; + $target->{features} = $f; + @$f = split /\s+/, $1; + }; + /^Target-Description:/ and do { + my $desc; + while (<>) { + last if /^@@/; + $desc .= $_; + } + $target->{desc} = $desc; + }; + /^Linux-Version:\s*(.+)\s*$/ and $target->{version} = $1; + /^Linux-Release:\s*(.+)\s*$/ and $target->{release} = $1; + /^Linux-Kernel-Arch:\s*(.+)\s*$/ and $target->{karch} = $1; +} + +@target = sort { + $a->{id} cmp $b->{id} +} @target; + +foreach $target (@target) { + my $conf = uc $target->{kernel}.'_'.$target->{board}; + $conf =~ tr/\.-/__/; + print <<EOF +ifeq (\$(CONFIG_LINUX_$conf),y) + define Target + KERNEL:=$target->{kernel} + BOARD:=$target->{board} + LINUX_VERSION:=$target->{version} + LINUX_RELEASE:=$target->{release} + LINUX_KARCH:=$target->{karch} + endef +endif + +EOF +} +print "\$(eval \$(call Target))\n"; |