Kamikaze Installation

From X-Wrt

Jump to: navigation, search

Contents

Installing OpenWrt Kamikaze and X-Wrt

X-Wrt: A package

X-Wrt is an improved webif (webinterface) for OpenWrt Kamikaze.

X-Wrt for Kamikaze is a single, and complete, package which can be installed with the appropriate ipkg commands, or alternative as part of a pre-compiled image.

WhiteRussian versus Kamikaze

It is the intent of the X-Wrt developers to keep the two versions of the improved webif as identical as possible. The underlying versions of OpenWrt, eg. WhiteRussian and Kamikaze, are completely different branches which makes this a challenge.

There are several major difference between the two versions of OpenWrt, and a few are listed here:

  • Move away from nvram variables to standard configuration files
  • Expansion of the supported hardware platforms (not just Broadcom: the complete list is here)
  • Move from 2.4 to 2.6 Linux kernel (except when wifi is needed on Broadcom/brcm)

This is a clear indicator that OpenWrt Kamikaze is aimed at being a much more versatile embedded system, not only an alternative firmware for wireless routers.

It is recommend to check the OpenWrt site for the most up-to-date information on the current Kamikaze release.

Notes on hardware

OpenWrt Kamikaze supports a broad list of platforms which can be unfolded to an even longer list of specific devices

Broadcom and all the other platforms

The original target platform of OpenWrt was the various Broadcom based devices (brcm), such as common routers from Linksys, Asus, Buffalo and so forth. The Broadcom platform is relatively easy to work with, but relies to some extent on proprietary drivers. There are presently numerous alternatives to the Broadcom based devices, especially Atheros and Infineon chipsets have recently become popular amongst developers and manufactures.

Bootloaders:

  • CFE
    • Basic information on the Broadcom Common Firmware Environment, or CFE
  • MyLoader
    • This is an alternative bootloader used by Compex. More information here
  • ADAM2
    • ADAM2 is a bootloader for Texas Instruments AR7-based devices.
  • PSPBoot
    • PSPBoot is another bootloader used on TI AR7-based devices.
  • other (?)

Installing on new hardware

Broadcom

It is a normally quite easy to install Kamikaze (with and without X-Wrt webif) on Broadcom based devices (brcm), which include most devices by Asus, Belkin, Linksys, Buffalo, and others.

Go to the X-Wrt Downloads page, which contains the same images as on openwrt.org, but including the webif² package. Decide whether you'd like to use a 2.4 kernel (brcm-2.4) or a 2.6 kernel (brcm47xx-2.6 - see caveats below), download the pre-compiled image (openwrt-brcm-2.4-squashfs.trx for most purposes, but you might find a specific image for your device there) and use the existing firmware upgrade function to upload the image to your device. Check out the OpenWrt Installation docs for more details.

There are a few things to be aware of:

  • Wireless for brcm devices is supported on the 2.4 kernel AND 2.6 kernel support is available through the brcm47xx image
  • The wireless interface is defaultly disabled
  • Remember to download the correct image for your device ( you probably want something based on brcm-2.4 or brcm7xx )
  • After installation remember to enable boot_wait (as shown here)

RedBoot Devices

RedBoot is a boot-manager for Atheros-based embedded routers/devices. While they can be less user-friendly than Broadcom devices, there remains no easy point-and-click solution to installing OpenWrt Kamikaze. However, RedBoot offers several (possibly complicated) extensions, but these devices are very flexible and powerful so it can be worth the time invested in learning them.

RedBoot must be configured before installing Kamikaze. Refer to the following links for information and utilities needed for the following instructions.

Initial RedBoot setup

The number of Atheros 'System on a chip' (SoC) based routers are increasing, the most common are still the various Fonera versions or the Meraki Mini. Both are oem products manufactured by Accton, and Accton has just released the MR3202A model which from the outside seems to be identical to the Fonera+ (with two ethernet ports).

The different FON and Meraki devices, with Atheros SoC, use the RedBoot bootloader and have either 4/16 or 8/32 MB of Flash/RAM and the default firmware is in both cases based on OpenWrt. It is fairly easy to substitute the existing system with the current OpenWrt Kamikaze release. The initial step required to install OpenWrt Kamikaze on these devices is the configuration of the RedBoot bootloader. It is possible to re-flash these devices without changing the bootloader configuration, but it is not recommended. The argument is quite simple: Recovery from a firmware re-flash gone bad is only possible if RedBoot is setup to accept "inquiries" before boot of the system, from the flash chip. Apart from this, the size of the kernel of Kamikaze has changed so it is needed to alter the layout of the partitions on the devices. Such re-partitioning is done with the help of RedBoot. The following section is partly based on an edited translation from Freifunk-Hannover.

Configuring RedBoot access

SSH

Fonera

Fonera routers have SSH disabled by default so you will have to use one of the following techniques depending on the firmware version on the specific router. This list is not complete.

Meraki

The Meraki Mini requires no extra configuration. It has SSH access enabled by default and its RedBoot comes setup with boot_wait.

Serial Console

To get serial console access to RedBoot you will have to stop the boot sequence. This is done by a quick CTRL+C immediately after the Fonera is powered on. Refer to the OpenWRT wiki for further instructions.

Once you see the RedBoot prompt, use the following configuration, substituting your own IP addresses if desired:

RedBoot> fconfig bootp_my_ip 169.254.255.1
RedBoot> fconfig bootp_my_ip_mask 255.255.0.0
RedBoot> fconfig boot_script_timeout 10
RedBoot> reset

These commands define the IP address and netmask of the router and sets a waiting time between the boot loader coming up and the device itself booting. Reboot the device to enable these changes.

Telnet

Details on how to telnet into RedBoot are found in the OpenWrt Wiki

Ethernet

There are a few tricks for getting access to RedBoot via Ethernet without a serial connection. With the system up and running you can patch the configuration of the RedBoot bootloader by overwriting the existing configuration with one enabling a boot delay. During this wait the device can be accessed via telnet at 192.168.1.254 Port 9000.

As with SSH access, the firmware version of your Fonera determines how you can enable Ethernet access. For firmware versions later than 7.1, use the following RedBoot config. This can be done with a direct download as shown below, or by using SCP to place the out.hex file in the /tmp directory.

root@OpenWRT:~# wget http://ipkg.k1k2.de/hack/out.hex
root@OpenWRT:~# mtd -e "RedBoot config" write out.hex "RedBoot config"
root@OpenWRT:~# reboot

For Fonera firmware revisions prior to 7.1 you will have to install a patched kernel to enable write access to the flash chip and RedBoot configuration.

root@OpenWRT:~# wget http://ipkg.k1k2.de/hack/openwrt-ar531x-2.4-vmlinux-CAMICIA.lzma
root@OpenWRT:~# mtd -e vmlinux.bin.l7 write openwrt-ar531x-2.4-vmlinux-CAMICIA.lzma vmlinux.bin.l7
root@OpenWRT:~# reboot

Installing on RedBoot devices

AP51-EasyFlash Utility

There are two versions of the AP51-EasyFlash Utility, respectively for Windows and Linux. The following example is utilizing the Linux version, on a Debian system. The above mentioned enabling of RedBoot access via ethernet is required for this procedure.

Before proceding to the actual installation it is needed to download the AP51-Easyflash utility and the pre-compiled files which are to be flashed onto the Atheros SoC devices (both Fonera and Meraki Mini). After downloading the correct files (a kernel and the needed root-file-system) they are placed in the same directory as the flash utility.

The Easyflash utility has to be executable, and to ensure that the various interfaces are active it is recommended to use either a cross-over cable or a switch. The Easyflash syntax is quite simple:

root@Debian:~# ./easyflash eth1 openwrt-atheros-vmlinux.lzma openwrt-atheros-root.squashfs

It simply says; run the program while using the indicated interface and upload/flash with the mentioned files.

Manual flashing

It should be possible to re-flash Fonera devices with firmware versions above 7.1 directly - but, it should always be done with a bit of caution, and only after having enabled ethernet access to the RedBoot bootloader (in case of having to recover the device.

The actual process of manual re-flash is probably something which is more aimed at users who already have a current Kamikaze system installed. Then the process is as follows:

root@OpenWRT:~# wget http://downloads.x-wrt.org/xwrt/kamikaze/8.09/atheros/openwrt-atheros-vmlinux.lzma
root@OpenWRT:~# wget http://downloads.x-wrt.org/xwrt/kamikaze/8.09/atheros/openwrt-atheros-root.squashfs
root@OpenWRT:~# mtd -e vmlinux.bin.l7 write openwrt-atheros-vmlinux.lzma vmlinux.bin.l7
root@OpenWRT:~# mtd -e rootfs write openwrt-atheros-root.squashfs rootfs
root@OpenWRT:~# reboot

Flashing with RedBoot

You can access the device using the serial or the telnet connection. Both methods use the similar RedBoot command except that you will need to append the -m <protocol> parameter to the load command when using the serial (or the http) connection.

Serial access

You need to setup the highest serial port speed first to be able load files in a reasonable time. If your terminal application does not feature the automatic speed detection, set the new port speed after the update your settings prompt. If you will not manage to change it in about 5 seconds, the speed setting returns back to the previous value.

Do not update the RedBoot non-volatile configuration after setting the serial port speed if you have not compiled your own kernel with modified console settings.

RedBoot> baudrate -b 115200
Baud rate will be changed to 115200 - update your settings
Baud rate changed to 115200 - continue (y/n)? y
Update RedBoot non-volatile configuration - continue (y/n)? n

The redboot features only the xmodem or the ymodem serial protocols. You will need to append your preferred protocol in the subsequent load commands (-m ymodem or -m xmodem).

Telnet access

Setup with a switch or router between a computer and Fonera, as a way of ensuring active network-interfaces. If you have problems with hitting the right connection window, then use this Perl Script instead.

perl redboot.pl <fonera_ip>

You can also use other methods for establishing the telnet connection. One example would be the Telnet Into RedBoot NSLU2 wiki article.

When the telnet connection is established you will se the RedBoot prompt:

RedBoot>

Hereafter it is easy to configure your router's address, the subnet mask and the address of the TFTP/HTTP server.

RedBoot> ip_addr -l 192.168.1.254/24 -h 192.168.1.23
IP: 192.168.1.254/255.255.255.0, Gateway: 0.0.0.0
Default server: 192.168.1.23

Initialize the RedBoot's FIS

Initialize the RedBoot's Flash Image System by the command:

RedBoot> fis init

You can list the flash image directory by the command:

RedBoot> fis list
Name              FLASH addr  Mem addr    Length      Entry point
RedBoot           0xA8000000  0xA8000000  0x00030000  0x00000000
... available free space ...
FIS directory     0xA87E0000  0xA87E0000  0x0000F000  0x00000000
RedBoot config    0xA87EF000  0xA87EF000  0x00001000  0x00000000

Notice the free space between the RedBoot and the FIS directory entries.

Loading and flashing the kernel

Use the predefined alias %{FREEMEMLO} for the start of the free memory parameter and load the kernel image into the router's RAM. The meaning of parameters: -r - raw binary data, -v - verbose, -b - memory location, -m - the protocol: ymodem/xmodem or http or tftp (default is tftp when omitting the protocol parameter).

Serial:

RedBoot> load -r -v -b %{FREEMEMLO} openwrt-atheros-vmlinux.lzma -m <ymodem/xmodem/http/tftp>

Ethernet:

RedBoot> load -r -b %{FREEMEMLO} openwrt-atheros-vmlinux.lzma

Note: If you want to directly start the loaded kernel, you need to load it to the memory location 0x80041000 specified at the build time instead of the %{FREEMEMLO} alias.

The RedBoot will show you the used protocol:

Using default protocol (TFTP)

Or when using the serial protocol:

xyzModem - CRC mode, 6146(SOH)/0(STX)/0(CAN) packets, 3 retries

The RedBoot will show you also the information about loaded file after a successful download:

Raw file loaded 0x80040800-0x801007ff, assumed entry at 0x80040800

You can verify the checksum and the length of the file in memory:

RedBoot> cksum
Computing cksum for area 0x80040800-0x80100800
POSIX cksum = 2702583058 786432 (0xa1162512 0x000c0000)

against the original file:

[root@tftpserver tftpboot]# cksum openwrt-atheros-vmlinux.lzma
2702583058 786432 openwrt-atheros-vmlinux.lzma

to be sure that the loaded file is not damaged and you are flashing the proper content.

Create the kernel flash image by the command (where -r - the load address, -e - the entry address, vmlinux.bin.l7 - name of the kernel image entry as used by the boot script):

RedBoot> fis create -r 0x80041000 -e 0x80041000 vmlinux.bin.l7
... Erase from the actual flash memory addresses...
... Program from the actual flash memory addresses...
RedBoot>

You will have to wait approx. 1 min until the kernel has been written to the flash.

Note: The atheros-2.6 kernel is built with the load and entry address set at 0x80041000. After rebooting the IP address will be 192.168.1.1 (and not 192.168.1.254 as it was during RedBoot).

And verify the creation of the kernel image:

RedBoot> fis list
Name              FLASH addr  Mem addr    Length      Entry point
RedBoot           0xA8000000  0xA8000000  0x00030000  0x00000000
vmlinux.bin.l7    0xA8030000  0x80041000  0x000C0000  0x80041000
...  available free space ...
FIS directory     0xA87E0000  0xA87E0000  0x0000F000  0x00000000
RedBoot config    0xA87EF000  0xA87EF000  0x00001000  0x00000000

Computing the remaining free space size

You will need to compute the remaining free space to use for your jffs2 partition. The size parameter is required for the rootfs creation command. If you do not provide the size parameter, there will be no space for the jffs2 partition and either the kernel will hang after booting unable to switch mini_fo to the jffs2 partition or your filesystem will be read only.

Use the fis free command to show the unused flash memory space:

RedBoot> fis free
  0xA80F0000 .. 0xA87E0000

Use any calculator able to handle hexadecimal numbers and compute the difference between the end and the start of the free space (A87E0000 - A80F0000 = 6F0000). For example by using the command line arbitrary precision calculator:

server:~# bc
obase=16
ibase=16
A87E0000 - A80F0000
6F0000

The emphasized text is the value of the size parameter for the image creation command below.

Loading and flashing the rootfs

Use the predefined alias %{FREEMEMLO} for the start of the free memory parameter and load the kernel image into router. Parameters meaning: -r - raw binary data, -v - verbose, -b - memory location, -m - the protocol: ymodem/xmodem, http or tftp (default is tftp when omitting the protocol parameter).

Serial:

RedBoot> load -r -v -b %{FREEMEMLO} openwrt-atheros-root.squashfs -m <ymodem/xmodem/http/tftp>

Ethernet:

RedBoot> load -r -b %{FREEMEMLO} openwrt-atheros-root.squashfs

The RedBoot will show you the used protocol:

Using default protocol (TFTP)

Or when using the serial protocol:

xyzModem - CRC mode, 6146(SOH)/0(STX)/0(CAN) packets, 3 retries

The RedBoot will show you also the information about loaded file after a successful download:

Raw file loaded 0x80040800-0x803207ff, assumed entry at 0x80040800

You can verify the checksum and the length of the file in memory:

RedBoot> cksum
Computing cksum for area 0x80040800-0x80320800
POSIX cksum = 229348867 3014656 (0x0dab9603 0x002e0000)

against the original file:

[root@tftpserver tftpboot]# cksum openwrt-atheros-root.squashfs 
229348867 3014656 openwrt-atheros-root.squashfs

to be sure that the loaded file is not damaged and you are flashing the proper content.

Create the rootfs flash image using the previously computed free space size parameter (-l - the length of the image). Substitute your own value of the size parameter according to your free space size.

RedBoot> fis create -l 0x6F0000 rootfs
... Erase from the actual flash memory addresses...
... Program from the actual flash memory addresses...
RedBoot>

You will have to wait approx. 4 min until the initial file system has been written to the flash.

And verify the creation of the rootfs image and its size (Length):

RedBoot> fis list
Name              FLASH addr  Mem addr    Length      Entry point
RedBoot           0xA8000000  0xA8000000  0x00030000  0x00000000
vmlinux.bin.l7    0xA8030000  0xA8030000  0x000C0000  0xA8030000
rootfs            0xA80F0000  0x80040800  0x006F0000  0x80040800
FIS directory     0xA87E0000  0xA87E0000  0x0000F000  0x00000000
RedBoot config    0xA87EF000  0xA87EF000  0x00001000  0x00000000

Notice that there is no free space remaining in the flash memory.

Booting the new system

Load the kernel from the flash memory and execute it:

RedBoot> fis load -l vmlinux.bin.l7
RedBoot> exec

or restart the router:

RedBoot> reset
RedBoot's booting messages
kernel's booting messages
Please press Enter to activate this console.

Notes

  • The order of the vmlinux and the rootfs images is optional. This guide used the logical order as seen in most devices.
  • The RedBoot does not honour locking of an image. You are not protected against writing to the wrong memory addresses with the create command. Be sure not to use any of the hardcoded flash memory addresses from articles around the Internet. You might damage the RedBoot image.
  • Do not touch the RedBoot image in any case. All other parts of the flash image directory can be recreated by the RedBoot's commands. When you damage the RedBoot itself, you can revive the malfunctioning board only by using the JTAG cable.
  • You can use the CoreUtils binaries from the GnuWin32 project to be able to use the cksum in the Windows environment. See CoreUtils

Updating from WhiteRussian

An update from OpenWrt WhiteRussian to Kamikaze is a complete re-installation of the system, all existing configuration and setup will be erased.

The upgrade is easily done via the mtd command or the default OpenWrt webif - both work well.

When updating from WhiteRussian and wanting to use the X-Wrt webif package, it is advisable to use the pre-compiled firmware image based on the present Kamikaze release. These images - and you have to chose the correct image for your platform - are available from the X-Wrt Kamikaze download. You should choose an image from the most recent release directory.

In the case of starting out with a barebone Kamikaze install there is a small and basic instruction to commandline configuration here. The OpenWrt Kamikaze system is a very good learning platform, and it can only be recommended to teach yourself some of the common Linux/unix skills though direct interaction. Likewise, when you change settings through the X-Wrt webif try to login via SSH and take a look at the changes in the config files (just type less and the filename, and then 'q' when you'r finished reading)

Updating OpenWrt Kamikaze 8.09

The X-Wrt webif is a complete webinterface package it is conveniently added to an existing Kamikaze version through a simple set of opkg commands.

The examples below are show an installation of X-Wrt webif on a Broadcom device (brcm-2.4) for a 2.6 kernel, change the directories with 'brcm-2.4' to 'brcm47xx'.

Mission:

You have installed Kamikaze 8.09 on your hardware from the OpenWRT site and want the x-wrt web interface instead of the default luci interface.

Changing opkg.conf

So add to the end of the '/etc/opkg.conf':

src X-Wrt http://downloads.x-wrt.org/xwrt/kamikaze/8.09/brcm-2.4/packages
root@OpenWrt:~#  echo "src X-Wrt http://downloads.x-wrt.org/xwrt/kamikaze/8.09/brcm-2.4/packages" >> /etc/opkg.conf

'/etc/opkg.conf' now looks like:

src/gz snapshots http://downloads.openwrt.org/kamikaze/8.09/brcm-2.4/packages
dest root /
dest ram /tmp
lists_dir ext /var/opkg-lists
overlay_root /
src X-Wrt http://downloads.x-wrt.org/xwrt/kamikaze/8.09/brcm-2.4/packages

Clean up

Now you should perform an update, otherwise a 'Segmentation fault' may occur.

 root@OpenWrt:~# opkg update

Since 8.09 from OpenWRT.org comes installed with the luci web interface by default, this must be removed first, type :

opkg remove -recursive luci-*

Install

Finally, to install type:

root@OpenWrt:~# opkg update
root@OpenWrt:~# opkg install webif

X-Wrt stable or daily builds

  • 8.09 is the first release with a stable webif build, kamikaze webif status is here. Please help us improve the webif by testing and reporting bugs.
Personal tools