|
|
Linux » Books » Developer »
Linux Device Driver Programmer's Guide,Porting to SGI Altix Systems
(document number: 007-4520-007 / published: 2008-09-24)
table of contents | additional info | download find in page
Chapter 12. Building Linux Kernels and Modules
This section provides the location of the default configuration
file, steps for building and booting a new Linux kernel on an SGI Altix
series system, and steps for rebuilding a module. The commands and procedures
for recompiling or rebuilding the Linux kernel are the same as for any
other Linux platform.
Default Configuration File
The configuration file used to build the Linux kernel that is running
on your SGI Altix series system is /usr/src/linux/arch/ia64/sn/configs/defconfig-sn2
. To build a new kernel, use this configuration file as a base.
It should not be necessary to make a new configuration file.
Building a New Linux Kernel
The steps for building a new kernel are as follows: cd /usr/src/linux
make clean
cp configs/kernel-2.4.21-ia64.config .config
make oldconfig
make dep
make
make compressed |
Booting Your New Linux Kernel
To boot your new Linux kernel, copy or move vmlinuz
to /boot/efi/efi/sgi and reboot, as follows: % cp arch/ia64/boot/vmlinuz /boot/efi/efi/sgi/my_vmlinuz reboot |
Enter the following at the EFI shell command: elilo my_vmlinuz root=/dev/sda3 console=ttyS0
|
For more details regarding rebuilding the Linux kernel, see the
/usr/src/linux/README file . This file also contains information
on how to rebuild a new Linux kernel from sources other than those released
by SGI that you have downloaded on your machine.
To rebuild the modules on your system, use the following commands: cd /usr/src/linux
make modules |
Example output: make[1]: Entering directory `/usr/src/linux-2.4.20/lib'
make -C zlib_deflate modules
make[2]: Entering directory `/usr/src/linux-2.4.20/lib/zlib_deflate'
gcc -D__KERNEL__ -I/usr/src/linux-2.4.20/include -Wall -Wstrict-prototypes
-Wno-trigraphs -O2 -fno-strict-aliasing -fno-common -g -fomit-frame-pointer -pipe
-ffixed-r13 -mfixed-range=f10-f15,f32-f127 -falign-functions=32 -DSGI_SN_EXECUTABLE_STACKS
-DBRINGUP -DBRINGUP2 -DMODULE -I /usr/src/linux-2.4.20/lib/zlib_deflate -nostdinc
-iwithprefix include -DKBUILD_BASENAME=deflate -c -o deflate.o deflate.c
gcc -D__KERNEL__ -I/usr/src/linux-2.4.20/include -Wall -Wstrict-prototypes
-Wno-trigraphs -O2 -fno-strict-aliasing -fno-common -g -fomit-frame-pointer -pipe
-ffixed-r13 -mfixed-range=f10-f15,f32-f127 -falign-functions=32 -DSGI_SN_EXECUTABLE_STACKS
-DBRINGUP -DBRINGUP2 -DMODULE -I /usr/src/linux-2.4.20/lib/zlib_deflate -nostdinc
-iwithprefix include -DKBUILD_BASENAME=deftree -c -o deftree.o deftree.c
gcc -D__KERNEL__ -I/usr/src/linux-2.4.20/include -Wall -Wstrict-prototypes
-Wno-trigraphs -O2 -fno-strict-aliasing -fno-common -g -fomit-frame-pointer -pipe
-ffixed-r13 -mfixed-range=f10-f15,f32-f127 -falign-functions=32 -DSGI_SN_EXECUTABLE_STACKS
-DBRINGUP -DBRINGUP2 -DMODULE -I /usr/src/linux-2.4.20/lib/zlib_deflate -nostdinc
-iwithprefix include -DKBUILD_BASENAME=deflate_syms -DEXPORT_SYMTAB -c deflate_syms.c
rm -f zlib_deflate.o
ld -r -o zlib_deflate.o deflate.o deftree.o deflate_syms.o |
To install these newly created modules, use the following command:
The following step copies all the newly created modules to the directory: /lib/modules/[kernel_version]/ |
Example output: make[1]: Entering directory `/usr/src/linux-2.4.20/lib'
make -C zlib_deflate modules_install
make[2]: Entering directory `/usr/src/linux-2.4.20/lib/zlib_deflate'
mkdir -p /lib/modules/2.4.20-sgi220a31/kernel/lib/zlib_deflate/
cp zlib_deflate.o /lib/modules/2.4.20-sgi220a31/kernel/lib/zlib_deflate/
make[2]: Leaving directory `/usr/src/linux-2.4.20/lib/zlib_deflate'
make[1]: Leaving directory `/usr/src/linux-2.4.20/lib' |
 | Note: The SGI Altix series system might come with binary-only
release modules. These modules cannot be remade on your machine.
|
For more information on Linux kernel modules, see the following
link: http://tldp.org/HOWTO/Module-HOWTO/
Downloading SGI Altix RPMs
Open source rpms for the SGI Altix system can be downloaded from
oss.sgi.com. These rpms can be downloaded with your favorite web browser
at the following location:
You can also download these sources via Anonymous FTP, as follows: % ftp oss.sgi.com
% cd /projects/sgi_propack/download/2.2
% get kernel-2.4.20-sgi220rp03062622_10017.src.rpm
If you have the correct directories and also root access set up
to manage Red Hat rpms, you can use the various rpm commands to retrieve
and build the sources from the source rpm. Otherwise, you can use the
following procedure: Use the rpm2cpio
command to extract the files from the rpm.
Use the unzip(1)
command to unzip the tar file.
Use the tar(1)
command to untar the tar file.
Perform your build.
The following provides a session trace of the above steps: $ rpm2cpio kernel-2.4.21-sgi303r2.src.rpm | cpio -iduvm
kernel-2.4.21-ia64.config
linux-2.4.21.tar.gz
linux-common.spec
linux-sn2.spec
module-info
77535 blocks
$ gzip -dc
$ gzip -dc |
You can perform this task on any platform with Itanium processors.
If you are writing and developing modules for the SGI Altix system
on either an Altix platform or any other platform with Itanium processors,
you can use the steps outlined in “Downloading SGI Altix RPMs” to
download the kernel sources onto your platform and then build and test
your modules. You may consider using the following procedure to build
your modules, (The following procedures assumes that you are using
/usr/src/example as the directory of your module development)
as follows: Create a Makefile for 2.4 similar
to the following: obj-m += module_example.o
include $(TOPDIR)/Rules.make |
Run the make(1)
command from any location, as follows:
% make -C /usr/src/linux-2.4.20 SUBDIRS=/usr/src/example modules |
An example session is, as follows: Example session:
[root@rappel linux-2.4.20]# make -C /usr/src/linux-2.4.20 SUBDIRS=/usr/src/example modules
make: Entering directory `/usr/src/linux-2.4.20'
make -C /usr/src/example CFLAGS="-D__KERNEL__ -I/usr/src/linux-2.4.20/include -Wall -Wstrict-prototypes -W
no-trigraphs -O2 -fno-strict-aliasing -fno-common -g -fomit-frame-pointer -pipe -ffixed-r13 -mfixed-range=
f10-f15,f32-f127 -falign-functions=32 -DMODULE" MAKING_MODULES=1 modules
make[1]: Entering directory `/usr/src/example'
gcc -D__KERNEL__ -I/usr/src/linux-2.4.20/include -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -fno-strict-a
liasing -fno-common -g -fomit-frame-pointer -pipe -ffixed-r13 -mfixed-range=f10-f15,f32-f127 -falign-funct
ions=32 -DMODULE -nostdinc -iwithprefix include -DKBUILD_BASENAME=module_example -c -o module_example.o m
odule_example.c
make[1]: Leaving directory `/usr/src/example'
make: Leaving directory `/usr/src/linux-2.4.20'
[root@rappel linux-2.4.20]# ls /usr/src/example
Makefile module_example.c module_example.o |
 | Note: SGI strongly recommends that you use this method because it ensures
that all the appropriate defines and flags are used to build your modules.
|
Linux Device Driver Programmer's Guide,Porting to SGI Altix Systems
(document number: 007-4520-007 / published: 2008-09-24)
table of contents | additional info | download
Front Matter
New Features in This Guide
About This Guide
Chapter 1. Introduction
Chapter 2. Architecture
Chapter 3. PCI-X Device Attachment
Chapter 4. PCI System Initialization
Chapter 5. Finding Your PCI Device
Chapter 6. PCI/PCI-X Configuration Space
Chapter 7. PCI-X I/O and Memory Resources
Chapter 8. PCI-X Interrupt Mechanism
Chapter 9. PCI-X Direct Memory Access (DMA)
Chapter 10. Device Driver Memory Usage
Chapter 11. Time Management
Chapter 12. Building Linux Kernels and Modules
Appendix A. Memory Operation Ordering on SGI Altix Systems
Index
home/search |
what's new |
help
|
|
|