|
|
Linux VR Kernel Building HOWTO
By Bradley D. LaRonde ([email protected])
Preface
A few people have asked me how they can help with the development, and my response was repeatedly something like, "First, get your compile enviornment set up and try building the kernel". That spurred me on to make my own Vr41xx-aware Linux-MIPS Kernel Building HOWTO. It's a quick-start guide to beginning Vr41xx development, walking you through the steps from start to finish. So, if you've been kicking around the idea of building the kernel yourself, but weren't sure where to start, please take a look.
Overview
Building the kernel involves several steps, espcially at first. Here is an outline of things one normally needs to do to build a linux-mips kernel for the first time:
1. Set up your cross-compile environment
2. Get the latest Linux VR kernel sources
3. Supply a ramdisk object
4. Configure the kernel
5. Finish building the kernel
Each step is described in detail below.
Note: These instructions assume that you will build your kernel on a Red Hat 6.0 i386 installation.
Setting Up a Cross-Compile Environment
To set up your cross-compile environment, you need to get the mipsel-linux compiler and binutils and install them on your computer. I highly recommend that you get the binaries instead of building them yourself because a) it's easier, b) building the kernel challenging enough, and c) I know that these work and have heard that building things like glibc yourself is asking for it.
To setup up your cross-compile environment
1. See the Linux VR Tools HOWTO.
Getting the Latest Linux VR Kernel Sources
The latest Linux VR kernel sources are kept in the Linux VR CVS repository. There are also release snapshots available.
The main Linux-MIPS sources are kept in a CVS archive at SGI. Anonymous users can access it by cvs -d :pserver:[email protected]:/cvs login, password cvs, co linux. Users with account the path name is /home/pub/cvs/. We have been keeping the Linux VR sources in sync with them. We have also begun providing back-syncs to SGI.
Note: this HOWTO assumes that you put your Linux VR kernel sources in ~/src/linux-vr.
To get the latest Linux VR sources from our CVS
1. See the Linux VR CVS HOWTO.
Supplying a Ramdisk Object
The kernel can mount a ramdisk as root. I have some ramdisk object files on my ftp site that you can link into your kernel. You may also build your own ramdisk object, which you need to do if you want to add to or modify the ramdisk for your own purposes.
To supply a prepared ramdisk object
1. Get a prepared ramdisk object file ramdisk.o.bz2 from my ftp site.
2. Uncompress it.
3. Put the ramdisk.o file in /usr/src/linux/arch/mips/boot/.
To build and supply your own ramdisk object
1. See the Ramdisk HOWTO for more information about modifying/building ramdisks and making ramdisk objects, and build your own ramdisk object.
2. Put your ramdisk.o file in /usr/src/linux/arch/mips/boot/.
Configuring the Kernel
Before you can build the kernel, you first have to configure it. There are at least couple of ways to accomplish this. One way is to get a prepared config from my ftp site and use that to configure the kernel. Another way is to configure it all yourself. Both of those methods are described below. You can also use a combination of ways.
To configure the kernel with a prepared .config
1. Get the prepared config from my ftp site at ftp.ltc.com that is appropriate for your platform.
2. Uncompress it (if necessary).
3. Rename it to .config.
4. Put it in ~/src/linux-vr.
5. Change to ~/src/linux-vr.
6. Type: make oldconfig
to run though the prepared .config.
7. Type: make dep
and look at the output to see if there are any errors.
To configure the kernel all yourself
1. Change to /usr/src/linux (that we sybolically linked to /usr/src/linux-mips above).
2. Type: make menuconfig
3. Under Code maturity... turn on Prompt for development...
4. Under Machine Selection, Class, select Handheld/PDA.
5. Under Kernel hacking, select Are you using a cross compiler.
6. Finish setting the rest of the configuration options.
7. When you are finished configuring, exit and save your changes.
8. Type: make dep
and look at the output to see if there are any errors.
Finishing Building the Kernel
Now that you have configured the kernel and made the dependencies, you can make the kernel, producing the final kernel image.
Making the kernel normally produces a vmlinux file, which is the kernel executable. The vmlinux file normally contains a lot of debugging and unnecessary information that can safely be removed. You can build a "stripped" version of vmlinux, called vmlinux-stripped, that is much smaller and more appropriate for booting on small devices than vmlinux itself.
To make the kernel
1. Type: make stripped
2. Look at the output and see if there are any errors. If everthing went right, you should now have an arch/mips/boot/vmlinux-stripped that you can use to boot Linux on your device.
Testing Out Your New Kernel
Congratulations! If you've gotten this far successfully, you've finished building the kernel. Now, boot it up and give it a try. Look here for instructions on booting kernels.
Further Reading
For more info, see also Mike Klar's kernel page and Ralf Bächle Linux-MIPS HOWTO. |
|
|