If the Pogoplug is booted while the USB stick is attached, it boots the Arch Linux. But if it’s booted while the USB is detached, it simply boots the original firmware, and I can see my Pogoplug on my.pogoplug.com as normal.
I was wondering if I can swap between the original firmware and ALARM without having to detach/attach the ALARM USB stick.
uBoot (the boot loader) identified the bootable USB by trying to mount ext2 filesystem on the first partition of every attached USB stick/disk. If it can mount the first partition as ext2, it then checks if a kernel exists at the following path (case sensitive):
if a kernel is found, it loads it and continues the booting process. But if no kernel is found on any of the attached USB drives, it simply boots the original firmware.
Hence, we can have uBoot booting ALARM by keeping the kernel file. And we can have uBoot booting the original firmware by renaming the kernel file, so that it can’t find it.
If we are using an initial ram disk file (uInitrd) along with the kernel file (uImage), then we need to rename uInitrd file same as we do with uImage in the following example.
check Booting Pogoplug From The Correct USB Disk for more information on why we may need to use uInitrd file.
Here is an example for this process.
Suppose we have already booted ALARM, and we just want to reboot into the original firmware:
We login to Pogoplug using SSH as the root user, and run the following commands to rename the kernel file and reboot:
mv /boot/uImage /boot/uImage.hide reboot
Now Pogoplug should boot the original firmware.
Now suppose we want to go back to ALARM:
We login to Pogoplug using SSH as root user, and check the mounted disks (the original firmware auto mounts all the attached USB drives).
-bash-3.2# mount rootfs on / type rootfs (rw) /dev/root on / type jffs2 (ro) none on /proc type proc (rw) none on /sys type sysfs (rw) none on /dev/pts type devpts (rw) none on /tmp type tmpfs (rw) none on /proc/bus/usb type usbfs (rw) /tmp/.cemnt/sda1 on /tmp/.cemnt/mnt_sda1 type ext3 (rw,nosuid,nodev,noexec,noatime,data=ordered) /tmp/.cemnt/sdb1 on /tmp/.cemnt/mnt_sdb1 type ext3 (rw,nosuid,nodev,noexec,noatime,data=ordered) /tmp/.cemnt/sdb2 on /tmp/.cemnt/mnt_sdb2 type ext3 (rw,nosuid,nodev,noexec,noatime,data=ordered) /tmp/.cemnt/sdb3 on /tmp/.cemnt/mnt_sdb3 type ufsd (rw,nosuid,nodev,noexec,noatime,nls=utf8,uid=0,gid=0,fmask=22,dmask=22,nocase,force) /tmp/.cemnt/sdb4 on /tmp/.cemnt/mnt_sdb4 type ufsd (rw,nosuid,nodev,noexec,noatime,nls=utf8,uid=0,gid=0,fmask=22,dmask=22,nocase,sparse,force)
If we have more than one USB drive, then we check the first partition of each one to see which of them is the ALARM USB.
In the case above, it’s sda1, so we browse to the kernel directory, and rename the kernel file back to its original name, sync changes, and then reboot
cd /tmp/.cemnt/mnt_sda1/boot/ mv uImage.hide uImage sync /sbin/reboot
Now Pogoplug should reboot into ALARM again.
With this simple approach, we can go back and forth between ALARM (or any other custom Pogoplug firmware), and the original firmware without having to detach/attach USB sticks. Which is wonderful if you are already accessing your Pogoplug remotely.