How to build RPM from Tarball file

0. Prerequisite

  • Linux system
    • Redhat 7.1 7.2 7.3 8.0 9.0 i386
    • Redhat Enterprise Linux 2 i386, CentOS 2.x
    • Redhat Enterprise Linux 3 i386, CentOS 3.x
    • Redhat Enterprise Linux 4 i386, CentOS 4.x
    • Fedora Core 1 i386
    • Fedora Core 2 i386
    • Fedora Core 3 i386
    • Fedora Core 4 i386
    • Fedora Core 7 i386
    • Fedora Core 8 i386
    • SuSE 8.1 8.2 8.3 9.0, 9.1, 9.2, 9.3, 10.0, 10.1, 10.2, 10.3 with i386
    • Mandriva 2006
    • x86_64 version is tested only on Fedora Core 7 & 8.
  • C compiler that compiled your kernel if CPU architecture is not x86_64.

Usually, ok if the major/minor version is matched.
For example, your kernel compiled by gcc 3.4.2. then you can compile the NDAS driver with gcc 3.4.1

  • Some customizations of tarball file will be needed to build or install the NDAS driver into the other linux distributions.
    Please share those infomation so that we can release the binary in the next release.
    Thank you.

1. Install and configure the kernel source

Redhat 8/9, Fedora Core 1, Redhat Enterprise Linux 3, CentOS 3.x

Download kernel-source rpm package and configure the kernel source at /usr/src/linux-2.4

# cd /usr/src/linux-2.4
# make mrproper
# cp configs/kernel-for_your_kernel .config

and change the kernel EXTRA_VERSION name. For example, if you are using smp kernel then the name should be 2.4.20-8smp if you are using uni-processor kernel then the name should be 2.4.20-8

# vi Makefile 

Then generate the dependency files and version file

# make oldconfig
# make dep
# make init/version.o

Fedore Core 2

Donwload the source rpm of your kernel, unpack it and configure by

# make include/asm-i386/asm_offsets.h

Fedora Core 3

Install SRPM, unpack and apply the patches

rpm -ivh kernel-2.6.5.1.spm.rpm
rpmbuild -bp /usr/src/redhat/SPECS/kernel-2.6.spec --target=i686

you have the kernel source under

/usr/src/redhat/BUILD/kernel-2.6.16/linux-2.6.16/

or similar directory. then follow the step for redhat

Fedore Core 4~8, Redhat Enterprise Linux 4, CentOS 4

# yum install kernel-devel

2.4.x kernel for SuSE 9.0 or below

Download the kernel-source RPM and install it from SuSE mirror sites

# rpm -ivh kernel-source-*.rpm

The kernel config file (/usr/src/linux-[your kernel version]/.config) should be configured to have the same kernel version with your kernel. Open the config file in the kernel source,

# vi /usr/src/linux-[your kernel version]/.config

then, look for 'CONFIG_CFGNAME' and modify the 'config name' into that of your kernel. usually it should be 'default'.

For example, if the the result of 'uname -r' is

2.4.21-99-default

then the 'config name' is 'default'. so change the value for 'CONFIG_CFGNAME' in the .config file into 'default'.

CONFIG_CFGNAME=default

Execute 'make init/version.o' command from the kernel source directory so that the version files of linux source are changed according to the changes of .config file.

make init/version.o

SuSE 9.1, 9.2, 9.3, 10.0, 10.1, 10.2, 10.3

Use YaST to install kernel-source.

  • execute yast2 as root.
    sudo /sbin/yast2
    

or From Desktop, select Computer->Control Center->YaST

  • goto software(or Software Management), install and delete software
  • search for the package "kernel-source", "gcc", and install it.

Mandriva 2006 and blackPanther OS > v4.x

Locate the kernel source and clean the previous setting.

cd /usr/src/linux-`uname -r`
make clean mrproper

The kernel config file (/usr/src/linux-[your kernel version]/arch/i386/defconfig.*) should be configured to have the same kernel version with your kernel. Copy the one of defconfig.* into .config

cp arch/i386/defconfig.default .config

Cause the kernel makefile generates the scripts and the version information.

make oldconfig include/asm-i386/asm_offsets.h

Now ready to compile the NDAS driver againt this kernel source.

Mandriva

urpmi kernel-source

2. Download tarball and Build the NDAS rpm

or, if you have a i686-kernel:

rpmbuild -tb --target=i686 ndas-1.x-x.tar.gz

and you will get the RPM file under

/usr/src/redhat/RPMS/i386/ # Redhat / Fedora
/usr/src/packages/RPMS/i586/ # SuSE (or /usr/src/packages/RPMS/<output of "uname -m">)
/usr/src/RPMS/RPMS/i386/ # Mandriva

or

/usr/src/redhat/RPMS/x86_64/ # Redhat / Fedora
/usr/src/packages/RPMS/x86_64/ # SuSE (or /usr/src/packages/RPMS/<output of "uname -m">)
/usr/src/RPMS/RPMS/x86_64/ # Mandriva

depending on your platform. Move to the directory that ndas-kernel-xxxxx.rpm file and ndas-admin-xxxx.rpm file exist.

3. Install the rpm

  • Run the following commands in root. (Replace xxx with proper values)
    rpm -ivh ndas-kernel-1.x-2.6.20_8.24.xxx.rpm
    rpm -ivh ndas-admin-1.x-x.xxx.rpm
    

4. Using NDAS driver

After you install the driver, please read the README file which can be found under

/usr/share/ndas

If you can't locate the README under /usr/share/ndas, then try

rpm -ql ndas-admin

The subversion source is at source:/linux/trunk/README

5. Kernel changes

If the Linux kernel has changed since the NDAS driver installed, you need to update NDAS kernel modules. Please rebuild the NDAS RPMs and install them.

Note: NDAS rpm will automatically add a dependency on kernel rpm package with the version name corresponding to the kernel source you have built it against. In case you compiled your own kernel from sources, there will be no such rpm available on the systen, so "rpm -ih --nodeps" needs to be used for install. This is normal, and unlikely to break your system (unless the ndas kernel module goes crazy, but this has nothing to do with rpm dependencies).vaizdo klipai