- To find out informations about
Linux release, kernel and
architecture, use the following linux commands:
- cat
/etc/redhat-release
- uname -r
- rpm -q --queryformat
"%{ARCH}\n" kernel
- Use of
uname:
- uname -a :
display all information
- uname -s :
display operating system
- uname -n :
display name of the machine
- uname -r :
display operating system release
- uname -v :
display operating system version
- uname -m :
display machine type
- uname -p :
display processor type
- Compilation
of a new Linux
kernel
Sometimes one needs to build and compile a new Linux kernel because a
new, more stable version has been produced, or because a new version
has been enriched with more functionality, or one need to recompile the
present version simply to include variations to the configuration file.
For example, I was forced to modify few parameters commanding wireless
functionality in the configuration file, so to be able to use a
wireless driver later. Thus, I was starting with the kernel
2.6.17-1.2174_FC5 and I needed to modify few parameters in the
configuration file related to this kernel. First of all, the kernel and
the configuration parameters are loaded at boot time from the /boot
directory. For instance I had the following files for the /boot
directory:
- config-2.6.17-1.2174_FC5
- initrd-2.6.17-1.2174_FC5.img
- System.map-2.6.17-1.2174_FC5
- vmlinuz-2.6.17-1.2174_FC5
The first file contains all parameters with which the kernel
vmlinuz-2.6.17-1.2174_FC5 has been compiled. The second file is needed
to start few devices before the kernel is loaded. I don't know exactly
how System.map-2.6.17-1.2174_FC5 works, but it is absolutely needed. To
build and compile a kernel with added wireless functionality I have
followed advice from a web page:
http://www.digitalhermit.com/linux/Kernel-Build-HOWTO.html. The first
thing to do is to download the desired kernel. In my case, I had nothing
under /usr/src/redhat/BUILD, where the source for the kernel should be
on my system (FEDORA CORE 5). It is, actually, not strictly necessary to
build the kernel under "/"; given that, these days, lots of space is allocated
to users under "/home/a_user" (where "a_user" is your user name), it is
perhaps more convenient to build the kernel under the home directory.
This what I have done for this built. Symbolic links to "/usr/src/linux",
"/usr/src/redhat/", etc can always be added later. In order to create a
tree to build the kernel under a home directory the package "fedora-rpmdevtools"
has to be installed (and it could be useful for other things later). This
could be done using the following command:
yum
install fedora-rpmdevtools
From this package we are going to use the following command to build the tree:
fedora-buildrpmtree
Having done this under "/home/james" I have now the following directory created: "/home/james/rpmbuild".
Inside it other directories (composing the tree) are created: BUILD, RPMS, SOURCES, SPECS, SRPMS.
These are going to contain all the stuff built during the process. Given that the kernel is going to be built
under my home directory, I do not need to become root to do the actual building; only the installation
will require root privileges.
Let us proceed with downloading the SRC.RPM file. It should be exactly of the same type that is at present
running on your machine. For example I
downloaded the file kernel-2.6.17-1.2174_fc5.src.rpm on "/home/james/" from the fedora
repository. This is a source RPM file. I could have downloaded a zipped
tar file instead; things would have been pretty similar. I, then, did the following:
- install the kernel with command line:
rpm -ivh
kernel-2.6.17-1.2174_fc5.src.rpm
- extract the kernel and apply all the Fedora patches ("--target" should be changed according
to the architecture used):
rpmbuild -bp --target= i586
/home/james/rpmbuild/SPECS/kernel-2.6.spec
This is, usually, called the "%prep stage" of the RPM build.
After these two commands, the source directories will be properly
located in:
/home/james/rpmbuild/BUILD/kernel-2.6.17
More specifically, we will use all files under the following
subdirectory of /home/james/rpmbuild/BUILD/kernel-2.6.17, linux-2.6.17.i586,
which we will call simply Linux, from now on. Now we cd the Linux
directory:
cd
/home/james/rpmbuild/BUILD/kernel-2.6.17/linux-2.6.17.i586
After this we want to make sure that all header or library files
created while building up the last kernel are removed, so that the
source directory is pristine. We do this using:
make mrproper
In the Linux directory you should find the configuration file, ".config", which comes with the
SRC.RPM package. We better start with the configuration file previously
used, otherwise we are going to loose all previous setup.
Thus we,
cp .config .config.old
and use the present configuration file under /boot:
cp /boot/config-2.6.17-1.2174_FC5
.config
Before carrying on with the kernel configuration we vi Makefile and
find the following initial lines:
VERSION = 2
PATCHLEVEL = 6
SUBLEVEL = 17
EXTRAVERSION = -1
Well, all this information will be appended to the newly compiled
kernel when the whole process is completed. Therefore, we need to
change the last line with some unique name. In my case I did:
EXTRAVERSION = -added_wireless_functionality
Now we can proceed with the configuration. We use a graphical interface
through the command:
make xconfig
A graphical interface is started where we can tick or un-tick options;
this is how we modify the configuration for the new kernel. The kind of
configuration is typically suggested in help files from modules we want
to install, so there is no problem in doing that. At the end we save
and exit: automatically a new .config is saved in place of the old one,
which is lost. It is interesting to observe that even if no changings are required
to ".config", it is still better to call, save and exit xconfig or, otherwise
the bzImage compilation will not proceed.
After the configuration we need a bit of cleaning:
make clean
and the compilation can start:
make bzImage
Then it is time for modules compilation:
make modules
Both compilations will take a while (even an hour or so). Now we are ready for installation.
First we need to become root:
su
Next, we type:
make modules_install
The freshly created modules will be copied under
/lib/modules/2.6.17-added_wireless_functionality.
To create the initrd file we do:
mkinitrd
/boot/initrd-2.6.17-added_wireless_functionality.img
2.6.17-added_wireless_functionality
Essentially, if the kernel RPM source is, for instance, kernel-blabla.src.rpm, the command will
be "mkinitrd /boot/[a name].img blabla".
To conclude we copy the important files under /boot:
cp
/usr/src/redhat/BUILD/kernel-2.6.17/linux-2.6.17.i686/arch/i386/boot/bzImage
/boot/bzImage-2.6.17-added_wireless_functionality
cp System.map /boot/System.map-2.6.17-added_wireless_functionality
cp /usr/src/redhat/BUILD/kernel-2.6.17/linux-2.6.17.i686/.config
/boot/config-2.6.17-added_wireless_functionality
Also, we need to include in the boot loader, GRUB, those lines related
to the new kernel. The file to modify boot loader is /boot/grub/grub.conf
Once grub.conf is modified, the new kernel will
appear after rebooting. Here
is an example of the grub.conf file
I use.
- Installation
and configuration
of driver for wireless card Intel/Pro 3945ABG
As I was expecting when installing Linux Fedora Core 5 on my Dell
Latitude D520 laptop, all wireless stuff did not work. The first thing
to do was to check whether the driver for the related hardware, an
Intel/Pro 3945ABG adapter, was already installed on the laptop; it
wasn't, so I had, first to download and install it. I found the
software as a tgz file, ipw3945-1.1.0.tgz. When I untarred this file
there was an INSTALL text file saying that I had to install the latest
ieee80211 subsystem. So I downloaded a ieee80211-1.2.15.tgz,
unzipped/untarred, followed the instructions and installed it. Then
started with ipw3945. In the instructions I also found that two other
packages, a "microcode" and a regulatory deamon, had to be downloaded.
Thus, I downloaded a ipw3945-ucode-1.13.tgz and a ipw3945d-1.7.22.tgz.
Also I read that the kernel needed configuration with specific
parameters. So I had to configure and build the kernel with what was
suggested, before being actually able to install the ipw3945 driver.
The installation started in the ipw3945 directory:
cd /ipw3945-1.1.0
make
Then it was time to install the firmware files (the "microcode"). This
consisted of the following commands:
tar xzvf ipw3945-ucode-1.13.tgz
cp ipw3945-ucode-1.13/ipw3945.ucode
/lib/firmware/.
In order to work, the driver needs a "deamon". This is installed as
follows:
tar xzvf ipw3945d-1.7.22.tgz
cp ipw3945d-1.7.22/x86/ipw3945d /sbin/.
So the deamon is /sbin/ipw3945d. All the software is installed with the
above instructions. This does not, however suffice to activate the
driver. For achieving that the kernel has to load the ipw3945 module.
In other words we could say that the wireless interface needs to be
running, in order to make some use of the wireless card. We can do that
using the modprobe mechanism. First,
cp ipw3945.ko
/lib/modules/2.6.17-added_wireless_functionality/.
depmod -a
The depmod -a is used to update the modules dependency in a general
dependency tree. Then we have to add the
following lines to file /etc/modprobe.conf:
alias eth1 ipw3945
install ipw3945 /sbin/modprobe
--ignore-install ipw3945; sleep 0.5; /sbin/ipw3945d --quiet
remove ipw3945 /sbin/ipw3945d
--kill; /sbin/modprobe -r --ignore-remove ipw3945
The first line identifies interface eth1 with the ipw3945 driver. The
next two lines are
the correct commands to load or unload the driver+regulatory deamon.
Inclusion of these lines in modprobe.conf insures that the interface is
automatically loaded at boot. But the regulatory deamon can
automatically be loaded only with the inclusion in /etc/rc.local of the
following line
/sbin/ipw3945d --quiet
Finally, we need to configure eth1 so that when the command ifup eth1
is typed,
the computer is hatched to a wireless connection. Things here are
really complicated,
and they will vary according to the kind of wireless connection and
encryption used.
I use a WPA2-AES encription, with a certain passphrase that will
pretend to be "my_passphrase".
In order to handle WPA encryption a program called wpa_supplicant is
needed. Luckily I
had this program already installed as /usr/sbin/wpa_supplicant. The
idea is to have this program running in background and coming to help
when a network through eth1 is started. I found that the best way to
act is as follows. First create a file
/etc/wpa_supplicant/wpa_jaldomaldo.conf ("jaldomaldo" is the SSID of my
wireless network) with these lines:
ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=0
ap_scan=1
# Home network
network={
ssid="jaldomaldo"
priority=1
proto=RSN
bssid=00:0F:B5:A7:90:A2
key_mgmt=WPA-PSK
pairwise=CCMP TKIP
group=CCMP TKIP
psk="my_passphrase"
}
Then remove eventual keys from
/etc/sysconfig/network-scripts/keys-eth1. Also, the
/etc/sysconfig/network-scripts/ifcfg-eth1 file will have to have the
following content:
# Please read /usr/share/doc/initscripts-*/sysconfig.txt
# for the documentation of these parameters.
ONBOOT=no
USERCTL=yes
IPV6INIT=no
PEERDNS=yes
TYPE=Wireless
DEVICE=eth1
BOOTPROTO=dhcp
MODE=Auto
To start the network one can follow different routes. I have written
a very simple bash shell,
"/etc/sysconfig/network-scripts/start-wireless",
which has the following content:
#!/bin/bash
DEVICE=${1}
/usr/sbin/wpa_supplicant -Bw -i$DEVICE -c/etc/wpa_supplicant/wpa.conf
-Dwext
sleep 10.0
/sbin/ifup $DEVICE
The shell will have to be started as root in the following way:
/etc/sysconfig/network-scripts/start-wireless
eth1
Basically I start the wpa_supplicant daemon in the background and then
wait for a while (to give time to the wireless driver to associate to
the
wireless network) before bringing up the interface eth1.
To bring down the wireless network I follow this method.
In file /etc/sysconfig/network-scrpts/ifdown the following lines are
written before the line "OTHERSCRIPTS...":
# is the device wireless?
is_wireless_device ${DEVICE} && . ./ifdown-wireless
Then a new file /etc/sysconfig/network-scripts/ifdown-wireless is
written like this:
#!/bin/bash
killall wpa_supplicant
rm -rf /var/run/wpa_supplicant
The wireless network is thus ended with:
ifdown eth1
As I said, one can imagine many methods for starting or ending the
newtwork; I'm quite happy doing what I have just described.
- Issues with
the installation of Maple 9.5
The first time I have tried to install the Linux version of Maple 9.5 I
had
serious problems. I was installing from a CD, running the
"installMapleLinuxSU" shell with the command:
sh installMapleLinuxSU
The result of this was a lot of complaining about few shared libraries
missing. I looked up the internet and found that this sort of error
messages are given by Java setting the LD_ASSUME_KERNEL environment
variable to the wrong value. It does not help setting this variable to
the correct value before running "installMapleLinuxSU", because this
shell, ultimately, calls a binary file, "LinuxInstaller.bin", which has
specific settings for LD_ASSUME_KERNEL; thus any previous setting by
the user would be changed by the Linux installer. The only way, as
suggested in the web, to avoid this is to comment, in
"LinuxInstaller.bin" all lines containing "export LD_ASSUME_KERNEL=".
Of course there is no way of doing this until the "LinuxInstaller.bin"
file resides on a CD. So, the first thing I have done was to copy all
CD's content under a temporary directory (for me /home/james/var). Then
I could change the "LinuxInstaller.bin" file as needed. A word of
caution is needed here, though. This file is a binary file. If it is
edited in the normal way, with any editor or, even, with vi, things are
changed in such a way that the binary lines will be messed up and the
installation will, again, fail. The proper way to edit the file,
commenting out the "export LD_ASSUME_KERNEL" lines, is by opening the
file in this way:
vim -b LinuxInstaller.bin
Once the file is open the above mentioned lines will have to be
commented as "#xport LD_ASSUME_KERNEL". In this way an ASCII character
is replaced with another ASCII character, and the rest of the binary
file is not compromised. After having done all this the Maple installer
installed Maple OK.