Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
PogoPlug Mobile - Install OpenWrt on internal flash (128mb) and keep allowing boot to SD or USB
# ---------------------------------------------------------------------------------
# Device - PogoPlug Mobile - Install OpenWrt on internal flash (128mb) and keep allowing boot to SD or USB
# ---------------------------------------------------------------------------------
# Corrected URLs, because is down:
cd /tmp
#chmod +x fw_setenv
apt-get update
apt-get install u-boot-tools
# setup fw_env.config
echo "/dev/mtd0 0xc0000 0x20000 0x20000">/etc/fw_env.config
# 1MB for the uBoot, the rest for rootfs (~122MB)
/tmp/fw_setenv mtdparts 'mtdparts=orion_nand:1M(u-boot),-(rootfs)'
# This reboot is important
cat /proc/mtd
#dev: size erasesize name
#mtd0: 00100000 00020000 "u-boot"
#mtd1: 07f00000 00020000 "rootfs"
apt-get update
apt-get install mtd-utils
# with mtd-utils we will have ubiattach, ubimkvol, ubiformat:
ubiformat /dev/mtd1
#ubiformat: mtd1 (nand), size 133169152 bytes (127.0 MiB), 1016 eraseblocks of 131072 bytes (128.0 KiB), min. I/O size 2048 bytes
#libscan: scanning eraseblock 1015 -- 100 % complete
#ubiformat: 896 eraseblocks have valid erase counter, mean value is 0
#ubiformat: 86 eraseblocks are supposedly empty
#ubiformat: 2 bad eraseblocks found, numbers: 25, 26
#ubiformat: warning!: 32 of 1014 eraseblocks contain non-UBI data
#ubiformat: continue? (y/N)
#ubiformat: warning!: only 896 of 1014 eraseblocks have valid erase counter
#ubiformat: mean erase counter 0 will be used for the rest of eraseblock
#ubiformat: continue? (y/N)
#ubiformat: use erase counter 0 for all eraseblocks
#ubiformat: warning!: VID header and data offsets on flash are 2048 and 4096, which is different to requested offsets 512 and 2048
#ubiformat: use new offsets 512 and 2048? ubiformat: continue? (y/N)
#ubiformat: use offsets 512 and 2048
#ubiformat: formatting eraseblock 1015 -- 100 % complete
ubiattach -p /dev/mtd1
#UBI device number 0, total 1014 LEBs (130830336 bytes, 124.8 MiB), available 992 LEBs (127991808 bytes, 122.1 MiB), LEB size 129024 bytes (126.0 KiB)
ubimkvol /dev/ubi0 -m -N rootfs
#Set volume size to 127991808
# Volume ID 0, size 992 LEBs (127991808 bytes, 122.1 MiB), LEB size 129024 bytes (126.0 KiB), dynamic, name "rootfs", alignment 1
mkdir /tmp/ubi
mount -t ubifs ubi0:rootfs /tmp/ubi
# Corrected URLs, because 15.05.1 is newer than 15.05 (we could use LEDE too if it is available)
cd /tmp
# check that zImage and rootfs.tar.gz are OK
md5sum -c md5sums 2>/dev/null | grep OK
# extract rootfs.tar.gz to ubi rootfs at /tmp/ubi
cd /tmp/ubi
tar xvzf /tmp/openwrt*rootfs.tar.gz
mkdir boot
mv /tmp/openwrt*kirkwood-zImage ./boot/zImage
#FDT from,12096
# This, instead of download it we already have it so we copy it :
# link down:
#cd boot; wget
cd boot
cp /boot/dts/kirkwood-pogoplug_v4.dtb ./kirkwood-pogoplug_v4.dtb
cd /
umount /tmp/ubi
# Setup uBoot Environment
# Cut and Paste this whole section
fw_setenv fdt_file '/boot/kirkwood-pogoplug_v4.dtb'
fw_setenv loadaddr '0x800000'
fw_setenv zimage '/boot/zImage'
fw_setenv fdt_addr '0x1c00000'
fw_setenv loadubi 'echo Trying to boot from NAND ...;if run mountubi; then run loadubizimage;run loadubifdt;ubifsumount;run bootzubi;fi'
fw_setenv mountubi 'ubi part rootfs; ubifsmount ubi0:rootfs'
fw_setenv loadubizimage 'ubifsload ${loadaddr} ${zimage}'
fw_setenv loadubifdt 'ubifsload ${fdt_addr} ${fdt_file}'
fw_setenv bootzubi 'echo Booting from nand ...; run setargsubi; bootz ${loadaddr} - ${fdt_addr};'
fw_setenv setargsubi 'setenv bootargs console=${console},${baudrate} ${optargs} ubi.mtd=1 root=ubi0:rootfs rw rootfstype=ubifs rootwait ${mtdparts}'
# Setup boot order.
fw_setenv bootcmd 'run bootcmd_usb; run bootcmd_mmc; run bootcmd_sata; run loadubi; reset'
#poweroff Pogoplug and remove SD Card and USB flash drive.
# So far it works perfectly, without SD / USB it boots to OpenWrt and with Debian SD it boots to Debian
# Important: It will not work if you use an SD that was previusly used on another Pogo Device.
# the ethernet it wont work.
# Now OpenWRT will have as usual IP with DHCP server enabled
# we will have to disable DHCP server, and configure to get automatic IP from DHCP, and assign a password
#####Initial Boot via Telnet######
#set passwd and enable ssh
# Reconfigure Network to DHCP Client
# disable dhcp server on lan
uci set dhcp.lan.ignore='1'
uci set network.lan.proto='dhcp'
uci del network.lan.ipaddr
uci del network.lan.netmask
uci commit dhcp
uci commit network
/etc/init.d/dnsmasq restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment