OpenWrt Forum Archive

Topic: [Solved] OpenWrt 12.09 on usb stick with dockstar

The content of this topic has been archived on 24 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hello everyone

I'm new here and a beginner with openwrt, so I apologize for asking simple questions. But I'm familiar with Linux at least

I'd like to install openwrt from precompiled binairies on an external USB stick. My Dockstar is still unaltered (original firmware) and I don't plan to use a serial connection. I'd like to keep it simple for now and to do some testing without breaking anything on the internal flash memory

I've read the dedicated wiki page, but I'm a bit lost :
- "installing without serial" begins with a "then"...
- I don't understand the differences between the 2 suggested flash layouts (the pros and cons)
- there seems to be a problem with the last openwrt version and the bootloader size, as seen here

As far as I can understand, I have to :
- make a backup first smile
- untar rootfs.tar.gz on my usb stick (which should be correctly formatted and partitionned before)
- install u-boot on mtd0 (found in http://downloads.openwrt.org/attitude_a … d/generic/), but I don't know how and which file to use (.bin or .kwb)
- configure u-boot to start on usb first (if not the default config)

If I'm correct, I shouldn't use uImage or modify mtd1/2/3 (but where is the kernel then ???)

Thanks for your help

(Last edited by geogiraux on 22 May 2013, 10:49)

hi,

i also have a dockstar running openwrt.
when i started working on it i had a lot of experience with openwrt but i ended up deleting the bootloader - luckily the store accepted by unit for warranty (although had a broken case) and i received a new unit.
second time i was more carefull and eneded up with a great firmware witch i use for torrent downloading, ftp, dlna and samba server running 24/7.

first you need to make sure you have newer bootloader (uboot) with netconsole from:
http://projects.doozan.com/uboot/

before trying openwrt i recommend makeing sure you have access to netconsole :
http://forum.doozan.com/read.php?3,14,14

I recommend using the 2 stage bootloader (after you upgraded your bootloader as above, as it is safer for you and you'll be able to try out other OS like debian and arch linux (also great but prone to usb FS corruption at power failures).
instructions are (from netconsole - or serial) install kernel:

mw 0x6400000 0xffff 0x300000
tftpboot 0x6400000 openwrt-kirkwood-uImage
nand erase 0x200000 0x300000
nand write.e 0x6400000 0x200000 0x300000

then rootfs

mw 0x6400000 0xffff 0x200000
tftpboot 0x6400000 openwrt-kirkwood-Dockstar-jffs2-128k.img
nand erase 0x500000 0xfb00000
nand write.e 0x6400000 0x500000 0x200000

i'm not very good at explaining so i'll rather let you read through and i'll answer only specific questions.
if i don't reply on this thread you can PM me.

good luck!

Thanks a lot

To make things clearer to me :
- these commands will install openwrt directly on the embedded flash memory if I'm right. Is it safe ? Is it easy then to change rootfs (add packages or change settings) ? I wanted to install kernel and/or rootfs on a external usb stick
- you recommand using netconsole, which is a serial connection over an IP connection
- the kirkwood-u-boot .bin file can be used either as a single bootloader or as a second stage bootloader. You recommand the second solution, all I have to do is to use the correct memory emplacement. But are the values on the wiki correct ? I thought there was a problem with the size of the bootloader with openwrt 12.09 uboot file, refering to the mailing list
- I have to format the actual design of the flash memory : I have to split the actual mtd1 into 2 partitions : is there any special commands to apply before or are they "included" with writing the uboot file

I'm asking myself if the boot sequence is not too tricky for me...

(Last edited by geogiraux on 15 May 2013, 17:32)

hi,

-installing on the flash memory was safe enough for me, the second time smile but i cannot help you with instructions on installing on the usb drive
-netconsole is very helpfull - there is always as small chance of screwing with the boodloader commands and stop the boot cycle
-i'm using the http://downloads.openwrt.org/attitude_a … d/generic/ files as the only one that worked for me last time I atempted an upgrade - it's working stable for more than 6 moths now
-the instructions from http://projects.doozan.com/uboot/ worked great from ssh console of dockstar pogoplug - all the "magic" is included in that script

-the boot sequence is a tricky thing to learn - i only figure it out by a few trial/error cycles smile

let's explain my own:

bootcmd=run pogo_bootcmd; usb start; run usb_bootcmd; usb stop; run bootcmd_ubi; reset;
pogo_bootcmd=nand read.e 0x800000 0x100000 0x80000; go 0x800000
usb_bootcmd=run usb_init; run usb_set_bootargs; run usb_boot
bootcmd_ubi=run set_bootargs_ubi; ubi part data; ubifsmount rootfs; ubifsload 0x
800000 /boot/uImage; ubifsload 0x1100000 /boot/uInitrd; bootm 0x800000 0x1100000

it first tries to boot from the second stage bootloader (openwrt) - address 0x100000
if that doesn't work out it will try to boot from usb (usb_bootcmd)
if that doesn't work either it will try to boot from the last flash mtd partition - debian recovery enviromenment:
http://forum.doozan.com/read.php?4,3896

i hope these few lines made things more clear to you smile

(Last edited by maurer on 16 May 2013, 06:59)

maurer wrote:

I recommend using the 2 stage bootloader (after you upgraded your bootloader as above, as it is safer for you and you'll be able to try out other OS like debian and arch linux (also great but prone to usb FS corruption at power failures).

I will ONLY recommend to use a 2-stage boot with the original/factory + the Doozan bootloaders. If the original bootloader has been replaced with the Doozan bootloader, there is no need to do a 2-stage boot.

OTOH, if using Doozan bootloader with OpenWRT, one needs to know that the original setup looks for a /boot/uImage (Linux kernel naming scheme) and NOT /boot/openwrt-kirkwood-uImage (OpenWRT kernel naming scheme) file. To make sure the Doozan bootloader works with OpenWRT kernel image, one can do:

  • either replace the /boot/uImage with /boot/openwrt-kirkwood-uImage in the boot scripts as shown below. Notice, the boot scripts were literally copied from the above post by maurer. I didn't take my time to verify it, except to replace uImage with openwrt-kirkwood-uImage.

  • or rename the OpenWRT kernel image placed in the /boot directory from openwrt-kirkwood-uImage to uImage.

I strongly suggest the former approach. The later approach will become nuisance in the process of updating the USB storage with a different (new) OpenWRT.

bootcmd=run pogo_bootcmd; usb start; run usb_bootcmd; usb stop; run bootcmd_ubi; reset;
pogo_bootcmd=nand read.e 0x800000 0x100000 0x80000; go 0x800000
usb_bootcmd=run usb_init; run usb_set_bootargs; run usb_boot
bootcmd_ubi=run set_bootargs_ubi; ubi part data; ubifsmount rootfs; ubifsload 0x
800000 /boot/openwrt-kirkwood-uImage; ubifsload 0x1100000 /boot/uInitrd; bootm 0x800000 0x1100000

As with booting from an external USB storage, the USB storage first needs be prepared as follows:

  1. Delete the existing partition and recreate a Linux partition. I use cfdisk utility to achieve this. In my case, I created two partition with the 1st as a Linux partition and the 2nd as a swap partition.

  2. Once a Linux partition has been created, it needs be formatted. I formatted my Linux partition to an EXT3 format using a mkfs.ext3 on my AMD64 computer running on an OpenSuSE Linux. Whatever format you choose, make sure it is supported by the bootloader.

  3. Once the Linux partition is formatted, use the tar utility to extract the openwrt-kirkwood-rootfs.tar.gz file to the newly created Linux partition.

  4. Then, use mkdir to create the /boot directory on the newly created/formatted Linux partition.

  5. Once you have done this, use the cp utility to copy the openwrt-kirkwood-uImage file to the /boot directory on the newly created/formatted Linux partition. If you haven't modified the Doozan's boot scritps as shown above, make sure you take into consideration to rename the openwrt-kirkwood-uImage file to uImage. Otherwise, the Doozan bootloader won't be able to find the uImage file to boot.

  6. That's all there to it.

Thans a lot to both of you for your time and your detailled explanations

Since it seemed a bit clearer to me, I got myself in the whole stuff and... nothing : I actually set up my usb key as mazilo said, installed Doozan's bootloader (after backing up the orginal firmware) and changed arcNumber and the kernel name in the default boot sequence. But my dockstar keeps booting onto its original firmware ! Which is actually not that bad, since it still works !

In order to understand what was happening during the boot (can not find the kernel or the usb key for instance), I tried to set up the netconsole thing, but I couldn't manage to do so, although I carefully followed this post.

Would you have any idea by chance ?

If you have a USB/Serial Console cable, you will be able to see what is going on during boot. I use an old LaFonera FON2100 serial port + a CD audio cable as my serial console cable to interface with any Linux embedded device.

OTOH, if my memory serves me right, I believe u-boot looks for (either openwrt-kirkwood-uImage or uImage) Linux kernel file under /dev/sda1 partition. If so, make sure your USB storage is recognized as /dev/sda and OpenWRT is written on its 1st partition, i.e. /dev/sda1. You can find this information as follows:

  1. Boot your DockStar into its original firmware.

  2. Do a login into your Seagate Dockstar.

  3. Once you are logged into your Seagate DockStar with a shell prompt, insert your USB storage into one of the USB ports on your Seagate DockStar.

  4. Now, do a dmesg on the shell prompt and observe what device your USB storage has been assigned to, i.e. sda, sdb, sdc, etc. Also, you can do a df to see if your USB storage has been automatically mounted. If so, see what device is your USB storage.

  5. If your USB storage is recognized other than /dev/sda and OpenWRT isn't under the 1st partition, i.e. /dev/sdb3, then you will need to change your u-boot settings and/or boot scripts (IIRC) accordingly so that u-boot will be able to locate the openwrt-kirkwood-uImage file.

I don't have a serial cable but I managed to make netconsole works by simply using a Linux box instead of a Windows one for the nc client :-D

And mazilo, you were right about uboot looking for the kernel in the first partition, whatever the name is. Instead of changing the "tricky" uboot configuration, I re-formatted my usb key. I found the solution easier and safer !

Now I can tweak my openwrt install ! Do you have any tips or advice ?

Thanks again

I'm running latest Jeff's Uboot on Dockstar. After unpacking in a Linux VM and syncing OpenWRT .tar.gz from OpenWRT Kirkwood trunk repository to a USB Thumb, adding /boot/openwrt-kirkwood-uImage, and adjusting Uboot environment to boot that uImage from 2-nd partition (since I've installed ArchLinux on 1st), OpenWRT is booting like a champ from the USB Thumb and works great.

However, when using the latest OpenWRT snapshot from http://downloads.openwrt.org/snapshots/trunk/kirkwood/ and going through exact same procedure, OpenWRT is stack on Starting Kernel, as I can see in Netconsole. Any idea if any parameters need be adjusted or added in the kernel to boot it from the USB Thumb? I don't think, there is a need to change anything in Uboot env, since it boots trunk OpenWRT release just fine.

(Last edited by sambul29 on 2 Apr 2014, 00:36)

The discussion might have continued from here.