[OpenWrt-Devel] Firmware Upgrade - Mikrotik - ar71xx

David Hutchison dhutchison at bluemesh.net
Tue Oct 20 12:13:01 EDT 2015


I think sysupgrade now works with the rb951ui; however I haven't tested it.

I wrote my own upgrade process before sysupgrade was available for the
rb95x series:

- Create a sysupgrade.tgz; this is the kept files you want (
configurations; scripts; etc. )
tar -czf /tmp/sysupgrade.tgz /etc/dropbear /etc/passwd /etc/group
/etc/rc.local ${upgrade_dirs} &> /dev/null


- Make a new root directory in /tmp ( /tmp/root/* )

mkdir -p /tmp/root/dev /tmp/root/sbin /tmp/root/bin /tmp/root/proc
/tmp/root/tmp /tmp/root/mnt /tmp/root/lib
mkdir -p /tmp/root/etc /tmp/root/root /tmp/root/var/log
/tmp/root/usr/bin /tmp/root/usr/sbin /tmp/root/oldroot

- Copy over sbin/* necessary bins

cd /sbin
cp -rp `ls -A /sbin | grep -vE
"mount.nfs|hotplug2|hotplug-call|udevd|swconfig|uci"` /tmp/root/sbin/.
cd /bin
cp -rp `ls -A /bin | grep -v bash` /tmp/root/bin/.
cd /
cp -p /lib/* /tmp/root/lib/. &> /dev/null
cp -rp /usr/bin/wget /usr/bin/md5sum /usr/bin/killall /usr/bin/awk
/usr/bin/hexdump /usr/bin/bzcat /usr/bin/printf /usr/bin/wc
/usr/bin/passwd /usr/bin/ssh /usr/bin/scp /tmp/root/usr/bin/.
cp -rp /etc/passwd /etc/group /etc/dropbear /etc/inittab /etc/shells
/etc/rc.local /tmp/root/etc/.

- Pivot the root filesystem into the memory

mount -o bind /tmp/root /tmp/root
mount -o move /proc /tmp/root/proc
pivot_root /tmp/root /tmp/root/oldroot
mount -o move /oldroot/dev /dev
mount -o move /oldroot/tmp /tmp

- Now you can write your kernel / rootfs partitions

mkdir -p /mnt/kernel; mount -t yaffs2 /dev/${kernel_mtdblock} /mnt/kernel;
gunzip -c /tmp/OpenWRT.kernel.gz > /mnt/kernel/kernel;  # Note, this
is only a .gz because I gzipped it prior to SCP. I have low bandwidth
deployments.. Just put the kernel file in /mnt/kernel/kernel and
ensure executable
chmod +x /mnt/kernel/kernel;
umount /mnt/kernel;
echo 'Kernel Flashed';
umount /oldroot/sys/kernel/debug;
umount /oldroot/sys;
rm -rf /oldroot/*;
ls -la /oldroot;
cd /oldroot;
tar -xzf /tmp/OpenWRT.rootfs;
echo 'Rootfs Flashed';
echo 'Overlay /tmp/sysupgrade.tgz';
tar -xzf /tmp/sysupgrade.tgz;
echo 'Overlay completed!';
sync;
echo 'Upgrade Complete';
reboot;

I of course scripted it. * HOWEVER IF SYSUPGRADE IS CONFIRMED WORKING
WITH THE RB951Ui, USE THAT !!!*
My way is not very well vetted; while I use I have a *very* custom
rb951ui OpenWRT build. I can't emphasis that enough, test sysupgrade
*FIRST!*

-- Davey

On Tue, Oct 20, 2015 at 1:28 AM, Nishant Sharma <codemarauder at gmail.com> wrote:
> Hi,
>
> I have around 50 boxes (ar71xx Mikrotik RB951Ui-2HnD) in the field, running
> AA or BB (custom compiled).
>
> I have checked through the documentation, but could not find any way to
> upgrade the firmware.
>
> Is there a way, that I could upgrade them to the newly compiled firmware
> remotely or only option I have is to recall the boxes back and re-flash
> them?
>
> Thanks in advance.
>
> Regards,
> Nishant
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list