
This directory contains a small OpenWrt system for the eb904.

The important file is the "initramfs" system in file
	openwrt-lantiq-xrx200-lantiq_vgv952cjw33-e-ir-initramfs-kernel.bin

Main purpose of this initramfs system:
- Recover a bricked box with the reset-during-power-on procedure
- Examine and modify any part of the flash memory
  (as the system runs purely in RAM and dos not need flash when running)
- Assist flashing the box with other firmware
- For easy OpenWrt upgrading via your browser, it contains a LuCI interface with Webserver

What is not included:
- DSL software
- WiFi software



How to boot the initramfs system
--------------------------------
Use the reset-during-power-on recovery procedure:

- Connect the eb904 to a tftp server which listens on ip address 192.168.2.100.

- Let the tftp provide a file called "fullimage.img" which actually is the initramfs system.
  This means: copy file openwrt-lantiq-xrx200-lantiq_vgv952cjw33-e-ir-initramfs-kernel.bin
  to the tftp server's directory and name it "fullimage.img".

- If switched on, turn off the eb904. Turn it on while pressing the reset button (next to the
  power jack). Keep it pressed for about 8 seconds, then release it.

  This makes U-Boot request file "fullimage.img" from the TFTP server and load it into RAM.
  Depending on your U-Boot version, continue with A or B:

===> A.) If the box contains the original vendor's U-Boot, or an older U-Boot provided by OpenWrt people:

- U-Boot then flashes the loaded data to partition mtd2 which is usually called "kernel".

  Partitions mtd13 ("roots2"), and mtd14 ("kernel2") are erased too.
  Partition mtd1 (called "rootfs" or "rootfs1") is also erased and then a dummy file system is
  copied into it. After all these operations, the U-Boot waits, hanging in a loop.
  
- So after about minute, turn off th eb904, then turn it on again.

  The U-Boot then loads the newly flashed kernel from flash partition mtd2 to RAM and starts it.
  As this kernel contains an initram file system, the booted system runs purely from RAM.


===> B.) If the box contains a newer U-Boot built for the eb904:

- U-Boot realizes that the loaded data in RAM only contains an initramfs system without a real
  rootfs image. So it simply starts the loaded kernel without flashing anything.


===> After having performed step A or B, you need to wait one minute or two. Then you can
  connect to the eb904 either with a browser (http://192.168.1.1) or with ssh (root@192.168.1.1).




What to do with a running initramfs system
------------------------------------------
Here are two examples:


Task: flash a real 'production' OpenWrt system via Sysupgrade process

- Use the browser to connect to http://192.168.1.1

- Login (no password needs to be set up)

- Use menu item  System => Backup / Flash Firmware



Task: Replace U-Boot by a newer version:

- Copy the new U-Boot version to the eb904:
  scp  u-boot.lq  root@192.168.1.1:/tmp/

- Note the checksum of the new U-Boot at the source machine:
  md5sum u-boot.lq

- Open a secure shell (ssh root@192.168.1.1).
  On the eb904 box then enter:
	cd /tmp
	md5sum u-boot.lq		(and verify the checksum at the eb904)
	flash_erase /dev/mtd0 0 0
	nandwrite   /dev/mtd0 u-boot.lq



FAQ
---
Q.: Can every bricked eb904 box be recovered with this system?

A.: Unfortunately not. The methods described in this text need a working U-Boot in partition mtd0.
    If U-Boot is corrupted, however, then the method described here can help:
    https://oldwiki.archive.openwrt.org/inbox/arcadyanastoria/arcadyan_astoria_easybox_904xdsl_r01#debricking


Q.: What about this other file openwrt-lantiq-xrx200-lantiq_vgv952cjw33-e-ir-squashfs-sysupgrade.bin?

A.: Just available for completeness, as both openwrt*.bin files were built together,
    and both files contain the same programs.
    You can flash this file via Sysupgrade. But it is not an initramfs system; it won't run purely
    in RAM. Its root partition will be saved as a UBI volume "rootfs" in partition mtd12. Also there
    will be an overlay UBI volume "rootfs_data" created in mtd12.
    So actually I think it is of no use.


Q.: Why is the initramfs offered here so small - it does not contain DSL or WiFi software?

A.: The reason is that I wanted to have a system...
    - which does not need flash while running
    - which can be loaded via the reset-during-power-on recovery procedure
    - which can be loaded by the original vendor U-Boot, as well as by later U-Boot versions
    In order to satisfy all three requirements, the size must not exceed the size of the
    kernel partition in flash. This is 0x500000 bytes or 5120 kiB.





