OpenWrt Forum Archive

Topic: Reflashing an Ubiquiti Bullet2

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

Hi!

I´m running Kamikaze on a Bullet2. When i try to flash a new firmware via web interface, it tells me that this action is not supported on my platform. Since the Bullet is mounted in a location that is difficult to reach, i am looking for another way to access it than pressing the reset button after a reboot (which makes it accessible via tftp). Does anybody know of any solution? A posting on ubiquiti´s forum has not yielded any answers yet...

Regards G.

Hi.

There are various possibilities. What's your exact version? You can reflash kernel and rootfs via mtd, even with keeping the configuration. Only problem is that the new kernel must not exceed the size of the old one.

# reflash kernel:
mtd -e linux write /tmp/openwrt-atheros-vmlinux.lzma linux

# backup configs:
tar -cz /etc/config /etc/passwd > /tmp/config.tgz

# reflash rootfs:
mtd -e rootfs -j /tmp/config.tgz write /tmp/openwrt-atheros-root.squashfs rootfs

# reboot

Recent 8.09 branch or trunk versions implement a combined image format together with sysupgrade on Atheros now.

Regards,
JoW

jow wrote:

There are various possibilities. What's your exact version?

I have 8.09 Kamikaze r14417
kernel 2.6.26.5 #21
luci 0.8.6

jow wrote:

You can reflash kernel and rootfs via mtd, even with keeping the configuration. Only problem is that the new kernel must not exceed the size of the old one.

# reflash kernel:
mtd -e linux write /tmp/openwrt-atheros-vmlinux.lzma linux

That gives me:
Could not open mtd device: linux
Can´t open decive for writing!

A friend told me i might have to create the device with mkdev or mknod, but couldn´t tell exactly how...

Regards
Gregor

glahue wrote:

A friend told me i might have to create the device with mkdev or mknod, but couldn´t tell exactly how...

Wrong. Look at /proc/mtd to see how your kernel partition is named. Sometimes it is called "linux", sometimes "kernel" or even "vmlinux.bin.l7". Use whatever is used in your case.

~ JoW

jow wrote:

Look at /proc/mtd to see how your kernel partition is named. Sometimes it is called "linux", sometimes "kernel" or even "vmlinux.bin.l7". Use whatever is used in your case.

Thanks jow, your tipp worked for me!

Hi,

We have a few PicoStation2's deployed on our campus, and are also looking at the upgrade options.

@Jow:

I'm following your post on the backup of the configs:

"
# backup configs:
tar -cz /etc/config /etc/passwd > /tmp/config.tgz
"

All works fine when upgrading with mtd, the only Q I've got, how do I restore the configs without rebooting?

Lets say my router is on IP 10.0.0.100, I back up the config, do the two mtd's, then the config has to be placed back on the new rootfs. (without frst booting into the default 192.168.1.1)

This is where I'm stuck.

If we can get this sorted out I'll be one happy man, since then everything can be scripted.

Regards

dvdwalt wrote:

All works fine when upgrading with mtd, the only Q I've got, how do I restore the configs without rebooting?

According to jow´s posting you restore the configs while flashing the root fs using the "-j" option:

jow wrote:

# reflash rootfs:
mtd -e rootfs -j /tmp/config.tgz write /tmp/openwrt-atheros-root.squashfs rootfs

Regards
Gregor

Thanks for the heads up! I've missed that one.

However, I've tried it (8.09.1 and 8.09.2RC2)  on the PicoStation2, but:

1.) 8.0.9.1 it somehow got screwed up totally
2.) 8.0.9.2RC2 took a long time to come up after the reboot and then it had the default config, IE had to telnet in etc, no changes were applied.

It seems the jffs2write option for mtd is also not working correct on PicoStation2.

1.) If I try and do jffs2write to rootfs it goes through, but no changes
2.) If I try and do it to rootfs_data it complains about no space in device.

Regards

OK, Progress at last!

Here's the steps I took to preserve the settings during an upgrade:

I'm not sure whether it will work every time, or even if they are technically sound.

#Copy the new kernel to /tmp
cd /tmp
scp <username>@<servername>:<path to kernel>/openwrt-atheros-vmlinux.lzma ./

#Reflash the kernel
mtd -e kernel write /tmp/openwrt-atheros-vmlinux.lzma kernel

#Mount the jffs2 partition as read-only ( To see which is the jffs2 partition: cat /proc/mtd -look for "rootfs_data" )  
mount -o remount,ro /dev/mtdblock3

#Bit copy the jffs2 partition to /tmp
dd if=/dev/mtdblock3 of=jffs.bak

#Remount the jffs2 partition as read-write (May not be needed?)
mount -o remount,rw /dev/mtdblock3

#Delete the kernel from /tmp
rm /tmp/openwrt-atheros-vmlinux.lzma

#Copy the rootfs to /tmp
scp <username>@<servername>:<path to kernel>/openwrt-atheros-root.squashfs ./

#Reflash rootfs:
mtd -e rootfs write /tmp/openwrt-atheros-root.squashfs rootfs

#Mount the jffs2 partition as read-only  
mount -o remount,ro /dev/mtdblock3

#Bit copy the jffs2 backup back to the jffs2 partition (WARNING: This takes up to 10 Minutes or more)
dd if=jffs.bak of=/dev/mtdblock3

#Reboot the unit and see if the setting were preserved
reboot

The above procedure allowed me to upgrade from 8.09.1 to 8.09.2 RC2 on the Ubiquity PicoStation2, maintaining the specific settings applied to the unit like the IP address etc.

(Last edited by dvdwalt on 6 Nov 2009, 13:18)

The discussion might have continued from here.