Some of the following steps assume you've mounted the AS/400 filesystem on your linux box under /mnt/as400. You should allow for root access in the AS/400 /etc/EXPORTS file during the configuration period. To avoid the risk of accidentally changing system files, we only mount the /linux filesystem:
mount 10.4.1.29:/linux /mnt/as400
We've prepared some script files to help you configuring your system. Those files are not a complete solution, they are just templates for you to easify the process. You need to adopt those scripts to your needs, escpecially changing the IP-addresses to those used on your network.
Downloads the files from http://www.herdsoft.com/ftp/downloads.html#ipcs and untar it into some user directory.
wget http://www.herdsoft.com/ftp/ipcs_accompanying_files.tar.gz tar xzf ipcs_accompanying_files.tar.gz
You need a copy of a 2.4 linux source code. Those are available from http://www.de.kernel.org/pub/linux/kernel/v2.4/ .
Extract the archive into /usr/src directory of an existing Debian 2.2r2 linux box. The box needs to have the usual development tools like binutils, gcc etc. installed.
cd /usr/src/kernel-source-2.4.0 and make xconfig.
While you may use kernel modules in your kernel, most network-related stuff needs to be inside of the main kernel, do not compile it as a module!
After compiling the kernel using ``make bzImage'' we need to copy it onto the AS/400 filesystem. Note that the linux kernel stores it's configuration in the hidden file /usr/src/kernel-source-2.4.0/.config. Such a file is included in the accompanying files.
cd /usr/src/kernel-source-2.4.0 make xconfig make dep make bzImage cp arch/i386/boot/bzImage /mnt/as400/bt/bzImage2.4
The depmod program shipped with debian 2.2 is incompatible to the Kernel 2.4. You may update to Version 2.4.1 or include everything you really need into the kernel.
The easiest way is to install a functional but small debian installation onto a small hard disk partition on another PC, or yet better onto a partition under http://www.vmware.com . I suppose the partition must be smaller than 2 GByte. 512 MByte to 1 GByte are fine. Do not specify a swap partition.
Add a line mounting /dev/loop0 to /etc/fstab:
/dev/loop0 / ext2 defaults,errors=remount-ro 0 0
Change IP-Parameters in file /etc/network/interfaces to the parameters choosen for your netfinity server:
# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8) # The loopback interface iface lo inet loopback # The first network card - this entry was created during the # Debian installation# (network, broadcast and gateway are optional) iface eth0 inet static address 10.4.1.30 netmask 255.255.255.0 network 10.4.1.0 broadcast 10.4.1.255
We need to slightly modify the shutdown sequence. The regular shutdown sequence unmounts NFS filesystems first (but only those listed in /etc/mtab and therefore not including the mount performed by /linuxrc in the initial RAM-Disk), afterwards it unmounts the ``local'' filesystem /dev/loop0 and finally the machine halts.
Sometimes it might happen that the write-cache for the NFS-Filesystem might not get written to the NFS-Server berfore the machine goes down. For that reason we need to make sure to call /bin/sync before the machine halts.
Add /etc/init.d/syncnfsloopback:
#!/bin/bash # echo "Synchronizing..." /bin/sync # # Wait a few seconds /bin/sleep 20 # /bin/sync
Add a symlink so the new script will be called on shutdown:
chmod +x /etc/init.d/syncnfsloopback ln -s /etc/init.d/syncnfsloopback /etc/rc6.d/S50syncnfsloopback ln -s /etc/init.d/syncnfsloopback /etc/rc0.d/S50syncnfsloopback
Finally copy the partition data onto the AS/400 using something like:
sync dd if=/dev/hda1 of=/mnt/as400/netfinity/netfinity.disk bs=4096
This is about the hardest work to be performed.
cd /root mkdir /root/netfinity.initrd dd if=/dev/zero of=netfinity.initrd.img bs=1024 count=4096 mke2fs -i 1024 -b 1024 -m 5 -F -v netfinity.initrd.img mount netfinity.initrd.img /root/netfinity.initrd -t ext2 -o loop cd netfinity.initrd [create the neccessary files.] cd .. umount /root/netfinity.initrd gzip -c -9 netfinity.initrd.img > netfinity.initrd.gz
You may populate most of the files using copies of the programs from your regular installation. The binaries on the debian boot floppies are special reduced-size binaries with reduced options and working with them is quite confusing.
Besides the program binaries itself you also need to include the lib*.so files. You may find out about the required so files using the command ldd:
ldd /bin/bash libncurses.so.5 => /lib/libncurses.so.5 (0x40019000) libdl.so.2 => /lib/libdl.so.2 (0x40058000) libc.so.6 => /lib/libc.so.6 (0x4005c000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
mkdir etc dev bin lib proc sbin usr initrd mkdir tmp var var/run var/lib var/nfs mnt mnt/nfs cp -pR /dev/loop0 /dev/console /dev/null /dev/zero /dev/tty dev cp -p /lib/libdl.so.2 /lib/libc.so.6 /lib/ld-linux.so.2 lib cp -p /lib/libwrap.so.0 /lib/libncurses.so.5 lib cp -p /lib/libnsl.so.1 lib cp -p /bin/bash /bin/mount bin cp -p /sbin/ifconfig /sbin/losetup /sbin/portmap sbin ln -s /bin/bash bin/sh ln -s /proc/mounts etc/mtab
The kernel executes the /linuxrc script after mounting the initial ram-disk as root filesystem. It's purpose is to prepare access to the block device /dev/loop0 so the kernel will be able to mount that device as the final root device.
#!/bin/sh # # Script started during initrd initialization intented # to prepare mount of the root filesystem. # # echo "/linuxrc: mounting /proc" /bin/mount /proc /proc -t proc echo "/linuxrc: Initializing network loopback device 127.0.0.1" /sbin/ifconfig lo 127.0.0.1 up echo "/linuxrc: Initializing portmapper" /sbin/portmap echo "/linuxrc: NFS-Mounting AS/400 to /mnt/nfs" /bin/mount 10.4.1.29:/linux/netfinity /mnt/nfs echo "/linuxrc: Displaying result" /bin/mount echo "/linuxrc: Setting up loopback device /dev/loop0" /sbin/losetup /dev/loop0 /mnt/nfs/netfinity.disk exit 0
pxelinux.bin assumes configuration files in /linux/bt/pxelinux.cfg The filename is the IP address in hex, for example 0A04011E for 10.4.1.30. The filename ``default'' matches all addresses that do not have their own config file:
# 0A04011E -> 10.4.1.30, AS/400 netfinity server DEFAULT netfinity LABEL netfinity KERNEL bzImage2.4 APPEND ip=10.4.1.30:10.4.1.104:10.4.1.104:255.255.255.0:netfinity:eth0:off\ initrd=netfinity.initrd.gz root=0700 ro
bzImage2.4 is the filename of the linux kernel, copied after ``make bzImage'' from the /usr/src/kernel-2.4.0/arch/i386/boot directory.
Note that the APPEND command should be on one line.
The ip= statement defines the IP address of the netfinity server, the IP address of the gateway etc., see /usr/src/kernel-source-2.4.0/Documentation/nfsroot.txt for details.
initrd=netfinity.initrd.gz specifies the filename of the initial RAM disk image.
root=0700 specifies the device /dev/loop0, however the kernel doesn't understand the device name /dev/loop0 on the command line and therefore we need to specify the major/minor numbers in hex.
ro tells the kernel to mount the filesystem read-only, so a file system integrity check can be applied later before re-mounting the filesystem again.
Read /usr/doc/syslinux/pxelinux.doc.gz for more informations on pxelinux.