mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-28 17:41:50 +00:00
kconfig: Add LSMOD=file to override the lsmod for localmodconfig
Doing the following: make LSMOD=file localmodconfig Will make the streamline-config code use the given file instead of lsmod. If the file is an executable, it will execute it, otherwise it will read it as text. make LSMOD=/my/local/path/lsmod localmodconfig The above will execute the lsmod in /my/local/path instead of the lsmods that may be located elsewhere. make LSMOD=embedded_board_lsmod localmodconfig The above will read the "embedded_board_lsmod" as a text file. This is useful if you are doing a cross compile and need to run the config against modules that exist on an embedded device. Note, if the LSMOD= file does is not a path, it will add the path to the object directory. That is, the above example will look for "embedded_board_lsmod" in the directory that the binary will be built in (the O=dir directory). Signed-off-by: Steven Rostedt <rostedt@goodmis.org> On branch config/linus
This commit is contained in:
parent
88f66ea98d
commit
615f0833aa
2 changed files with 38 additions and 13 deletions
|
@ -30,9 +30,18 @@ silentoldconfig: $(obj)/conf
|
||||||
$(Q)mkdir -p include/generated
|
$(Q)mkdir -p include/generated
|
||||||
$< -s $(Kconfig)
|
$< -s $(Kconfig)
|
||||||
|
|
||||||
|
# if no path is given, then use src directory to find file
|
||||||
|
ifdef LSMOD
|
||||||
|
LSMOD_F = $(shell if [ `basename $(LSMOD)` == $(LSMOD) ]; then \
|
||||||
|
echo $(objtree)/$(LSMOD); \
|
||||||
|
else \
|
||||||
|
echo $(LSMOD); \
|
||||||
|
fi)
|
||||||
|
endif
|
||||||
|
|
||||||
localmodconfig: $(obj)/streamline_config.pl $(obj)/conf
|
localmodconfig: $(obj)/streamline_config.pl $(obj)/conf
|
||||||
$(Q)mkdir -p include/generated
|
$(Q)mkdir -p include/generated
|
||||||
$(Q)perl $< $(srctree) $(Kconfig) > .tmp.config
|
$(Q)perl $< $(srctree) $(Kconfig) $(LSMOD_F) > .tmp.config
|
||||||
$(Q)if [ -f .config ]; then \
|
$(Q)if [ -f .config ]; then \
|
||||||
cmp -s .tmp.config .config || \
|
cmp -s .tmp.config .config || \
|
||||||
(mv -f .config .config.old.1; \
|
(mv -f .config .config.old.1; \
|
||||||
|
@ -47,7 +56,7 @@ localmodconfig: $(obj)/streamline_config.pl $(obj)/conf
|
||||||
|
|
||||||
localyesconfig: $(obj)/streamline_config.pl $(obj)/conf
|
localyesconfig: $(obj)/streamline_config.pl $(obj)/conf
|
||||||
$(Q)mkdir -p include/generated
|
$(Q)mkdir -p include/generated
|
||||||
$(Q)perl $< $(srctree) $(Kconfig) > .tmp.config
|
$(Q)perl $< $(srctree) $(Kconfig) $(LSMOD_F) > .tmp.config
|
||||||
$(Q)sed -i s/=m/=y/ .tmp.config
|
$(Q)sed -i s/=m/=y/ .tmp.config
|
||||||
$(Q)if [ -f .config ]; then \
|
$(Q)if [ -f .config ]; then \
|
||||||
cmp -s .tmp.config .config || \
|
cmp -s .tmp.config .config || \
|
||||||
|
|
|
@ -113,6 +113,7 @@ find_config;
|
||||||
# Get the build source and top level Kconfig file (passed in)
|
# Get the build source and top level Kconfig file (passed in)
|
||||||
my $ksource = $ARGV[0];
|
my $ksource = $ARGV[0];
|
||||||
my $kconfig = $ARGV[1];
|
my $kconfig = $ARGV[1];
|
||||||
|
my $lsmod_file = $ARGV[2];
|
||||||
|
|
||||||
my @makefiles = `find $ksource -name Makefile`;
|
my @makefiles = `find $ksource -name Makefile`;
|
||||||
my %depends;
|
my %depends;
|
||||||
|
@ -263,6 +264,19 @@ foreach my $makefile (@makefiles) {
|
||||||
|
|
||||||
my %modules;
|
my %modules;
|
||||||
|
|
||||||
|
if (defined($lsmod_file)) {
|
||||||
|
if ( ! -f $lsmod_file) {
|
||||||
|
die "$lsmod_file not found";
|
||||||
|
}
|
||||||
|
if ( -x $lsmod_file) {
|
||||||
|
# the file is executable, run it
|
||||||
|
open(LIN, "$lsmod_file|");
|
||||||
|
} else {
|
||||||
|
# Just read the contents
|
||||||
|
open(LIN, "$lsmod_file");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
|
||||||
# see what modules are loaded on this system
|
# see what modules are loaded on this system
|
||||||
my $lsmod;
|
my $lsmod;
|
||||||
|
|
||||||
|
@ -278,6 +292,8 @@ if (!defined($lsmod)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
open(LIN,"$lsmod|") || die "Can not call lsmod with $lsmod";
|
open(LIN,"$lsmod|") || die "Can not call lsmod with $lsmod";
|
||||||
|
}
|
||||||
|
|
||||||
while (<LIN>) {
|
while (<LIN>) {
|
||||||
next if (/^Module/); # Skip the first line.
|
next if (/^Module/); # Skip the first line.
|
||||||
if (/^(\S+)/) {
|
if (/^(\S+)/) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue