Commit 2a2ed2db authored by Linus Torvalds's avatar Linus Torvalds

Merge git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild

* git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild: (40 commits)
  kbuild: trivial fixes in Makefile
  kbuild: adding symbols in Kconfig and defconfig to TAGS
  kbuild: replace abort() with exit(1)
  kbuild: support for %.symtypes files
  kbuild: fix silentoldconfig recursion
  kbuild: add option for stripping modules while installing them
  kbuild: kill some false positives from modpost
  kbuild: export-symbol usage report generator
  kbuild: fix make -rR breakage
  kbuild: append -dirty for updated but uncommited changes
  kbuild: append git revision for all untagged commits
  kbuild: fix module.symvers parsing in modpost
  kbuild: ignore make's built-in rules & variables
  kbuild: bugfix with initramfs
  kbuild: modpost build fix
  kbuild: check license compatibility when building modules
  kbuild: export-type enhancement to modpost.c
  kbuild: add dependency on kernel.release to the package targets
  kbuild: `make kernelrelease' speedup
  kconfig: KCONFIG_OVERWRITECONFIG
  ...
parents 972d19e8 070b98bf
......@@ -1123,6 +1123,14 @@ The top Makefile exports the following variables:
$(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE). The user may
override this value on the command line if desired.
INSTALL_MOD_STRIP
If this variable is specified, will cause modules to be stripped
after they are installed. If INSTALL_MOD_STRIP is '1', then the
default option --strip-debug will be used. Otherwise,
INSTALL_MOD_STRIP will used as the option(s) to the strip command.
=== 8 Makefile language
The kernel Makefiles are designed to run with GNU Make. The Makefiles
......
This diff is collapsed.
......@@ -177,7 +177,7 @@ boot := arch/arm/boot
# them changed. We use .arch to indicate when they were updated
# last, otherwise make uses the target directory mtime.
include/asm-arm/.arch: $(wildcard include/config/arch/*.h) include/config/MARKER
include/asm-arm/.arch: $(wildcard include/config/arch/*.h) include/config/auto.conf
@echo ' SYMLINK include/asm-arm/arch -> include/asm-arm/$(INCDIR)'
ifneq ($(KBUILD_SRC),)
$(Q)mkdir -p include/asm-arm
......
......@@ -147,7 +147,7 @@ endif
# them changed. We use .arch and .mach to indicate when they were
# updated last, otherwise make uses the target directory mtime.
include/asm-sh/.cpu: $(wildcard include/config/cpu/*.h) include/config/MARKER
include/asm-sh/.cpu: $(wildcard include/config/cpu/*.h) include/config/auto.conf
@echo ' SYMLINK include/asm-sh/cpu -> include/asm-sh/$(cpuincdir-y)'
$(Q)if [ ! -d include/asm-sh ]; then mkdir -p include/asm-sh; fi
$(Q)ln -fsn $(incdir-prefix)$(cpuincdir-y) include/asm-sh/cpu
......@@ -157,7 +157,7 @@ include/asm-sh/.cpu: $(wildcard include/config/cpu/*.h) include/config/MARKER
# don't, just reference the parent directory so the semantics are
# kept roughly the same.
include/asm-sh/.mach: $(wildcard include/config/sh/*.h) include/config/MARKER
include/asm-sh/.mach: $(wildcard include/config/sh/*.h) include/config/auto.conf
@echo -n ' SYMLINK include/asm-sh/mach -> '
$(Q)if [ ! -d include/asm-sh ]; then mkdir -p include/asm-sh; fi
$(Q)if [ -d $(incdir-prefix)$(incdir-y) ]; then \
......
......@@ -71,7 +71,7 @@ archprepare: $(archinc)/.platform
# Update machine cpu and platform symlinks if something which affects
# them changed.
$(archinc)/.platform: $(wildcard include/config/arch/*.h) include/config/MARKER
$(archinc)/.platform: $(wildcard include/config/arch/*.h) include/config/auto.conf
@echo ' SYMLINK $(archinc)/xtensa/config -> $(archinc)/xtensa/config-$(CPU)'
$(Q)mkdir -p $(archinc)
$(Q)mkdir -p $(archinc)/xtensa
......
......@@ -86,14 +86,14 @@ config MTD_REDBOOT_DIRECTORY_BLOCK
block and "-2" means the penultimate block.
config MTD_REDBOOT_PARTS_UNALLOCATED
bool " Include unallocated flash regions"
bool "Include unallocated flash regions"
depends on MTD_REDBOOT_PARTS
help
If you need to register each unallocated flash region as a MTD
'partition', enable this option.
config MTD_REDBOOT_PARTS_READONLY
bool " Force read-only for RedBoot system images"
bool "Force read-only for RedBoot system images"
depends on MTD_REDBOOT_PARTS
help
If you need to force read-only for 'RedBoot', 'RedBoot Config' and
......
......@@ -212,7 +212,7 @@ config MTD_NETtel
Support for flash chips on NETtel/SecureEdge/SnapGear boards.
config MTD_ALCHEMY
tristate ' AMD Alchemy Pb1xxx/Db1xxx/RDK MTD support'
tristate "AMD Alchemy Pb1xxx/Db1xxx/RDK MTD support"
depends on SOC_AU1X00
help
Flash memory access on AMD Alchemy Pb/Db/RDK Reference Boards
......
......@@ -1169,7 +1169,7 @@ config SCSI_NCR_Q720
you do not have this SCSI card, so say N.
config SCSI_NCR53C8XX_DEFAULT_TAGS
int " default tagged command queue depth"
int "default tagged command queue depth"
depends on SCSI_ZALON || SCSI_NCR_Q720
default "8"
---help---
......@@ -1195,7 +1195,7 @@ config SCSI_NCR53C8XX_DEFAULT_TAGS
There is no safe option other than using good SCSI devices.
config SCSI_NCR53C8XX_MAX_TAGS
int " maximum number of queued commands"
int "maximum number of queued commands"
depends on SCSI_ZALON || SCSI_NCR_Q720
default "32"
---help---
......@@ -1212,7 +1212,7 @@ config SCSI_NCR53C8XX_MAX_TAGS
There is no safe option and the default answer is recommended.
config SCSI_NCR53C8XX_SYNC
int " synchronous transfers frequency in MHz"
int "synchronous transfers frequency in MHz"
depends on SCSI_ZALON || SCSI_NCR_Q720
default "20"
---help---
......@@ -1246,7 +1246,7 @@ config SCSI_NCR53C8XX_SYNC
terminations and SCSI conformant devices.
config SCSI_NCR53C8XX_PROFILE
bool " enable profiling"
bool "enable profiling"
depends on SCSI_ZALON || SCSI_NCR_Q720
help
This option allows you to enable profiling information gathering.
......@@ -1257,7 +1257,7 @@ config SCSI_NCR53C8XX_PROFILE
The normal answer therefore is N.
config SCSI_NCR53C8XX_NO_DISCONNECT
bool " not allow targets to disconnect"
bool "not allow targets to disconnect"
depends on (SCSI_ZALON || SCSI_NCR_Q720) && SCSI_NCR53C8XX_DEFAULT_TAGS=0
help
This option is only provided for safety if you suspect some SCSI
......
#ifndef __LICENSE_H
#define __LICENSE_H
static inline int license_is_gpl_compatible(const char *license)
{
return (strcmp(license, "GPL") == 0
|| strcmp(license, "GPL v2") == 0
|| strcmp(license, "GPL and additional rights") == 0
|| strcmp(license, "Dual BSD/GPL") == 0
|| strcmp(license, "Dual MIT/GPL") == 0
|| strcmp(license, "Dual MPL/GPL") == 0);
}
#endif
config DEFCONFIG_LIST
string
option defconfig_list
default "/lib/modules/$UNAME_RELEASE/.config"
default "/etc/kernel-config"
default "/boot/config-$UNAME_RELEASE"
default "arch/$ARCH/defconfig"
menu "Code maturity level options"
config EXPERIMENTAL
......
......@@ -44,6 +44,7 @@
#include <asm/uaccess.h>
#include <asm/semaphore.h>
#include <asm/cacheflush.h>
#include <linux/license.h>
#if 0
#define DEBUGP printk
......@@ -1251,16 +1252,6 @@ static void layout_sections(struct module *mod,
}
}
static inline int license_is_gpl_compatible(const char *license)
{
return (strcmp(license, "GPL") == 0
|| strcmp(license, "GPL v2") == 0
|| strcmp(license, "GPL and additional rights") == 0
|| strcmp(license, "Dual BSD/GPL") == 0
|| strcmp(license, "Dual MIT/GPL") == 0
|| strcmp(license, "Dual MPL/GPL") == 0);
}
static void set_license(struct module *mod, const char *license)
{
if (!license)
......
......@@ -12,6 +12,11 @@ space := $(empty) $(empty)
# contain a comma
depfile = $(subst $(comma),_,$(@D)/.$(@F).d)
###
# basetarget equals the filename of the target with no extension.
# So 'foo/bar.o' becomes 'bar'
basetarget = $(basename $(notdir $@))
###
# Escape single quote for use in echo statements
escsq = $(subst $(squote),'\$(squote)',$1)
......
......@@ -8,7 +8,7 @@ PHONY := __build
__build:
# Read .config if it exist, otherwise ignore
-include .config
-include include/config/auto.conf
include scripts/Kbuild.include
......@@ -117,7 +117,7 @@ $(real-objs-m:.o=.lst): quiet_modtag := [M]
$(obj-m) : quiet_modtag := [M]
# Default for not multi-part modules
modname = $(*F)
modname = $(basetarget)
$(multi-objs-m) : modname = $(modname-multi)
$(multi-objs-m:.o=.i) : modname = $(modname-multi)
......@@ -140,6 +140,15 @@ cmd_cc_i_c = $(CPP) $(c_flags) -o $@ $<
%.i: %.c FORCE
$(call if_changed_dep,cc_i_c)
quiet_cmd_cc_symtypes_c = SYM $(quiet_modtag) $@
cmd_cc_symtypes_c = \
$(CPP) -D__GENKSYMS__ $(c_flags) $< \
| $(GENKSYMS) -T $@ >/dev/null; \
test -s $@ || rm -f $@
%.symtypes : %.c FORCE
$(call if_changed_dep,cc_symtypes_c)
# C (.c) files
# The C file is compiled and updated dependency information is generated.
# (See cmd_cc_o_c + relevant part of rule_cc_o_c)
......@@ -166,7 +175,8 @@ cmd_cc_o_c = $(CC) $(c_flags) -c -o $(@D)/.tmp_$(@F) $<
cmd_modversions = \
if $(OBJDUMP) -h $(@D)/.tmp_$(@F) | grep -q __ksymtab; then \
$(CPP) -D__GENKSYMS__ $(c_flags) $< \
| $(GENKSYMS) -a $(ARCH) \
| $(GENKSYMS) $(if $(KBUILD_SYMTYPES), \
-T $(@D)/$(@F:.o=.symtypes)) -a $(ARCH) \
> $(@D)/.tmp_$(@F:.o=.ver); \
\
$(LD) $(LDFLAGS) -r -o $@ $(@D)/.tmp_$(@F) \
......
......@@ -33,8 +33,8 @@
__hostprogs := $(sort $(hostprogs-y)$(hostprogs-m))
# hostprogs-y := tools/build may have been specified. Retreive directory
obj-dirs += $(foreach f,$(__hostprogs), $(if $(dir $(f)),$(dir $(f))))
obj-dirs := $(strip $(sort $(filter-out ./,$(obj-dirs))))
host-objdirs := $(foreach f,$(__hostprogs), $(if $(dir $(f)),$(dir $(f))))
host-objdirs := $(strip $(sort $(filter-out ./,$(host-objdirs))))
# C code
......@@ -73,13 +73,17 @@ host-cxxmulti := $(addprefix $(obj)/,$(host-cxxmulti))
host-cxxobjs := $(addprefix $(obj)/,$(host-cxxobjs))
host-cshlib := $(addprefix $(obj)/,$(host-cshlib))
host-cshobjs := $(addprefix $(obj)/,$(host-cshobjs))
obj-dirs := $(addprefix $(obj)/,$(obj-dirs))
host-objdirs := $(addprefix $(obj)/,$(host-objdirs))
obj-dirs += $(host-objdirs)
#####
# Handle options to gcc. Support building with separate output directory
_hostc_flags = $(HOSTCFLAGS) $(HOST_EXTRACFLAGS) $(HOSTCFLAGS_$(*F).o)
_hostcxx_flags = $(HOSTCXXFLAGS) $(HOST_EXTRACXXFLAGS) $(HOSTCXXFLAGS_$(*F).o)
_hostc_flags = $(HOSTCFLAGS) $(HOST_EXTRACFLAGS) \
$(HOSTCFLAGS_$(basetarget).o)
_hostcxx_flags = $(HOSTCXXFLAGS) $(HOST_EXTRACXXFLAGS) \
$(HOSTCXXFLAGS_$(basetarget).o)
ifeq ($(KBUILD_SRC),)
__hostc_flags = $(_hostc_flags)
......
......@@ -82,12 +82,12 @@ obj-dirs := $(addprefix $(obj)/,$(obj-dirs))
# than one module. In that case KBUILD_MODNAME will be set to foo_bar,
# where foo and bar are the name of the modules.
name-fix = $(subst $(comma),_,$(subst -,_,$1))
basename_flags = -D"KBUILD_BASENAME=KBUILD_STR($(call name-fix,$(*F)))"
basename_flags = -D"KBUILD_BASENAME=KBUILD_STR($(call name-fix,$(basetarget)))"
modname_flags = $(if $(filter 1,$(words $(modname))),\
-D"KBUILD_MODNAME=KBUILD_STR($(call name-fix,$(modname)))")
_c_flags = $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$(*F).o)
_a_flags = $(AFLAGS) $(EXTRA_AFLAGS) $(AFLAGS_$(*F).o)
_c_flags = $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$(basetarget).o)
_a_flags = $(AFLAGS) $(EXTRA_AFLAGS) $(AFLAGS_$(basetarget).o)
_cpp_flags = $(CPPFLAGS) $(EXTRA_CPPFLAGS) $(CPPFLAGS_$(@F))
# If building the kernel in a separate objtree expand all occurrences
......
......@@ -17,7 +17,7 @@ __modinst: $(modules)
@:
quiet_cmd_modules_install = INSTALL $@
cmd_modules_install = mkdir -p $(2); cp $@ $(2)
cmd_modules_install = mkdir -p $(2); cp $@ $(2) ; $(mod_strip_cmd) $(2)/$(notdir $@)
# Modules built outside the kernel source tree go into extra by default
INSTALL_MOD_DIR ?= extra
......
......@@ -35,7 +35,7 @@
PHONY := _modpost
_modpost: __modpost
include .config
include include/config/auto.conf
include scripts/Kbuild.include
include scripts/Makefile.lib
......@@ -72,7 +72,7 @@ $(modules:.ko=.mod.c): __modpost ;
# Step 5), compile all *.mod.c files
# modname is set to make c_flags define KBUILD_MODNAME
modname = $(*F)
modname = $(basetarget)
quiet_cmd_cc_o_c = CC $@
cmd_cc_o_c = $(CC) $(c_flags) $(CFLAGS_MODULE) \
......
###
# Makefile.basic list the most basic programs used during the build process.
# The programs listed herein is what is needed to do the basic stuff,
# such as splitting .config and fix dependency file.
# such as fix dependency file.
# This initial step is needed to avoid files to be recompiled
# when kernel configuration changes (which is what happens when
# .config is included by main Makefile.
# ---------------------------------------------------------------------------
# fixdep: Used to generate dependency information during build process
# split-include: Divide all config symbols up in a number of files in
# include/config/...
# docproc: Used in Documentation/docbook
hostprogs-y := fixdep split-include docproc
hostprogs-y := fixdep docproc
always := $(hostprogs-y)
# fixdep is needed to compile other host programs
......
/*
* split-include.c
*
* Copyright abandoned, Michael Chastain, <mailto:mec@shout.net>.
* This is a C version of syncdep.pl by Werner Almesberger.
*
* This program takes autoconf.h as input and outputs a directory full
* of one-line include files, merging onto the old values.
*
* Think of the configuration options as key-value pairs. Then there
* are five cases:
*
* key old value new value action
*
* KEY-1 VALUE-1 VALUE-1 leave file alone
* KEY-2 VALUE-2A VALUE-2B write VALUE-2B into file
* KEY-3 - VALUE-3 write VALUE-3 into file
* KEY-4 VALUE-4 - write an empty file
* KEY-5 (empty) - leave old empty file alone
*/
#include <sys/stat.h>
#include <sys/types.h>
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#define ERROR_EXIT(strExit) \
{ \
const int errnoSave = errno; \
fprintf(stderr, "%s: ", str_my_name); \
errno = errnoSave; \
perror((strExit)); \
exit(1); \
}
int main(int argc, const char * argv [])
{
const char * str_my_name;
const char * str_file_autoconf;
const char * str_dir_config;
FILE * fp_config;
FILE * fp_target;
FILE * fp_find;
int buffer_size;
char * line;
char * old_line;
char * list_target;
char * ptarget;
struct stat stat_buf;
/* Check arg count. */
if (argc != 3)
{
fprintf(stderr, "%s: wrong number of arguments.\n", argv[0]);
exit(1);
}
str_my_name = argv[0];
str_file_autoconf = argv[1];
str_dir_config = argv[2];
/* Find a buffer size. */
if (stat(str_file_autoconf, &stat_buf) != 0)
ERROR_EXIT(str_file_autoconf);
buffer_size = 2 * stat_buf.st_size + 4096;
/* Allocate buffers. */
if ( (line = malloc(buffer_size)) == NULL
|| (old_line = malloc(buffer_size)) == NULL
|| (list_target = malloc(buffer_size)) == NULL )
ERROR_EXIT(str_file_autoconf);
/* Open autoconfig file. */
if ((fp_config = fopen(str_file_autoconf, "r")) == NULL)
ERROR_EXIT(str_file_autoconf);
/* Make output directory if needed. */
if (stat(str_dir_config, &stat_buf) != 0)
{
if (mkdir(str_dir_config, 0755) != 0)
ERROR_EXIT(str_dir_config);
}
/* Change to output directory. */
if (chdir(str_dir_config) != 0)
ERROR_EXIT(str_dir_config);
/* Put initial separator into target list. */
ptarget = list_target;
*ptarget++ = '\n';
/* Read config lines. */
while (fgets(line, buffer_size, fp_config))
{
const char * str_config;
int is_same;
int itarget;
if (line[0] != '#')
continue;
if ((str_config = strstr(line, "CONFIG_")) == NULL)
continue;
/* Make the output file name. */
str_config += sizeof("CONFIG_") - 1;
for (itarget = 0; !isspace(str_config[itarget]); itarget++)
{
int c = (unsigned char) str_config[itarget];
if (isupper(c)) c = tolower(c);
if (c == '_') c = '/';
ptarget[itarget] = c;
}
ptarget[itarget++] = '.';
ptarget[itarget++] = 'h';
ptarget[itarget++] = '\0';
/* Check for existing file. */
is_same = 0;
if ((fp_target = fopen(ptarget, "r")) != NULL)
{
fgets(old_line, buffer_size, fp_target);
if (fclose(fp_target) != 0)
ERROR_EXIT(ptarget);
if (!strcmp(line, old_line))
is_same = 1;
}
if (!is_same)
{
/* Auto-create directories. */
int islash;
for (islash = 0; islash < itarget; islash++)
{
if (ptarget[islash] == '/')
{
ptarget[islash] = '\0';
if (stat(ptarget, &stat_buf) != 0
&& mkdir(ptarget, 0755) != 0)
ERROR_EXIT( ptarget );
ptarget[islash] = '/';
}
}
/* Write the file. */
if ((fp_target = fopen(ptarget, "w" )) == NULL)
ERROR_EXIT(ptarget);
fputs(line, fp_target);
if (ferror(fp_target) || fclose(fp_target) != 0)
ERROR_EXIT(ptarget);
}
/* Update target list */
ptarget += itarget;
*(ptarget-1) = '\n';
}
/*
* Close autoconfig file.
* Terminate the target list.
*/
if (fclose(fp_config) != 0)
ERROR_EXIT(str_file_autoconf);
*ptarget = '\0';
/*
* Fix up existing files which have no new value.
* This is Case 4 and Case 5.
*
* I re-read the tree and filter it against list_target.
* This is crude. But it avoids data copies. Also, list_target
* is compact and contiguous, so it easily fits into cache.
*
* Notice that list_target contains strings separated by \n,
* with a \n before the first string and after the last.
* fgets gives the incoming names a terminating \n.
* So by having an initial \n, strstr will find exact matches.
*/
fp_find = popen("find * -type f -name \"*.h\" -print", "r");
if (fp_find == 0)
ERROR_EXIT( "find" );
line[0] = '\n';
while (fgets(line+1, buffer_size, fp_find))
{
if (strstr(list_target, line) == NULL)
{
/*
* This is an old file with no CONFIG_* flag in autoconf.h.
*/
/* First strip the \n. */
line[strlen(line)-1] = '\0';
/* Grab size. */
if (stat(line+1, &stat_buf) != 0)
ERROR_EXIT(line);
/* If file is not empty, make it empty and give it a fresh date. */
if (stat_buf.st_size != 0)
{
if ((fp_target = fopen(line+1, "w")) == NULL)
ERROR_EXIT(line);
if (fclose(fp_target) != 0)
ERROR_EXIT(line);
}
}
}
if (pclose(fp_find) != 0)
ERROR_EXIT("find");
return 0;
}
#!/usr/bin/perl -w
#
# (C) Copyright IBM Corporation 2006.
# Released under GPL v2.
# Author : Ram Pai (linuxram@us.ibm.com)
#
# Usage: export_report.pl -k Module.symvers [-o report_file ] -f *.mod.c
#
use Getopt::Std;
use strict;
sub numerically {
my $no1 = (split /\s+/, $a)[1];
my $no2 = (split /\s+/, $b)[1];
return $no1 <=> $no2;
}
sub alphabetically {
my ($module1, $value1) = @{$a};
my ($module2, $value2) = @{$b};
return $value1 <=> $value2 || $module2 cmp $module1;
}
sub print_depends_on {
my ($href) = @_;
print "\n";
while (my ($mod, $list) = each %$href) {
print "\t$mod:\n";
foreach my $sym (sort numerically @{$list}) {
my ($symbol, $no) = split /\s+/, $sym;
printf("\t\t%-25s\t%-25d\n", $symbol, $no);
}
print "\n";
}
print "\n";
print "~"x80 , "\n";
}
sub usage {
print "Usage: @_ -h -k Module.symvers [ -o outputfile ] \n",
"\t-f: treat all the non-option argument as .mod.c files. ",
"Recommend using this as the last option\n",
"\t-h: print detailed help\n",
"\t-k: the path to Module.symvers file. By default uses ",
"the file from the current directory\n",
"\t-o outputfile: output the report to outputfile\n";
exit 0;
}
sub collectcfiles {
my @file = `cat .tmp_versions/*.mod | grep '.*\.ko\$'`;
@file = grep {s/\.ko/.mod.c/} @file;
chomp @file;
return @file;
}
my (%SYMBOL, %MODULE, %opt, @allcfiles);
if (not getopts('hk:o:f',\%opt) or defined $opt{'h'}) {
usage($0);
}
if (defined $opt{'f'}) {
@allcfiles = @ARGV;
} else {
@allcfiles = collectcfiles();
}
if (not defined $opt{'k'}) {
$opt{'k'} = "Module.symvers";
}
unless (open(MODULE_SYMVERS, $opt{'k'})) {
die "Sorry, cannot open $opt{'k'}: $!\n";
}
if (defined $opt{'o'}) {
unless (open(OUTPUT_HANDLE, ">$opt{'o'}")) {
die "Sorry, cannot open $opt{'o'} $!\n";
}
select OUTPUT_HANDLE;
}
#
# collect all the symbols and their attributes from the
# Module.symvers file
#
while ( <MODULE_SYMVERS> ) {
chomp;
my (undef, $symbol, $module, $gpl) = split;
$SYMBOL { $symbol } = [ $module , "0" , $symbol, $gpl];
}
close(MODULE_SYMVERS);
#
# collect the usage count of each symbol.
#
foreach my $thismod (@allcfiles) {
unless (open(MODULE_MODULE, $thismod)) {
print "Sorry, cannot open $thismod: $!\n";
next;
}
my $state=0;
while ( <MODULE_MODULE> ) {
chomp;
if ($state eq 0) {
$state = 1 if ($_ =~ /static const struct modversion_info/);
next;
}
if ($state eq 1) {
$state = 2 if ($_ =~ /__attribute__\(\(section\("__versions"\)\)\)/);
next;
}
if ($state eq 2) {
if ( $_ !~ /0x[0-9a-f]{7,8},/ ) {
next;
}
my $sym = (split /([,"])/,)[4];
my ($module, $value, $symbol, $gpl) = @{$SYMBOL{$sym}};
$SYMBOL{ $sym } = [ $module, $value+1, $symbol, $gpl];
push(@{$MODULE{$thismod}} , $sym);
}
}
if ($state ne 2) {
print "WARNING:$thismod is not built with CONFIG_MODVERSION enabled\n";
}
close(MODULE_MODULE);
}
print "\tThis file reports the exported symbols usage patterns by in-tree\n",
"\t\t\t\tmodules\n";
printf("%s\n\n\n","x"x80);
printf("\t\t\t\tINDEX\n\n\n");
printf("SECTION 1: Usage counts of all exported symbols\n");
printf("SECTION 2: List of modules and the exported symbols they use\n");
printf("%s\n\n\n","x"x80);
printf("SECTION 1:\tThe exported symbols and their usage count\n\n");
printf("%-25s\t%-25s\t%-5s\t%-25s\n", "Symbol", "Module", "Usage count",
"export type");
#
# print the list of unused exported symbols
#
foreach my $list (sort alphabetically values(%SYMBOL)) {
my ($module, $value, $symbol, $gpl) = @{$list};
printf("%-25s\t%-25s\t%-10s\t", $symbol, $module, $value);
if (defined $gpl) {
printf("%-25s\n",$gpl);
} else {
printf("\n");
}
}
printf("%s\n\n\n","x"x80);
printf("SECTION 2:\n\tThis section reports export-symbol-usage of in-kernel
modules. Each module lists the modules, and the symbols from that module that
it uses. Each listed symbol reports the number of modules using it\n");
print "~"x80 , "\n";
while (my ($thismod, $list) = each %MODULE) {
my %depends;
$thismod =~ s/\.mod\.c/.ko/;
print "\t\t\t$thismod\n";
foreach my $symbol (@{$list}) {
my ($module, $value, undef, $gpl) = @{$SYMBOL{$symbol}};
push (@{$depends{"$module"}}, "$symbol $value");
}
print_depends_on(\%depends);
}
......@@ -42,7 +42,7 @@ static FILE *debugfile;
int cur_line = 1;
char *cur_filename;
static int flag_debug, flag_dump_defs, flag_warnings;
static int flag_debug, flag_dump_defs, flag_dump_types, flag_warnings;
static const char *arch = "";
static const char *mod_prefix = "";
......@@ -50,6 +50,7 @@ static int errors;
static int nsyms;
static struct symbol *expansion_trail;
static struct symbol *visited_symbols;
static const char *const symbol_type_name[] = {
"normal", "typedef", "enum", "struct", "union"
......@@ -176,6 +177,7 @@ struct symbol *add_symbol(const char *name, enum symbol_type type,
sym->type = type;
sym->defn = defn;
sym->expansion_trail = NULL;
sym->visited = NULL;
sym->is_extern = is_extern;
sym->hash_next = symtab[h];
......@@ -236,26 +238,11 @@ static int equal_list(struct string_list *a, struct string_list *b)
static void print_node(FILE * f, struct string_list *list)
{
switch (list->tag) {
case SYM_STRUCT:
putc('s', f);
goto printit;
case SYM_UNION:
putc('u', f);
goto printit;
case SYM_ENUM:
putc('e', f);
goto printit;
case SYM_TYPEDEF:
putc('t', f);
goto printit;
printit:
if (list->tag != SYM_NORMAL) {
putc(symbol_type_name[list->tag][0], f);
putc('#', f);
case SYM_NORMAL:
fputs(list->string, f);
break;
}
fputs(list->string, f);
}
static void print_list(FILE * f, struct string_list *list)
......@@ -287,9 +274,9 @@ static void print_list(FILE * f, struct string_list *list)
}
}
static unsigned long expand_and_crc_list(struct string_list *list,
unsigned long crc)
static unsigned long expand_and_crc_sym(struct symbol *sym, unsigned long crc)
{
struct string_list *list = sym->defn;
struct string_list **e, **b;
struct string_list *tmp, **tmp2;
int elem = 1;
......@@ -332,7 +319,7 @@ static unsigned long expand_and_crc_list(struct string_list *list,
} else {
subsym->expansion_trail = expansion_trail;
expansion_trail = subsym;
crc = expand_and_crc_list(subsym->defn, crc);
crc = expand_and_crc_sym(subsym, crc);
}
break;
......@@ -382,12 +369,22 @@ static unsigned long expand_and_crc_list(struct string_list *list,
} else {
subsym->expansion_trail = expansion_trail;
expansion_trail = subsym;
crc = expand_and_crc_list(subsym->defn, crc);
crc = expand_and_crc_sym(subsym, crc);
}
break;
}
}
{
static struct symbol **end = &visited_symbols;
if (!sym->visited) {
*end = sym;
end = &sym->visited;
sym->visited = (struct symbol *)-1L;
}
}
return crc;
}
......@@ -406,7 +403,7 @@ void export_symbol(const char *name)
expansion_trail = (struct symbol *)-1L;
crc = expand_and_crc_list(sym->defn, 0xffffffff) ^ 0xffffffff;
crc = expand_and_crc_sym(sym, 0xffffffff) ^ 0xffffffff;
sym = expansion_trail;
while (sym != (struct symbol *)-1L) {
......@@ -464,6 +461,7 @@ static void genksyms_usage(void)
int main(int argc, char **argv)
{
FILE *dumpfile = NULL;
int o;
#ifdef __GNU_LIBRARY__
......@@ -473,15 +471,16 @@ int main(int argc, char **argv)
{"warnings", 0, 0, 'w'},
{"quiet", 0, 0, 'q'},
{"dump", 0, 0, 'D'},
{"dump-types", 1, 0, 'T'},
{"version", 0, 0, 'V'},
{"help", 0, 0, 'h'},
{0, 0, 0, 0}
};
while ((o = getopt_long(argc, argv, "a:dwqVDk:p:",
while ((o = getopt_long(argc, argv, "a:dwqVDT:k:p:",
&long_opts[0], NULL)) != EOF)
#else /* __GNU_LIBRARY__ */
while ((o = getopt(argc, argv, "a:dwqVDk:p:")) != EOF)
while ((o = getopt(argc, argv, "a:dwqVDT:k:p:")) != EOF)
#endif /* __GNU_LIBRARY__ */
switch (o) {
case 'a':
......@@ -502,6 +501,14 @@ int main(int argc, char **argv)
case 'D':
flag_dump_defs = 1;
break;
case 'T':
flag_dump_types = 1;
dumpfile = fopen(optarg, "w");
if (!dumpfile) {
perror(optarg);
return 1;
}
break;
case 'h':
genksyms_usage();
return 0;
......@@ -524,6 +531,24 @@ int main(int argc, char **argv)
yyparse();
if (flag_dump_types && visited_symbols) {
while (visited_symbols != (struct symbol *)-1L) {
struct symbol *sym = visited_symbols;
if (sym->type != SYM_NORMAL) {
putc(symbol_type_name[sym->type][0], dumpfile);
putc('#', dumpfile);
}
fputs(sym->name, dumpfile);
putc(' ', dumpfile);
print_list(dumpfile, sym->defn);
putc('\n', dumpfile);
visited_symbols = sym->visited;
sym->visited = NULL;
}
}
if (flag_debug) {
fprintf(debugfile, "Hash table occupancy %d/%d = %g\n",
nsyms, HASH_BUCKETS,
......
......@@ -41,6 +41,7 @@ struct symbol {
enum symbol_type type;
struct string_list *defn;
struct symbol *expansion_trail;
struct symbol *visited;
int is_extern;
};
......
......@@ -2023,7 +2023,7 @@ repeat:
break;
default:
abort();
exit(1);
}
fini:
......
......@@ -392,7 +392,7 @@ repeat:
break;
default:
abort();
exit(1);
}
fini:
......
......@@ -539,6 +539,7 @@ int main(int ac, char **av)
name = av[i];
if (!name) {
printf(_("%s: Kconfig file missing\n"), av[0]);
exit(1);
}
conf_parse(name);
//zconfdump(stdout);
......@@ -573,7 +574,7 @@ int main(int ac, char **av)
case set_random:
name = getenv("KCONFIG_ALLCONFIG");
if (name && !stat(name, &tmpstat)) {
conf_read_simple(name);
conf_read_simple(name, S_DEF_USER);
break;
}
switch (input_mode) {
......@@ -584,9 +585,9 @@ int main(int ac, char **av)
default: break;
}
if (!stat(name, &tmpstat))
conf_read_simple(name);
conf_read_simple(name, S_DEF_USER);
else if (!stat("all.config", &tmpstat))
conf_read_simple("all.config");
conf_read_simple("all.config", S_DEF_USER);
break;
default:
break;
......@@ -599,7 +600,15 @@ int main(int ac, char **av)
input_mode = ask_silent;
valid_stdin = 1;
}
}
} else if (sym_change_count) {
name = getenv("KCONFIG_NOSILENTUPDATE");
if (name && *name) {
fprintf(stderr, _("\n*** Kernel configuration requires explicit update.\n\n"));
return 1;
}
} else
goto skip_check;
do {
conf_cnt = 0;
check_conf(&rootmenu);
......@@ -608,5 +617,11 @@ int main(int ac, char **av)
fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n"));
return 1;
}
skip_check:
if (input_mode == ask_silent && conf_write_autoconf()) {
fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n"));
return 1;
}
return 0;
}
This diff is collapsed.
......@@ -145,7 +145,8 @@ static void __expr_eliminate_eq(enum expr_type type, struct expr **ep1, struct e
return;
}
if (e1->type == E_SYMBOL && e2->type == E_SYMBOL &&
e1->left.sym == e2->left.sym && (e1->left.sym->flags & (SYMBOL_YES|SYMBOL_NO)))
e1->left.sym == e2->left.sym &&
(e1->left.sym == &symbol_yes || e1->left.sym == &symbol_no))
return;
if (!expr_eq(e1, e2))
return;
......@@ -1012,73 +1013,73 @@ int expr_compare_type(enum expr_type t1, enum expr_type t2)
#endif
}
void expr_print(struct expr *e, void (*fn)(void *, const char *), void *data, int prevtoken)
void expr_print(struct expr *e, void (*fn)(void *, struct symbol *, const char *), void *data, int prevtoken)
{
if (!e) {
fn(data, "y");
fn(data, NULL, "y");
return;
}
if (expr_compare_type(prevtoken, e->type) > 0)
fn(data, "(");
fn(data, NULL, "(");
switch (e->type) {
case E_SYMBOL:
if (e->left.sym->name)
fn(data, e->left.sym->name);
fn(data, e->left.sym, e->left.sym->name);
else
fn(data, "<choice>");
fn(data, NULL, "<choice>");
break;
case E_NOT:
fn(data, "!");
fn(data, NULL, "!");
expr_print(e->left.expr, fn, data, E_NOT);
break;
case E_EQUAL:
fn(data, e->left.sym->name);
fn(data, "=");
fn(data, e->right.sym->name);
fn(data, e->left.sym, e->left.sym->name);
fn(data, NULL, "=");
fn(data, e->right.sym, e->right.sym->name);
break;
case E_UNEQUAL:
fn(data, e->left.sym->name);
fn(data, "!=");
fn(data, e->right.sym->name);
fn(data, e->left.sym, e->left.sym->name);
fn(data, NULL, "!=");
fn(data, e->right.sym, e->right.sym->name);
break;
case E_OR:
expr_print(e->left.expr, fn, data, E_OR);
fn(data, " || ");
fn(data, NULL, " || ");
expr_print(e->right.expr, fn, data, E_OR);
break;
case E_AND:
expr_print(e->left.expr, fn, data, E_AND);
fn(data, " && ");
fn(data, NULL, " && ");
expr_print(e->right.expr, fn, data, E_AND);
break;
case E_CHOICE:
fn(data, e->right.sym->name);
fn(data, e->right.sym, e->right.sym->name);
if (e->left.expr) {
fn(data, " ^ ");
fn(data, NULL, " ^ ");
expr_print(e->left.expr, fn, data, E_CHOICE);
}
break;
case E_RANGE:
fn(data, "[");
fn(data, e->left.sym->name);
fn(data, " ");
fn(data, e->right.sym->name);
fn(data, "]");
fn(data, NULL, "[");
fn(data, e->left.sym, e->left.sym->name);
fn(data, NULL, " ");
fn(data, e->right.sym, e->right.sym->name);
fn(data, NULL, "]");
break;
default:
{
char buf[32];
sprintf(buf, "<unknown type %d>", e->type);
fn(data, buf);
fn(data, NULL, buf);
break;
}
}
if (expr_compare_type(prevtoken, e->type) > 0)
fn(data, ")");
fn(data, NULL, ")");
}
static void expr_print_file_helper(void *data, const char *str)
static void expr_print_file_helper(void *data, struct symbol *sym, const char *str)
{
fwrite(str, strlen(str), 1, data);
}
......@@ -1088,7 +1089,7 @@ void expr_fprint(struct expr *e, FILE *out)
expr_print(e, expr_print_file_helper, out, E_NONE);
}
static void expr_print_gstr_helper(void *data, const char *str)
static void expr_print_gstr_helper(void *data, struct symbol *sym, const char *str)
{
str_append((struct gstr*)data, str);
}
......
......@@ -63,12 +63,18 @@ enum symbol_type {
S_UNKNOWN, S_BOOLEAN, S_TRISTATE, S_INT, S_HEX, S_STRING, S_OTHER
};
enum {
S_DEF_USER, /* main user value */
S_DEF_AUTO,
};
struct symbol {
struct symbol *next;
char *name;
char *help;
enum symbol_type type;
struct symbol_value curr, user;
struct symbol_value curr;
struct symbol_value def[4];
tristate visible;
int flags;
struct property *prop;
......@@ -78,10 +84,7 @@ struct symbol {
#define for_all_symbols(i, sym) for (i = 0; i < 257; i++) for (sym = symbol_hash[i]; sym; sym = sym->next) if (sym->type != S_OTHER)
#define SYMBOL_YES 0x0001
#define SYMBOL_MOD 0x0002
#define SYMBOL_NO 0x0004
#define SYMBOL_CONST 0x0007
#define SYMBOL_CONST 0x0001
#define SYMBOL_CHECK 0x0008
#define SYMBOL_CHOICE 0x0010
#define SYMBOL_CHOICEVAL 0x0020
......@@ -90,10 +93,14 @@ struct symbol {
#define SYMBOL_OPTIONAL 0x0100
#define SYMBOL_WRITE 0x0200
#define SYMBOL_CHANGED 0x0400
#define SYMBOL_NEW 0x0800
#define SYMBOL_AUTO 0x1000
#define SYMBOL_CHECKED 0x2000
#define SYMBOL_WARNED 0x8000
#define SYMBOL_DEF 0x10000
#define SYMBOL_DEF_USER 0x10000
#define SYMBOL_DEF_AUTO 0x20000
#define SYMBOL_DEF3 0x40000
#define SYMBOL_DEF4 0x80000
#define SYMBOL_MAXLENGTH 256
#define SYMBOL_HASHSIZE 257
......@@ -149,6 +156,7 @@ struct file *lookup_file(const char *name);
extern struct symbol symbol_yes, symbol_no, symbol_mod;
extern struct symbol *modules_sym;
extern struct symbol *sym_defconfig_list;
extern int cdebug;
struct expr *expr_alloc_symbol(struct symbol *sym);
struct expr *expr_alloc_one(enum expr_type type, struct expr *ce);
......
......@@ -114,12 +114,6 @@ const char *dbg_print_flags(int val)
bzero(buf, 256);
if (val & SYMBOL_YES)
strcat(buf, "yes/");
if (val & SYMBOL_MOD)
strcat(buf, "mod/");
if (val & SYMBOL_NO)
strcat(buf, "no/");
if (val & SYMBOL_CONST)
strcat(buf, "const/");
if (val & SYMBOL_CHECK)
......@@ -138,8 +132,6 @@ const char *dbg_print_flags(int val)
strcat(buf, "write/");
if (val & SYMBOL_CHANGED)
strcat(buf, "changed/");
if (val & SYMBOL_NEW)
strcat(buf, "new/");
if (val & SYMBOL_AUTO)
strcat(buf, "auto/");
......@@ -1192,9 +1184,7 @@ static gchar **fill_row(struct menu *menu)
row[COL_OPTION] =
g_strdup_printf("%s %s", menu_get_prompt(menu),
sym ? (sym->
flags & SYMBOL_NEW ? "(NEW)" : "") :
"");
sym && sym_has_value(sym) ? "(NEW)" : "");
if (show_all && !menu_is_visible(menu))
row[COL_COLOR] = g_strdup("DarkGray");
......
......@@ -8,7 +8,7 @@
#define FLEX_SCANNER
#define YY_FLEX_MAJOR_VERSION 2
#define YY_FLEX_MINOR_VERSION 5
#define YY_FLEX_SUBMINOR_VERSION 31
#define YY_FLEX_SUBMINOR_VERSION 33
#if YY_FLEX_SUBMINOR_VERSION > 0
#define FLEX_BETA
#endif
......@@ -30,7 +30,15 @@
/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
#if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
#if __STDC_VERSION__ >= 199901L
/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
* if you want the limit (max/min) macros for int types.
*/
#ifndef __STDC_LIMIT_MACROS
#define __STDC_LIMIT_MACROS 1
#endif
#include <inttypes.h>
typedef int8_t flex_int8_t;
typedef uint8_t flex_uint8_t;
......@@ -134,6 +142,10 @@ typedef unsigned int flex_uint32_t;
#define YY_BUF_SIZE 16384
#endif
/* The state buf must be large enough to hold one state per character in the main buffer.
*/
#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
#ifndef YY_TYPEDEF_YY_BUFFER_STATE
#define YY_TYPEDEF_YY_BUFFER_STATE
typedef struct yy_buffer_state *YY_BUFFER_STATE;
......@@ -267,7 +279,7 @@ int zconfleng;
/* Points to current character in buffer. */
static char *yy_c_buf_p = (char *) 0;
static int yy_init = 1; /* whether we need to initialize */
static int yy_init = 0; /* whether we need to initialize */
static int yy_start = 0; /* start state number */
/* Flag which is used to allow zconfwrap()'s to do buffer switches
......@@ -820,6 +832,8 @@ void alloc_string(const char *str, int size)
#define YY_EXTRA_TYPE void *
#endif
static int yy_init_globals (void );
/* Macros after this point can all be overridden by user definitions in
* section 1.
*/
......@@ -942,9 +956,9 @@ YY_DECL
int str = 0;
int ts, i;
if ( (yy_init) )
if ( !(yy_init) )
{
(yy_init) = 0;
(yy_init) = 1;
#ifdef YY_USER_INIT
YY_USER_INIT;
......@@ -1452,7 +1466,7 @@ static int yy_get_next_buffer (void)
else
{
size_t num_to_read =
int num_to_read =
YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
while ( num_to_read <= 0 )
......@@ -1969,16 +1983,16 @@ YY_BUFFER_STATE zconf_scan_buffer (char * base, yy_size_t size )
/** Setup the input buffer state to scan a string. The next call to zconflex() will
* scan from a @e copy of @a str.
* @param yy_str a NUL-terminated string to scan
* @param yystr a NUL-terminated string to scan
*
* @return the newly allocated buffer state object.
* @note If you want to scan bytes that may contain NUL values, then use
* zconf_scan_bytes() instead.
*/
YY_BUFFER_STATE zconf_scan_string (yyconst char * yy_str )
YY_BUFFER_STATE zconf_scan_string (yyconst char * yystr )
{
return zconf_scan_bytes(yy_str,strlen(yy_str) );
return zconf_scan_bytes(yystr,strlen(yystr) );
}
/** Setup the input buffer state to scan the given bytes. The next call to zconflex() will
......@@ -1988,7 +2002,7 @@ YY_BUFFER_STATE zconf_scan_string (yyconst char * yy_str )
*
* @return the newly allocated buffer state object.
*/
YY_BUFFER_STATE zconf_scan_bytes (yyconst char * bytes, int len )
YY_BUFFER_STATE zconf_scan_bytes (yyconst char * yybytes, int _yybytes_len )
{
YY_BUFFER_STATE b;
char *buf;
......@@ -1996,15 +2010,15 @@ YY_BUFFER_STATE zconf_scan_bytes (yyconst char * bytes, int len )
int i;
/* Get memory for full buffer, including space for trailing EOB's. */
n = len + 2;
n = _yybytes_len + 2;
buf = (char *) zconfalloc(n );
if ( ! buf )
YY_FATAL_ERROR( "out of dynamic memory in zconf_scan_bytes()" );
for ( i = 0; i < len; ++i )
buf[i] = bytes[i];
for ( i = 0; i < _yybytes_len; ++i )
buf[i] = yybytes[i];
buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
b = zconf_scan_buffer(buf,n );
if ( ! b )
......@@ -2125,6 +2139,34 @@ void zconfset_debug (int bdebug )
zconf_flex_debug = bdebug ;
}
static int yy_init_globals (void)
{
/* Initialization is the same as for the non-reentrant scanner.
* This function is called from zconflex_destroy(), so don't allocate here.
*/
(yy_buffer_stack) = 0;
(yy_buffer_stack_top) = 0;
(yy_buffer_stack_max) = 0;
(yy_c_buf_p) = (char *) 0;
(yy_init) = 0;
(yy_start) = 0;
/* Defined in main.c */
#ifdef YY_STDINIT
zconfin = stdin;
zconfout = stdout;
#else
zconfin = (FILE *) 0;
zconfout = (FILE *) 0;
#endif
/* For future reference: Set errno on error, since we are called by
* zconflex_init()
*/
return 0;
}
/* zconflex_destroy is for both reentrant and non-reentrant scanners. */
int zconflex_destroy (void)
{
......@@ -2140,6 +2182,10 @@ int zconflex_destroy (void)
zconffree((yy_buffer_stack) );
(yy_buffer_stack) = NULL;
/* Reset the globals. This is important in a non-reentrant scanner so the next time
* zconflex() is called, initialization will occur. */
yy_init_globals( );
return 0;
}
......@@ -2151,7 +2197,7 @@ int zconflex_destroy (void)
static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
{
register int i;
for ( i = 0; i < n; ++i )
for ( i = 0; i < n; ++i )
s1[i] = s2[i];
}
#endif
......@@ -2160,7 +2206,7 @@ static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
static int yy_flex_strlen (yyconst char * s )
{
register int n;
for ( n = 0; s[n]; ++n )
for ( n = 0; s[n]; ++n )
;
return n;
......@@ -2191,19 +2237,6 @@ void zconffree (void * ptr )
#define YYTABLES_NAME "yytables"
#undef YY_NEW_FILE
#undef YY_FLUSH_BUFFER
#undef yy_set_bol
#undef yy_new_buffer
#undef yy_set_interactive
#undef yytext_ptr
#undef YY_DO_BEFORE_ACTION
#ifdef YY_DECL_IS_OURS
#undef YY_DECL_IS_OURS
#undef YY_DECL
#endif
void zconf_starthelp(void)
{
new_string();
......
......@@ -40,6 +40,10 @@ extern "C" {
#define TF_COMMAND 0x0001
#define TF_PARAM 0x0002
#define TF_OPTION 0x0004
#define T_OPT_MODULES 1
#define T_OPT_DEFCONFIG_LIST 2
struct kconf_id {
int name;
......@@ -60,8 +64,6 @@ int zconf_lineno(void);
char *zconf_curname(void);
/* confdata.c */
extern const char conf_def_filename[];
char *conf_get_default_confname(void);
/* kconfig_load.c */
......@@ -78,6 +80,7 @@ struct property *menu_add_prop(enum prop_type type, char *prompt, struct expr *e
struct property *menu_add_prompt(enum prop_type type, char *prompt, struct expr *dep);
void menu_add_expr(enum prop_type type, struct expr *expr, struct expr *dep);
void menu_add_symbol(enum prop_type type, struct symbol *sym, struct expr *dep);
void menu_add_option(int token, char *arg);
void menu_finalize(struct menu *parent);
void menu_set_type(int type);
......@@ -99,6 +102,7 @@ const char *str_get(struct gstr *gs);
/* symbol.c */
void sym_init(void);
void sym_clear_all_valid(void);
void sym_set_all_changed(void);
void sym_set_changed(struct symbol *sym);
struct symbol *sym_check_deps(struct symbol *sym);
struct property *prop_alloc(enum prop_type type, struct symbol *sym);
......@@ -137,7 +141,7 @@ static inline bool sym_is_optional(struct symbol *sym)
static inline bool sym_has_value(struct symbol *sym)
{
return sym->flags & SYMBOL_NEW ? false : true;
return sym->flags & SYMBOL_DEF_USER ? true : false;
}
#ifdef __cplusplus
......
......@@ -2,8 +2,9 @@
/* confdata.c */
P(conf_parse,void,(const char *name));
P(conf_read,int,(const char *name));
P(conf_read_simple,int,(const char *name));
P(conf_read_simple,int,(const char *name, int));
P(conf_write,int,(const char *name));
P(conf_write_autoconf,int,(void));
/* menu.c */
P(rootmenu,struct menu,);
......@@ -38,4 +39,4 @@ P(prop_get_type_name,const char *,(enum prop_type type));
/* expr.c */
P(expr_compare_type,int,(enum expr_type t1, enum expr_type t2));
P(expr_print,void,(struct expr *e, void (*fn)(void *, const char *), void *data, int prevtoken));
P(expr_print,void,(struct expr *e, void (*fn)(void *, struct symbol *, const char *), void *data, int prevtoken));
......@@ -114,7 +114,7 @@ void menu_set_type(int type)
sym->type = type;
return;
}
menu_warn(current_entry, "type of '%s' redefined from '%s' to '%s'\n",
menu_warn(current_entry, "type of '%s' redefined from '%s' to '%s'",
sym->name ? sym->name : "<choice>",
sym_type_name(sym->type), sym_type_name(type));
}
......@@ -124,15 +124,20 @@ struct property *menu_add_prop(enum prop_type type, char *prompt, struct expr *e
struct property *prop = prop_alloc(type, current_entry->sym);
prop->menu = current_entry;
prop->text = prompt;
prop->expr = expr;
prop->visible.expr = menu_check_dep(dep);
if (prompt) {
if (isspace(*prompt)) {
prop_warn(prop, "leading whitespace ignored");
while (isspace(*prompt))
prompt++;
}
if (current_entry->prompt)
menu_warn(current_entry, "prompt redefined\n");
prop_warn(prop, "prompt redefined");
current_entry->prompt = prop;
}
prop->text = prompt;
return prop;
}
......@@ -152,6 +157,24 @@ void menu_add_symbol(enum prop_type type, struct symbol *sym, struct expr *dep)
menu_add_prop(type, NULL, expr_alloc_symbol(sym), dep);
}
void menu_add_option(int token, char *arg)
{
struct property *prop;
switch (token) {
case T_OPT_MODULES:
prop = prop_alloc(P_DEFAULT, modules_sym);
prop->expr = expr_alloc_symbol(current_entry->sym);
break;
case T_OPT_DEFCONFIG_LIST:
if (!sym_defconfig_list)
sym_defconfig_list = current_entry->sym;
else if (sym_defconfig_list != current_entry->sym)
zconf_error("trying to redefine defconfig symbol");
break;
}
}
static int menu_range_valid_sym(struct symbol *sym, struct symbol *sym2)
{
return sym2->type == S_INT || sym2->type == S_HEX ||
......@@ -325,11 +348,10 @@ void menu_finalize(struct menu *parent)
if (sym && !(sym->flags & SYMBOL_WARNED)) {
if (sym->type == S_UNKNOWN)
menu_warn(parent, "config symbol defined "
"without type\n");
menu_warn(parent, "config symbol defined without type");
if (sym_is_choice(sym) && !parent->prompt)
menu_warn(parent, "choice must have a prompt\n");
menu_warn(parent, "choice must have a prompt");
/* Check properties connected to this symbol */
sym_check_prop(sym);
......
This diff is collapsed.
......@@ -7,9 +7,25 @@
#if QT_VERSION >= 300
#include <qsettings.h>
#else
class QSettings { };
class QSettings {
public:
void beginGroup(const QString& group) { }
void endGroup(void) { }
bool readBoolEntry(const QString& key, bool def = FALSE, bool* ok = 0) const
{ if (ok) *ok = FALSE; return def; }
int readNumEntry(const QString& key, int def = 0, bool* ok = 0) const
{ if (ok) *ok = FALSE; return def; }
QString readEntry(const QString& key, const QString& def = QString::null, bool* ok = 0) const
{ if (ok) *ok = FALSE; return def; }
QStringList readListEntry(const QString& key, bool* ok = 0) const
{ if (ok) *ok = FALSE; return QStringList(); }
template <class t>
bool writeEntry(const QString& key, t value)
{ return TRUE; }
};
#endif
class ConfigView;
class ConfigList;
class ConfigItem;
class ConfigLineEdit;
......@@ -18,64 +34,38 @@ class ConfigMainWindow;
class ConfigSettings : public QSettings {
public:
ConfigSettings();
#if QT_VERSION >= 300
void readListSettings();
QValueList<int> readSizes(const QString& key, bool *ok);
bool writeSizes(const QString& key, const QValueList<int>& value);
#endif
bool showAll;
bool showName;
bool showRange;
bool showData;
};
class ConfigView : public QVBox {
Q_OBJECT
typedef class QVBox Parent;
public:
ConfigView(QWidget* parent, ConfigMainWindow* cview, ConfigSettings* configSettings);
~ConfigView(void);
static void updateList(ConfigItem* item);
static void updateListAll(void);
public:
ConfigList* list;
ConfigLineEdit* lineEdit;
static ConfigView* viewList;
ConfigView* nextView;
};
enum colIdx {
promptColIdx, nameColIdx, noColIdx, modColIdx, yesColIdx, dataColIdx, colNr
};
enum listMode {
singleMode, menuMode, symbolMode, fullMode
singleMode, menuMode, symbolMode, fullMode, listMode
};
class ConfigList : public QListView {
Q_OBJECT
typedef class QListView Parent;
public:
ConfigList(ConfigView* p, ConfigMainWindow* cview, ConfigSettings *configSettings);
ConfigList(ConfigView* p, const char *name = 0);
void reinit(void);
ConfigView* parent(void) const
{
return (ConfigView*)Parent::parent();
}
ConfigItem* findConfigItem(struct menu *);
protected:
ConfigMainWindow* cview;
void keyPressEvent(QKeyEvent *e);
void contentsMousePressEvent(QMouseEvent *e);
void contentsMouseReleaseEvent(QMouseEvent *e);
void contentsMouseMoveEvent(QMouseEvent *e);
void contentsMouseDoubleClickEvent(QMouseEvent *e);
void focusInEvent(QFocusEvent *e);
void contextMenuEvent(QContextMenuEvent *e);
public slots:
void setRootMenu(struct menu *menu);
......@@ -83,10 +73,12 @@ public slots:
void setValue(ConfigItem* item, tristate val);
void changeValue(ConfigItem* item);
void updateSelection(void);
void saveSettings(void);
signals:
void menuChanged(struct menu *menu);
void menuSelected(struct menu *menu);
void parentSelected(void);
void gotFocus(void);
void gotFocus(struct menu *);
public:
void updateListAll(void)
......@@ -137,6 +129,7 @@ public slots:
struct menu *rootEntry;
QColorGroup disabledColorGroup;
QColorGroup inactivedColorGroup;
QPopupMenu* headerPopup;
private:
int colMap[colNr];
......@@ -208,9 +201,7 @@ class ConfigLineEdit : public QLineEdit {
Q_OBJECT
typedef class QLineEdit Parent;
public:
ConfigLineEdit(ConfigView* parent)
: Parent(parent)
{ }
ConfigLineEdit(ConfigView* parent);
ConfigView* parent(void) const
{
return (ConfigView*)Parent::parent();
......@@ -222,26 +213,104 @@ class ConfigLineEdit : public QLineEdit {
ConfigItem *item;
};
class ConfigView : public QVBox {
Q_OBJECT
typedef class QVBox Parent;
public:
ConfigView(QWidget* parent, const char *name = 0);
~ConfigView(void);
static void updateList(ConfigItem* item);
static void updateListAll(void);
bool showAll(void) const { return list->showAll; }
bool showName(void) const { return list->showName; }
bool showRange(void) const { return list->showRange; }
bool showData(void) const { return list->showData; }
public slots:
void setShowAll(bool);
void setShowName(bool);
void setShowRange(bool);
void setShowData(bool);
signals:
void showAllChanged(bool);
void showNameChanged(bool);
void showRangeChanged(bool);
void showDataChanged(bool);
public:
ConfigList* list;
ConfigLineEdit* lineEdit;
static ConfigView* viewList;
ConfigView* nextView;
};
class ConfigInfoView : public QTextBrowser {
Q_OBJECT
typedef class QTextBrowser Parent;
public:
ConfigInfoView(QWidget* parent, const char *name = 0);
bool showDebug(void) const { return _showDebug; }
public slots:
void setInfo(struct menu *menu);
void saveSettings(void);
void setSource(const QString& name);
void setShowDebug(bool);
signals:
void showDebugChanged(bool);
void menuSelected(struct menu *);
protected:
void symbolInfo(void);
void menuInfo(void);
QString debug_info(struct symbol *sym);
static QString print_filter(const QString &str);
static void expr_print_help(void *data, struct symbol *sym, const char *str);
QPopupMenu* createPopupMenu(const QPoint& pos);
void contentsContextMenuEvent(QContextMenuEvent *e);
struct symbol *sym;
struct menu *menu;
bool _showDebug;
};
class ConfigSearchWindow : public QDialog {
Q_OBJECT
typedef class QDialog Parent;
public:
ConfigSearchWindow(QWidget* parent, const char *name = 0);
public slots:
void saveSettings(void);
void search(void);
protected:
QLineEdit* editField;
QPushButton* searchButton;
QSplitter* split;
ConfigView* list;
ConfigInfoView* info;
struct symbol **result;
};
class ConfigMainWindow : public QMainWindow {
Q_OBJECT
public:
ConfigMainWindow(void);
public slots:
void setHelp(QListViewItem* item);
void changeMenu(struct menu *);
void setMenuLink(struct menu *);
void listFocusChanged(void);
void goBack(void);
void loadConfig(void);
void saveConfig(void);
void saveConfigAs(void);
void searchConfig(void);
void showSingleView(void);
void showSplitView(void);
void showFullView(void);
void setShowAll(bool);
void setShowDebug(bool);
void setShowRange(bool);
void setShowName(bool);
void setShowData(bool);
void showIntro(void);
void showAbout(void);
void saveSettings(void);
......@@ -249,15 +318,14 @@ public slots:
protected:
void closeEvent(QCloseEvent *e);
ConfigSearchWindow *searchWindow;
ConfigView *menuView;
ConfigList *menuList;
ConfigView *configView;
ConfigList *configList;
QTextView *helpText;
ConfigInfoView *helpText;
QToolBar *toolBar;
QAction *backAction;
QSplitter* split1;
QSplitter* split2;
bool showDebug;
};
......@@ -15,15 +15,15 @@
struct symbol symbol_yes = {
.name = "y",
.curr = { "y", yes },
.flags = SYMBOL_YES|SYMBOL_VALID,
.flags = SYMBOL_CONST|SYMBOL_VALID,
}, symbol_mod = {
.name = "m",
.curr = { "m", mod },
.flags = SYMBOL_MOD|SYMBOL_VALID,
.flags = SYMBOL_CONST|SYMBOL_VALID,
}, symbol_no = {
.name = "n",
.curr = { "n", no },
.flags = SYMBOL_NO|SYMBOL_VALID,
.flags = SYMBOL_CONST|SYMBOL_VALID,
}, symbol_empty = {
.name = "",
.curr = { "", no },
......@@ -31,6 +31,7 @@ struct symbol symbol_yes = {
};
int sym_change_count;
struct symbol *sym_defconfig_list;
struct symbol *modules_sym;
tristate modules_val;
......@@ -227,7 +228,7 @@ static struct symbol *sym_calc_choice(struct symbol *sym)
struct expr *e;
/* is the user choice visible? */
def_sym = sym->user.val;
def_sym = sym->def[S_DEF_USER].val;
if (def_sym) {
sym_calc_visibility(def_sym);
if (def_sym->visible != no)
......@@ -306,7 +307,7 @@ void sym_calc_value(struct symbol *sym)
} else if (E_OR(sym->visible, sym->rev_dep.tri) != no) {
sym->flags |= SYMBOL_WRITE;
if (sym_has_value(sym))
newval.tri = sym->user.tri;
newval.tri = sym->def[S_DEF_USER].tri;
else if (!sym_is_choice(sym)) {
prop = sym_get_default_prop(sym);
if (prop)
......@@ -329,7 +330,7 @@ void sym_calc_value(struct symbol *sym)
if (sym->visible != no) {
sym->flags |= SYMBOL_WRITE;
if (sym_has_value(sym)) {
newval.val = sym->user.val;
newval.val = sym->def[S_DEF_USER].val;
break;
}
}
......@@ -352,10 +353,13 @@ void sym_calc_value(struct symbol *sym)
sym->curr.val = sym_calc_choice(sym);
sym_validate_range(sym);
if (memcmp(&oldval, &sym->curr, sizeof(oldval)))
if (memcmp(&oldval, &sym->curr, sizeof(oldval))) {
sym_set_changed(sym);
if (modules_sym == sym)
modules_val = modules_sym->curr.tri;
if (modules_sym == sym) {
sym_set_all_changed();
modules_val = modules_sym->curr.tri;
}
}
if (sym_is_choice(sym)) {
int flags = sym->flags & (SYMBOL_CHANGED | SYMBOL_WRITE);
......@@ -426,8 +430,8 @@ bool sym_set_tristate_value(struct symbol *sym, tristate val)
if (oldval != val && !sym_tristate_within_range(sym, val))
return false;
if (sym->flags & SYMBOL_NEW) {
sym->flags &= ~SYMBOL_NEW;
if (!(sym->flags & SYMBOL_DEF_USER)) {
sym->flags |= SYMBOL_DEF_USER;
sym_set_changed(sym);
}
/*
......@@ -439,21 +443,18 @@ bool sym_set_tristate_value(struct symbol *sym, tristate val)
struct property *prop;
struct expr *e;
cs->user.val = sym;
cs->flags &= ~SYMBOL_NEW;
cs->def[S_DEF_USER].val = sym;
cs->flags |= SYMBOL_DEF_USER;
prop = sym_get_choice_prop(cs);
for (e = prop->expr; e; e = e->left.expr) {
if (e->right.sym->visible != no)
e->right.sym->flags &= ~SYMBOL_NEW;
e->right.sym->flags |= SYMBOL_DEF_USER;
}
}
sym->user.tri = val;
if (oldval != val) {
sym->def[S_DEF_USER].tri = val;
if (oldval != val)
sym_clear_all_valid();
if (sym == modules_sym)
sym_set_all_changed();
}
return true;
}
......@@ -591,20 +592,20 @@ bool sym_set_string_value(struct symbol *sym, const char *newval)
if (!sym_string_within_range(sym, newval))
return false;
if (sym->flags & SYMBOL_NEW) {
sym->flags &= ~SYMBOL_NEW;
if (!(sym->flags & SYMBOL_DEF_USER)) {
sym->flags |= SYMBOL_DEF_USER;
sym_set_changed(sym);
}
oldval = sym->user.val;
oldval = sym->def[S_DEF_USER].val;
size = strlen(newval) + 1;
if (sym->type == S_HEX && (newval[0] != '0' || (newval[1] != 'x' && newval[1] != 'X'))) {
size += 2;
sym->user.val = val = malloc(size);
sym->def[S_DEF_USER].val = val = malloc(size);
*val++ = '0';
*val++ = 'x';
} else if (!oldval || strcmp(oldval, newval))
sym->user.val = val = malloc(size);
sym->def[S_DEF_USER].val = val = malloc(size);
else
return true;
......@@ -679,7 +680,6 @@ struct symbol *sym_lookup(const char *name, int isconst)
memset(symbol, 0, sizeof(*symbol));
symbol->name = new_name;
symbol->type = S_UNKNOWN;
symbol->flags = SYMBOL_NEW;
if (isconst)
symbol->flags |= SYMBOL_CONST;
......
......@@ -44,7 +44,9 @@ int file_write_dep(const char *name)
else
fprintf(out, "\t%s\n", file->name);
}
fprintf(out, "\n.config include/linux/autoconf.h: $(deps_config)\n\n$(deps_config):\n");
fprintf(out, "\ninclude/config/auto.conf: \\\n"
"\t$(deps_config)\n\n"
"$(deps_config): ;\n");
fclose(out);
rename("..config.tmp", name);
return 0;
......
......@@ -39,5 +39,8 @@ string, T_TYPE, TF_COMMAND, S_STRING
select, T_SELECT, TF_COMMAND
enable, T_SELECT, TF_COMMAND
range, T_RANGE, TF_COMMAND
option, T_OPTION, TF_COMMAND
on, T_ON, TF_PARAM
modules, T_OPT_MODULES, TF_OPTION
defconfig_list, T_OPT_DEFCONFIG_LIST,TF_OPTION
%%
This diff is collapsed.
This diff is collapsed.
......@@ -71,6 +71,7 @@ static struct menu *current_menu, *current_entry;
%token <id>T_DEFAULT
%token <id>T_SELECT
%token <id>T_RANGE
%token <id>T_OPTION
%token <id>T_ON
%token <string> T_WORD
%token <string> T_WORD_QUOTE
......@@ -91,6 +92,7 @@ static struct menu *current_menu, *current_entry;
%type <id> end
%type <id> option_name
%type <menu> if_entry menu_entry choice_entry
%type <string> symbol_option_arg
%destructor {
fprintf(stderr, "%s:%d: missing end statement for this entry\n",
......@@ -173,6 +175,7 @@ menuconfig_stmt: menuconfig_entry_start config_option_list
config_option_list:
/* empty */
| config_option_list config_option
| config_option_list symbol_option
| config_option_list depends
| config_option_list help
| config_option_list option_error
......@@ -215,6 +218,26 @@ config_option: T_RANGE symbol symbol if_expr T_EOL
printd(DEBUG_PARSE, "%s:%d:range\n", zconf_curname(), zconf_lineno());
};
symbol_option: T_OPTION symbol_option_list T_EOL
;
symbol_option_list:
/* empty */
| symbol_option_list T_WORD symbol_option_arg
{
struct kconf_id *id = kconf_id_lookup($2, strlen($2));
if (id && id->flags & TF_OPTION)
menu_add_option(id->token, $3);
else
zconfprint("warning: ignoring unknown option %s", $2);
free($2);
};
symbol_option_arg:
/* empty */ { $$ = NULL; }
| T_EQUAL prompt { $$ = $2; }
;
/* choice entry */
choice: T_CHOICE T_EOL
......@@ -458,7 +481,9 @@ void conf_parse(const char *name)
sym_init();
menu_init();
modules_sym = sym_lookup("MODULES", 0);
modules_sym = sym_lookup(NULL, 0);
modules_sym->type = S_BOOLEAN;
modules_sym->flags |= SYMBOL_AUTO;
rootmenu.prompt = menu_add_prompt(P_MENU, "Linux Kernel Configuration", NULL);
#if YYDEBUG
......@@ -468,6 +493,12 @@ void conf_parse(const char *name)
zconfparse();
if (zconfnerrs)
exit(1);
if (!modules_sym->prop) {
struct property *prop;
prop = prop_alloc(P_DEFAULT, modules_sym);
prop->expr = expr_alloc_symbol(sym_lookup("MODULES", 0));
}
menu_finalize(&rootmenu);
for_all_symbols(i, sym) {
sym_check_deps(sym);
......
......@@ -28,7 +28,7 @@ main(int argc, char **argv)
printf("#define KERNEL_ELFCLASS ELFCLASS64\n");
break;
default:
abort();
exit(1);
}
switch (ei[EI_DATA]) {
case ELFDATA2LSB:
......@@ -38,7 +38,7 @@ main(int argc, char **argv)
printf("#define KERNEL_ELFDATA ELFDATA2MSB\n");
break;
default:
abort();
exit(1);
}
if (sizeof(unsigned long) == 4) {
......@@ -53,7 +53,7 @@ main(int argc, char **argv)
else if (memcmp(endian_test.c, "\x02\x01", 2) == 0)
printf("#define HOST_ELFDATA ELFDATA2LSB\n");
else
abort();
exit(1);
if ((strcmp(argv[1], "v850") == 0) || (strcmp(argv[1], "h8300") == 0))
printf("#define MODULE_SYMBOL_PREFIX \"_\"\n");
......
This diff is collapsed.
......@@ -100,6 +100,7 @@ buf_write(struct buffer *buf, const char *s, int len);
struct module {
struct module *next;
const char *name;
int gpl_compatible;
struct symbol *unres;
int seen;
int skip;
......@@ -115,6 +116,9 @@ struct elf_info {
Elf_Shdr *sechdrs;
Elf_Sym *symtab_start;
Elf_Sym *symtab_stop;
Elf_Section export_sec;
Elf_Section export_gpl_sec;
Elf_Section export_gpl_future_sec;
const char *strtab;
char *modinfo;
unsigned int modinfo_len;
......
......@@ -73,8 +73,13 @@ echo "%ifarch ia64"
echo 'cp $KBUILD_IMAGE $RPM_BUILD_ROOT'"/boot/efi/vmlinuz-$KERNELRELEASE"
echo 'ln -s '"efi/vmlinuz-$KERNELRELEASE" '$RPM_BUILD_ROOT'"/boot/"
echo "%else"
echo "%ifarch ppc64"
echo "cp vmlinux arch/powerpc/boot"
echo "cp arch/powerpc/boot/"'$KBUILD_IMAGE $RPM_BUILD_ROOT'"/boot/vmlinuz-$KERNELRELEASE"
echo "%else"
echo 'cp $KBUILD_IMAGE $RPM_BUILD_ROOT'"/boot/vmlinuz-$KERNELRELEASE"
echo "%endif"
echo "%endif"
echo 'cp System.map $RPM_BUILD_ROOT'"/boot/System.map-$KERNELRELEASE"
......
......@@ -11,12 +11,12 @@ cd "${1:-.}" || usage
# Check for git and a git repo.
if head=`git rev-parse --verify HEAD 2>/dev/null`; then
# Do we have an untagged version?
if [ "`git name-rev --tags HEAD`" = "HEAD undefined" ]; then
if git name-rev --tags HEAD | grep -E '^HEAD[[:space:]]+(.*~[0-9]*|undefined)$' > /dev/null; then
printf '%s%s' -g `echo "$head" | cut -c1-8`
fi
# Are there uncommitted changes?
if git diff-files | read dummy; then
if git diff-index HEAD | read dummy; then
printf '%s' -dirty
fi
fi
......@@ -839,6 +839,6 @@ config SOUND_SH_DAC_AUDIO
depends on SOUND_PRIME && CPU_SH3
config SOUND_SH_DAC_AUDIO_CHANNEL
int " DAC channel"
int "DAC channel"
default "1"
depends on SOUND_SH_DAC_AUDIO
......@@ -21,8 +21,7 @@ ramfs-input := $(if $(filter-out "",$(CONFIG_INITRAMFS_SOURCE)), \
$(CONFIG_INITRAMFS_SOURCE),-d)
ramfs-args := \
$(if $(CONFIG_INITRAMFS_ROOT_UID), -u $(CONFIG_INITRAMFS_ROOT_UID)) \
$(if $(CONFIG_INITRAMFS_ROOT_GID), -g $(CONFIG_INITRAMFS_ROOT_GID)) \
$(ramfs-input)
$(if $(CONFIG_INITRAMFS_ROOT_GID), -g $(CONFIG_INITRAMFS_ROOT_GID))
# .initramfs_data.cpio.gz.d is used to identify all files included
# in initramfs and to detect if any files are added/removed.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment