Topic: How-to install OpenWRT on FSG from shell (without serial console)


The original FSG firmware has the following layout:

1) flash has four MTD partitions (
2) The HDD also has 4 partitions (first two are for root filesystem, third is swap partition and the fourth is for user data)

If you are using FSNA recovery procedure (, the firmware switches kernel from mtd1 to mtd2 and root filesystem from /dev/sda1 to /dev/sda2 as it needs. For example, if you are upgrading from kernel 2.4 to kernel 2.6, new kernel will be written to different mtd partition. If you are just reflash firmware with the same kernel, most likely is that kernel will stay on the same mtd partition and only HDD partition will be switched.

Compile OpenWRT firmware

This example asumes that you will use the original FSG partitions. Therefore you have to compile OpenWRT kernel with ReserFS support. Append profile-FSG3 to the end of config-default and add to the config-default file following:


In make menuconfig select "Target images" and check "tgz". Save the result and build the firmware. You will need files:
openwrt-fsg3-2.6-zImage (linux kernel)
openwrt-ixp4xx-2.6-rootfs.tgz (root filesystem).

You will also need microcode. There are two files in build_dir/linux-ixp4xx direcory: NPE-B and NPE-C. To create needed microcode, from the shell go to build_dir/linux-ixp4xx directory and issue command:


The resulting file NPE-BC is the needed microcode.

All installation is done from SSH (

Prepare flash layout

1) Using Recovery procedure (, flash latest firmware with kernel 2.6. This ensures that FSG uses mtd1 partition for kernel and /dev/sda1 as root filesystem.
2) We need /dev/sda1 for OpenWRT root filesystem. Update the same original FSG firmware from web interface. This ensures that FSG will use mtd1 partition for kernel but swithces the root filesystem to /dev/sda2.
3) Install ipkg (
4) Using ipkg, install tools fis and fconfig.
5) Check that FSG really uses mtd1 kernel and /dev/sda2 as root filesystem:

fconfig -r -d /dev/mtd3 -n boot_script_data

The output should be someting like this:

fis load kern1
exec -c "console=ttyS0,115200 root=/dev/hda2 mem=64M@0x00000000"

The keywords are kern1 and /dev/hda2.

6) Backup current mtd4 partition to file:

dd if=/dev/mtd4 of=mtd4.bin

7) Create new mtd partition for NPE microcode:

fis -d mtd4.bin  create microcode -f 0x503a0000 -l 0x20000

8) Erase the current content of the mtd4 partition:

erase /dev/mtd4 0 1 1

9) Write the new content for mtd4 partition:

dd if=mtd4.bin of=/dev/mtd4

10) Erase the current content of the mtd2 partition:

erase /dev/mtd2 0 12 1

11) reboot the router

Install OpenWRT kernel

1) check that you have microcode partition:

cat /proc/mtd

2) using samba, copy OpenWRT files openwrt-fsg3-2.6-zImage, openwrt-ixp4xx-2.6-rootfs.tgz and NPE-BC to the router.
3) from the shell go to the directory that contains copied data (/home/.users/admin).
4) erase the content of microcode mtd partition:

erase /dev/mtd3 0 1 1

5) write microcode to the flash:

dd if=NPE-BC of=/dev/mtd3

6) Backup FSG kernel from mtd1 to mtd2:

dd if=/dev/mtd1 of=/dev/mtd2

7) erase FSG kernel from flash:

erase /dev/mtd1 0 12 1

8) Write the OpenWRT kernel to the mtd1:

dd if=openwrt-fsg3-2.6-zImage of=/dev/mtd1

Install OpenWRT root filesystem

1) Login as root (
2) Create a new directory in directory /tmp:

mkdir /tmp/rootfs

3) Mount /dev/sda1 to /tmp/rootfs:

mount /dev/sda1 /tmp/rootfs

4) goto /tmp/rootfs:

cd /tmp/rootfs

5) Remove the existing root filesystem:

rm -rf *

6) Install OpenWRT root filesystem:

tar zxvf /home/.users/admin/openwrt-ixp4xx-2.6-rootfs.tgz

Change Redboot config to load OpenWRT firmware

1) Backup current Redboot config:

dd if=/dev/mtd4 of=redboot.bin

2) Change Redboot config to load OpenWRT kernel:

fconfig -w -d redboot.bin -n boot_script_data -x 'fis load kern1\exec -c "console=ttyS0,115200 root=/dev/sda1 init=/etc/preinit "\'

3) Change boot script timeout to ensure that HDD has spin up:

fconfig -w -d redboot.bin -n boot_script_timeout -x 5

4) Write new Redboot config to the flash:

dd if=redboot.bin of=/dev/mtd4

5) reboot the router

The router should boot with OpenWRT.