|
|
|
|
|
|
IJs
|
Joined: 04 Apr 2006 Posts: 4
|
|
|
|
|
|
|
Posted: Tue Apr 04, 2006 2:29 pm Post subject: [HOWTO] USB root using kamikaze 20060205 |
|
|
A
few days ago I decided to abandon Gentoo (painfully slow emerge) on my
ADM5120 board and start with a fresh new distro. Eventually I tried
midge which is really just a clean and up-to-date distribution to run.
After some hacking, I managed to boot kamikaze 20060205 (kernel
2.4.32) from a USB root filesystem, which I really needed for my
router. Making your router boot and use your USB drive just requires a
little more effort.
I'm writing this how-to so you can try it yourself. Note that this is unsupported by midge, and me.. so try on your own risk.
USB-on-kamikaze-20060205 v1.1 by IJs on 06-04-2006
Preparing
Make sure your ADM5120 board has a USB connector. If you happened to have an Edimax BR-6104K or a Sweex LB000021, here's a link on how to add a USB connector.
If you're adding a USB connector, please make sure it works
perfectly before trying to install a USB root filesystem. Try and
compile the original 2.4.18 kernel with USB support first and see if
that works.
Some links to the 2.4.18 kernel: 1 2. (Find out how to compile this for yourself, there's enough info available.)
Compiling kamikaze for tmpfs
* Download the latest (at the time of writing) kamikaze sources: kamikaze-200602050443.tar.bz2.
* Unpack
* Configure as you normally would: "make menuconfig", select all the options you want.
Just remember you can now put way more programs on your root filesystem cause it's not limited to the 2MB flash space anymore.
* Compile by running "make V=99". V=99 makes it run in verbose mode, as you may know.
Beware: it may complain about your final firmware image being too
large at the end (that's why we added V=99 as parameter). Don't worry
about this.
* Go to your kernel directory, and run menuconfig
Code: | # cd build_mipsel/linux-2.4-adm5120/linux-2.4.32/
# make menuconfig |
* Change the bootloader parameters for the kernel.
Code: | General setup --->
[*] Default bootloader kernel arguments
Initial kernel command string:
"console=/dev/ttyS0 panic=30 root=/dev/scsi/host0/bus0/target0/lun0/part1 rw" |
This assumes you have a root filesystem on partition 1 of your USB drive.
* Verify the RAM disk is turned off.
Code: | Block devices --->
< > RAM disk support |
* Build in SCSI, Filesystem and USB support
Code: | SCSI support --->
<*> SCSI support
<*> SCSI disk support
(2) Maximum number of SCSI disks that can be loaded as modules
File systems --->
<*> Ext3 journalling file system support
<*> Second extended fs support
USB support --->
<*> Support for USB
<*> OHCI (Compaq, iMacs, OPTi, SiS, ALi, ...) support
<*> AHCI ADM5120 (USB 1.1) Host controller support (EXPERIMENTAL)
<*> USB Mass Storage support |
* Exit menuconfig and save your configuration
* Applying the necessary
patches. I spent quite some time attempting to hack the kernel with 2.6
patches, since the filesystem structure changed since 2.4.18 and looks
more like a 2.6 one than a 2.4.18 one. Eventually this worked out very
well.
Here are the files you will need to overwrite. Patches itself are
N/A since I didn't backup the original OpenWRT/kamikaze kernel files.
* Compile the kernel. It will generate a vmlinuz file.
* Return to the root directory (openwrt).
Getting your USB harddrive ready to boot
This assumes you have an empty harddrive. If not, well.. figure something out on your own based on the info below, or erase it.
This howto is also based on a USB harddrive,
not a stick. I'm not sure how these sticks work, but I don't think you
can partition them. If I'm right about that, just skip the
partitioning.
If you're stuck with something like a FAT filesystem on your USB
drive, build in FAT support into your kernel and don't even try to turn
it into a ext3 filesystem (mke2fs).
* Hook your USB drive to your Linux host.
* Partition your harddrive:
create one big partition for root (and a smaller one if you're
experienced with fdisk). I'm assuming your harddrive is at /dev/sda.
Code: | # fdisk /dev/sda
(press: n, p, 1, [enter], [enter], w, [enter] to create & write the new partitions) |
* Create a ext3 filesystem and mount your new ext3 partition.
Code: | # mke2fs -j /dev/sda1
# mount /dev/sda1 /mnt/usb |
* Copy kamikaze's root files to your USB drive.
Code: | # cd build_mipsel/linux-2.4-adm5120/root/
# cp -R -f * /mnt/usb/ |
* Enabling USB root booting by hacking some configs.
1. Open up /mnt/usb/etc/midge.conf, and set MIDGE_TYPE=usb.
2. Apply mount_root-usb.patch this patch to /mnt/usb/sbin/mount_root.
Code: | # # patch mount_root < /path/to/mount_root-usb.patch |
* Unmount your USB disk.
Creating the router firmware
From this point you can choose to either upload vmlinuz to your SDRAM with TFTP/XModem, or to flash it into your router.
If you don't want to flash the kernel into your router, you can skip the following steps and enjoy your USB-root-enabled router!
* Switch to your kamikaze linux kernel directory (build_mipsel/linux-2.4-adm5120/linux-2.4.32/).
* Getting and compiling mksyshdr. Skip this step if you already have a mksyshdr program.
Code: | # wget http://modpro.be/adm5120/mksyshdr.c
# gcc mksyshdr.c -o mksyshdr && chmod 755 mksyshdr |
* Turning your vmlinuz into a "flashable" firmware.
Code: | # ./mksyshdr csys vmlinuz
# cat csys vmlinuz > firmware.img |
* You can now upload/flash firmware.img to your router.
Testing your new kernel & USB filesystem
Now it's time to see if all the above worked. Just boot up your
router, load or flash in vmlinuz or the firmware you created above, and
see.
This is what I get with my USB->IDE2.5 converter and 2.5" IBM harddrive:
Code: | ...
LED & GPIO Driver v1.1
VFS: Cannot open root device "scsi/host0/bus0/target0/lun0/part1" or 00:00
VFS: Retrying.
VFS: Mounted root (rootfs filesystem).
do_mounts.c: retrying in 1s.
hub.c: new USB device adm5120-hcd-2, assigned address 2
Manufacturer: Myson Century, Inc.
Product: USB Mass Storage Device
SerialNumber: 100
scsi0 : SCSI emulation for USB Mass Storage devices
Vendor: IBM-DTNA Model: -22160 Rev: A50G
Type: Direct-Access
ANSI SCSI revision: 02
Attached scsi disk sda at scsi0, channel 0, id 0, lun 0
SCSI device sda: 4233600 512-byte hdwr sectors (2168 MB)
Partition check:
/dev/scsi/host0/bus0/target0/lun0:<7>usb-storage: queuecommand() called
p1 p2
kjournald starting. Commit interval 5 seconds
EXT3 FS 2.4-0.9.19, 19 August 2002 on sd(8,1), internal journal
EXT3-fs: mounted filesystem with ordered data mode.
VFS: Mounted root (ext3 filesystem).
Mounted devfs on /dev
... |
Thanks goes out to all the guys that made this hack possible.
Hope it does the trick for you, cause it sure did for me
/me alt+tabs back to his adm5120 ircII client _________________ Developer of the first and best multiplayer modification for Grand Theft Auto III, Vice City and San Andreas: Multi Theft Auto.
Last edited by IJs on Thu Apr 06, 2006 10:49 am; edited 3 times in total |
|
|
Back to top |
|
|
|
|
|
|
|
|
|
|
lao
|
Joined: 22 Nov 2005 Posts: 32 Location: Kiev |
|
|
|
|
|
|
Posted: Thu Apr 06, 2006 8:06 am Post subject: |
|
|
It
does not work. First in line 45 files usb-shci.c to be *include
<asm/am5120/adm5120.h>, instead of *include
<asm/adm5120/adm5120.h>. Secondly the same file is not compiled
with a message:
Code: | host/usb-shci.c: In function `ahci_hc_interrupt':
host/usb-shci.c:2424: warning: assignment discards qualifiers from pointer target type
host/usb-shci.c: In function `ahci_ahb_probe':
host/usb-shci.c:2628: error: `ADM5120_USBHOST_IRQ' undeclared (first use in this function)
host/usb-shci.c:2628: error: (Each undeclared identifier is reported only once
host/usb-shci.c:2628: error: for each function it appears in.)
make[3]: *** [host/usb-shci.o] Error 1
make[3]: Leaving directory `/opt/build/openwrt/build_mipsel/linux-2.4-adm5120/linux-2.4.32/drivers/usb'
make[2]: *** [first_rule] Error 2
make[2]: Leaving directory `/opt/build/openwrt/build_mipsel/linux-2.4-adm5120/linux-2.4.32/drivers/usb'
make[1]: *** [_subdir_usb] Error 2
make[1]: Leaving directory `/opt/build/openwrt/build_mipsel/linux-2.4-adm5120/linux-2.4.32/drivers'
make: *** [_dir_drivers] Error 2 |
|
|
|
Back to top |
|
|
|
|
|
|
|
|
|
|
IJs
|
Joined: 04 Apr 2006 Posts: 4
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
gedoe
|
Joined: 05 Apr 2006 Posts: 13
|
|
|
|
|
|
|
Posted: Mon Apr 10, 2006 12:58 pm Post subject: |
|
|
Just a quick question....
Will I need the new bootloader on my edimax to make this work or does
it work with the standard one? As per this site the kamikaze does not
work with the normal bootloader, but the problem seems to be the
mounting of the root fs, and that comes from USB ?
If you havn't tried with the current bootloader then I will post my success (or failure ) |
|
|
Back to top |
|
|
|
|
|
|
|
|
|
|
vlad Site Admin
|
Joined: 07 Aug 2005 Posts: 572
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
gedoe
|
Joined: 05 Apr 2006 Posts: 13
|
|
|
|
|
|
|
Posted: Thu Apr 13, 2006 11:08 am Post subject: |
|
|
Okay it works thanx to the patch. I am now running MIDGE from USB
(I used to be running a USB kernel that booted a woody debian.
Now I will configure my needs....
THANX for the howto and the patch |
|
|
Back to top |
|
|
|
|
|
|
|
|
|
|
vlad Site Admin
|
Joined: 07 Aug 2005 Posts: 572
|
|
|
|
|
|
|
Posted: Thu Apr 13, 2006 1:28 pm Post subject: |
|
|
mipsel debian on USB flash?
IJs: good work! |
|
|
Back to top |
|
|
|
|
|
|
|
|
|
|
IJs
|
Joined: 04 Apr 2006 Posts: 4
|
|
|
|
|
|
|
Posted: Mon Apr 17, 2006 12:46 pm Post subject: |
|
|
No
problem. It's pretty cool as you got a lot more (permanent and mobile)
storage. Pretty much boosts the functionality of your embedded device.
By the way.. you can also chroot into some debian/gentoo/whatever
distro on your USB device. Too bad mine only has 16MB of memory though. _________________ Developer of the first and best multiplayer modification for Grand Theft Auto III, Vice City and San Andreas: Multi Theft Auto. |
|
|
Back to top |
|
|
|
|
|
|
|
|
|
|
Sunspot
|
Joined: 17 Mar 2006 Posts: 34
|
|
|
|
|
|
|
Posted: Thu Apr 20, 2006 8:24 am Post subject: |
|
|
Could
the working firmware for the router and USB stick be made available?
(for the original boot loader) There are learners/users who would
appreciate that. I could host the code if needed.
http://www.sunspot.co.uk/Projects/Sweex.htm |
|
|
Back to top |
|
|
|
|
|
|
|
|
|
|
robert13
|
Joined: 19 Mar 2006 Posts: 8 Location: Amsterdam, The Netherlands |
|
|
|
|
|
|
Posted: Sun Apr 23, 2006 3:39 pm Post subject: |
|
|
When I follow the manual ans execute "make V=99" the first time, I get an error.
Code: | make[3]: Entering directory `/home/rgerritsen/trunk/openwrt/target/lzma'
/home/rgerritsen/trunk/openwrt/scripts/download.pl /home/rgerritsen/trunk/openwr
t/dl lzma406.zip a09378411cba5f786b5c49c9c58496df http://www.7-zip.org/dl
--13:43:46-- http://www.7-zip.org/dl/lzma406.zip
=> `-'
Resolving www.7-zip.org... 69.73.175.23
Connecting to www.7-zip.org[69.73.175.23]:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 185,934 [application/zip]
100%[====================================>] 185,934 222.49K/s
13:43:47 (221.88 KB/s) - `-' saved [185934/185934]
unzip -q /home/rgerritsen/trunk/openwrt/dl/lzma406.zip -d /home/rgerritsen/trunk
/openwrt/build_mipsel/lzma
patch -d /home/rgerritsen/trunk/openwrt/build_mipsel/lzma -p1 < lzma-406-zlib-st
ream.patch
patching file SRC/7zip/Compress/LZMA/LZMADecoder.cpp
patching file SRC/7zip/Compress/LZMA/LZMADecoder.h
patching file SRC/7zip/Compress/LZMA_Lib/makefile
patching file SRC/7zip/Compress/LZMA_Lib/ZLib.cpp
touch /home/rgerritsen/trunk/openwrt/build_mipsel/lzma/.unpacked
make[3]: Leaving directory `/home/rgerritsen/trunk/openwrt/target/lzma'
make -C lzma compile
make[3]: Entering directory `/home/rgerritsen/trunk/openwrt/target/lzma'
make -C /home/rgerritsen/trunk/openwrt/build_mipsel/lzma/SRC/7zip/Compress/LZMA_
Lib
make[4]: Entering directory `/home/rgerritsen/trunk/openwrt/build_mipsel/lzma/SR
C/7zip/Compress/LZMA_Lib'
g++ -O3 -Wall -c ZLib.cpp
ZLib.cpp:28:18: zlib.h: No such file or directory
ZLib.cpp:53: error: parse error before `*' token |
Don't you have this problem? |
|
|
Back to top |
|
|
|
|
|
|
|
|
|
|
vlad Site Admin
|
Joined: 07 Aug 2005 Posts: 572
|
|
|
|
|
|
|
Posted: Mon Apr 24, 2006 4:51 pm Post subject: |
|
|
robert13 wrote: |
Don't you have this problem? |
You should install zlib-dev package |
|
|
Back to top |
|
|
|
|
|
|
|
|
|
|
Kevin.Route
|
Joined: 25 Apr 2006 Posts: 4
|
|
|
|
|
|
|
Posted: Wed Apr 26, 2006 12:38 am Post subject: |
|
|
I
am also looking for a "sane" toolchain/kernel/userland source for the
BR6104KP router that will allow me to seriously play with it (2 serial
ports, usb mass storage).
I downloaded the kamikaze-200602050443.tar.bz2 and tried to "make" it without success.
toolchain/install seems to be done,
target/compile also,
but
package/compile fails in a strange way
Working on a Redhat 9, first I did "gmake menuconfig", was ok, than "gmake":
This begins with
/mnt/big/jk/embedded/midge/kamikaze/kamikaze-200602050443/trunk/openwrt/build_mipsel/iproute2-2.6.11-050330/Makefile
# For now disable compiling of the misc directory because it seems to fail
rm -rf /mnt/big/jk/embedded/midge/kamikaze/kamikaze-200602050443/trunk/openwrt/build_mipsel/iproute2-2.6.11-050330/misc
than a few lines later
touch: creating
`/mnt/big/jk/embedded/midge/kamikaze/kamikaze-200602050443/trunk/openwrt/build_mipsel/stamp/.iproute2-prepare':
No such file or directory
and indeed there is no stamp dir in build_mipsel
and finally
gmake[3]: Entering directory `/mnt/nbig/jk/embedded/midge/kamikaze/kamikaze-200602050443/trunk/openwrt/package/iptables'
Makefile:33:
/mnt/big/jk/embedded/midge/kamikaze/kamikaze-200602050443/trunk/openwrt/build_mipsel/linux/.config:
No such file or directory
gmake[3]: *** No rule to make target
`/mnt/big/jk/embedded/midge/kamikaze/kamikaze-200602050443/trunk/openwrt/build_mipsel/linux/.config'.
Stop.
and again, there is no linux dir (nor linux-2.4.32) in build_mipsel (there is one in toolchain_build_mipsel)
Any help will be very much appreciated |
|
|
Back to top |
|
|
|
|
|
|
|
|
|
|
vlad Site Admin
|
Joined: 07 Aug 2005 Posts: 572
|
|
|
|
|
|
|
Posted: Wed Apr 26, 2006 7:17 am Post subject: |
|
|
please run:
Code: |
make distclean
make V=99
|
and post errors |
|
|
Back to top |
|
|
|
|
|
|
|
|
|
|
Kevin.Route
|
Joined: 25 Apr 2006 Posts: 4
|
|
|
|
|
|
|
Posted: Wed Apr 26, 2006 7:58 am Post subject: |
|
|
Forgot to tell you, this is exactly what I did (gmake distclean) before
gmake menuconfig
and
gmake V=99
(gmake is make on redhat9) |
|
|
Back to top |
|
|
|
|
|
|
|
|
|
|
vlad Site Admin
|
Joined: 07 Aug 2005 Posts: 572
|
|
|
|
|
|
|
Posted: Wed Apr 26, 2006 8:08 am Post subject: |
|
|
please try delete your whole directory and unpack archive again
(or if you have skills on linux rm -rf build_mipsel) |
|
|
Back to top |
|
|
|
|
|
Page 1 of 3 |
All times are GMT Goto page 1, 2, 3 Next
|
|
|
|
|
|
|
|
|
|
|
Stop watching this topic
|
You can post new topics in this forum You can reply to topics in this forum You can edit your posts in this forum You can delete your posts in this forum You can vote in polls in this forum
|
|
|
|
|
|
|
|
|
|
|