lkml.org 
[lkml]   [1999]   [Jul]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: script for compiling the kernel
Hi Steffen.

> Okay, there were some good ideas about all the zImage and
> bzImage stuff and I'll try to extend my script with all this in
> my mind and than all of you can have look at it, test it and say
> me what you think of it.

>>>> Q> if grep CONFIG_MODULES=y .config > /dev/null ; then
>>>> Q> make modules modules_install
>>>> Q> fi

>>> This might be a good idea, I haven't thought of people not using
>>> modules.

>> Try doing the "make modules" with modules disabled, and you soon
>> discover that it reports an error...

> So, it should get in definitely.

If you want the script to work on all systems, then yes...

>> I have recently set up several different 386dx/{16,20,25} based
>> systems as print servers and inter-network-segment gateways for
>> a school, and I would hate to compile a modern Linux kernel on
>> one of those systems.

>> Perhaps the script could be split into two parts, one to run on
>> the target system to determine the required configuration, and
>> one to run on the compilation system to control the compilation
>> process - and which, if used in mode 2, produces a tarball ready
>> to be extracted on the target system that drops the modules in
>> the relevant directory and puts the kernel image in its relevant
>> directory...

> Yes. That's a possibility. But, the first is to get this working
> on the same computer. To name it:

> 1. find a way to determine as much as possible about the current
> hardware.

The attached bash script is how I would start doing that...

> 2. find some questions that are easy to answer and completes the
> knowledge about the hardware.

> 3. sort all options by the criteria: MUST SET, MUST NOT SET,
> MAYBE SET.

> 4. Let the user choose options that MAYBE SET.

> 5. You've got your configuration.

Note that many hardware options can only be auto-detected if the
relevant driver is loaded. For example, the attached script only
detects the printer port if the RUNNING kernel currently includes
support for the printer port.

This implies that the autoconfig script needs to follow something
like the following algorithm for each option - I'll use parallel
port support for this example, but it applies to many other options
in a similar manner as well:

1. Is there a printer port listed in /proc/ioports here? If so,
enable this option and finish, else go to step 2.

2. Can we determine that the driver for the printer port is
currently loaded? If so, go to step 3, else go to step 5.

3. Is the driver for the printer port currently loaded? If so,
disable this option and finish, else go to step 4.

4. Can we load the driver for the printer port as a module? If
so, load it and go to step 1, else go to step 5.

5. Ask the user whether to include parallel port support.

>>> E.g.: I wanted to use my SB PCI 64V sound card and I'm STILL
>>> not sure which options I have to set. There are so many
>>> contradicting statements in the internet.

>> The big problem with that idea is keeping the database up to date,
>> unless you plan on buying one of every different card that comes
>> out...

> I was thinking of a database which many people maintain. For
> example: one person finds out no matter how which settings he
> needs for his new component X and he fills out a template
> provided that generates an email which will be a new entry in
> the database.

How does one deal with the fact that the settings that work on one
configuration do NOT work on another?

As an example of this, take my two systems. I have a USR Sportster
33k6/VoiceFax modem, and I need to set it up DIFFERENTLY for the two
systems. OK, both have it set for COM3 at 0x3E8, but on one, I need to
set it to use IRQ5 and on the other I need to set it to use IRQ2/9.

> Okay, but all that is in the future. First of all I want to do
> it in the simple way: Starting to work after xconfig. If that is
> finished I would like to extend it in this direction.

I have to admit that I don't use xconfig myself, much preferring
menuconfig, but that's just personal preference...

>> One other thought - is your script going to be i386 only?

> No, as long as there is no real good reason for that I want to
> keep it generic.

Good - but note that there will be (probably large) parts of it that
are architecture-dependant - the processor model detection for
starters...

Best wishes from Riley.

+----------------------------------------------------------------------+
| There is something frustrating about the quality and speed of Linux |
| development, ie., the quality is too high and the speed is too high, |
| in other words, I can implement this XXXX feature, but I bet someone |
| else has already done so and is just about to release their patch. |
+----------------------------------------------------------------------+
* ftp://ftp.MemAlpha.cx/pub/rhw/Linux
* http://www.MemAlpha.cx/kernel.versions.html
#!/bin/bash
function get() {
local X=`grep "$1" /proc/cpuinfo | cut -d : -f 2- | tr -s '\t' ' ' \
| tr A-Z a-z | sed 's/[()]//g' | sort -u`

if [ $# -eq 2 ]; then
X=`echo $X | tr ' ' '\n' | egrep "^$2" | tr '\n' ' '`
fi
echo $X
}
function show() {
if [ -z "$1" ]; then
printf ' %-34s %s\n' CONFIG_$2=$3 "$5"
else
printf ' %-34s %s\n' CONFIG_$2=$4 "$5"
fi
}
VENDOR=`get vendor_id`
PROCESSOR=`get 'model name'`
if [ `grep processor /proc/cpuinfo | wc -l` -gt 1 ]; then
SMP=smp
else
SMP=''
fi
APIC=`get flags apic`
FPU=`get flags fpu`
MMX=`get flags mmx`
MTRR=`get flags mtrr`
TSC=`get flags tsc`
if echo $PROCESSOR | grep '[34]86' > /dev/null ; then
CPU=`echo $CPU | sed 's/^.*\([34]86\).*$/\1/'`
else
case $VENDOR in
authenticamd) if echo $PROCESSOR | grep K7 > /dev/null ; then
CPU=686
else
CPU=586TSC
fi
;;
cyrixinstead) CPU=586
;;
genuineintel) if echo $PROCESSOR | grep 'pentium ii' > /dev/null ; then
CPU=686
elif echo $PROCESSOR | grep 'pentium pro' > /dev/null ; then
CPU=686
elif [ -n "$TSC" ]; then
CPU=586TSC
else
CPU=586
fi
;;
esac
fi
PCI=`ls -1 /proc/pci 2> /dev/null`
MCA=`ls -1 /proc/mca 2> /dev/null`
COM=`grep ' serial' /proc/ioports`
LPT=`grep ' lp' /proc/ioports`
echo
echo Based on the available information, the following Linux kernel
echo configuration is applicable to this system:
echo
show "CPU" ${CPU} n y "Processor ($PROCESSOR)"
show "$FPU" MATH_EMULATION y n 'Maths Coprocessor emulation'
show "$MTRR" MTRR n y 'Memory Type Range Register'
show "$SMP" SMP n y 'Symmetric Multi-Processor'
echo
show "$PCI" PCI n y 'PCI bus'
show "$MCA" MCA n y 'MCA bus'
echo ' :'
show "$LPT" PARPORT n y 'Parallel port support'
show "$COM" SERIAL n y 'Serial port support'
exit 0
\
 
 \ /
  Last update: 2005-03-22 13:52    [W:0.119 / U:0.048 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site