Welcome! Log In Create A New Profile

Advanced

booting Pogo V4 with Openwrt on NAND

Posted by protocold 
booting Pogo V4 with Openwrt on NAND
April 13, 2017 02:27PM
I have replaced the uboot in the NAND with bodhi's by following http://forum.doozan.com/read.php?3,12381

I can boot debian on MMC.


However, now I would like to put openwrt on the nand and setup such that in case it cannot boot from USB, MMC, then it should go boot from the nand.

This is what I have done on the NAND so far:

/tmp/ubiformat /dev/mtd1

/tmp/ubiattach -p /dev/mtd1
/tmp/ubimkvol /dev/ubi0 -m -N rootfs

#mount ubi rootfs to /tmp/ubi
mkdir /tmp/ubi
mount -t ubifs ubi0:rootfs /tmp/ubi

#Chaos Calmer 15.05
cd /tmp
wget http://downloads.openwrt.org/chaos_calmer/15.05/kirkwood/generic/openwrt-15.05-kirkwood-generic-rootfs.tar.gz
wget http://downloads.openwrt.org/chaos_calmer/15.05/kirkwood/generic/openwrt-15.05-kirkwood-zImage
wget http://downloads.openwrt.org/chaos_calmer/15.05/kirkwood/generic/md5sums

#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

cd boot
mkdir dts
cp /boot/dts/kirkwood-pogoplug_v4.dtb .

sync
cd /
umount /tmp/ubi

Now how should I modify the env to do this? I have flashed the default env from 2016.05 U-Boot at the moment.
Re: booting Pogo V4 with Openwrt on NAND
April 14, 2017 01:06AM
Re: booting Pogo V4 with Openwrt on NAND
April 14, 2017 12:37PM
Many thanks.

But I do not have a separate kernel partition anymore.

root@debian:~# cat /proc/mtd
dev: size erasesize name
mtd0: 00100000 00020000 "u-boot"
mtd1: 07f00000 00020000 "rootfs"
Re: booting Pogo V4 with Openwrt on NAND
April 14, 2017 08:31PM
protocold Wrote:
-------------------------------------------------------
> Many thanks.
>
> But I do not have a separate kernel partition anym
> ore.
>
> root@debian:~# cat /proc/mtd
> dev: size erasesize name
> mtd0: 00100000 00020000 "u-boot"
> mtd1: 07f00000 00020000 "rootfs"


I see. What you want to do is exactly the same as Arch rescue system. You can visit Arch site and look for moonman posts, rescue system installation link is in his signature. Take his installation script setup and adapt it for your LEDE envs setup.

Note that there is a difference in where DTB is on rootfs. Ours is /boot/dts. And LEDE is supposed to append the DTB to uImage/zImage.

If you run into booting problem, post the envs here. Or if not sure, post questions about his envs.

And post the good set of envs when it works, if you'd like to share.

-bodhi
===========================
Wiki
latest Kirkwood kernel builds and rootfs
latest u-boot-kirkwood builds
latest Oxnas kernel builds and rootfs
latest u-boot-oxnas builds
latest MVEBU Armada kernel builds and rootfs
U-Boot & Kernel Booting process
bodhi's u-boot GitHub
bodhi's corner



Edited 1 time(s). Last edit at 04/14/2017 10:02PM by bodhi.
Re: booting Pogo V4 with Openwrt on NAND
April 15, 2017 02:51AM
sorry for another noob question.

> mtd0: 00100000 00020000 "u-boot"
> mtd1: 07f00000 00020000 "rootfs"


The default environment is stored at 0xc0000 ?



Edited 1 time(s). Last edit at 04/15/2017 02:57AM by protocold.
Re: booting Pogo V4 with Openwrt on NAND
April 15, 2017 03:34AM
> The default environment is stored at 0xc0000 ?

Correct. By convention u-boot occupied the 1st MB. 0xc0000 is within that area.

-bodhi
===========================
Wiki
latest Kirkwood kernel builds and rootfs
latest u-boot-kirkwood builds
latest Oxnas kernel builds and rootfs
latest u-boot-oxnas builds
latest MVEBU Armada kernel builds and rootfs
U-Boot & Kernel Booting process
bodhi's u-boot GitHub
bodhi's corner
Re: booting Pogo V4 with Openwrt on NAND
April 15, 2017 04:17AM
ok. So technically I can mess up anything after the first 1MB and I should still be OK to fix it up?!
Re: booting Pogo V4 with Openwrt on NAND
April 15, 2017 04:24AM
bodhi Wrote:
-------------------------------------------------------

> I see. What you want to do is exactly the same as
> Arch rescue system. You can visit Arch site and lo
> ok for moonman posts, rescue system installation l
> ink is in his signature. Take his installation scr
> ipt setup and adapt it for your LEDE envs setup.
>
> Note that there is a difference in where DTB is on
> rootfs. Ours is /boot/dts. And LEDE is supposed to
> append the DTB to uImage/zImage.
>
> If you run into booting problem, post the envs her
> e. Or if not sure, post questions about his envs.
>
> And post the good set of envs when it works, if yo
> u'd like to share.

I think moonman's procedure rely on arch uboot and not yours.. There was no mention of changes to env at all in his post, other than formatting and writing the arch rescue images.
Re: booting Pogo V4 with Openwrt on NAND
April 15, 2017 05:25AM
Quote

ok. So technically I can mess up anything after the first 1MB and I should still be OK to fix it up?!

Exactly. mtd partitions definition is whatever you want it to be. As long as you keep mtd0 (first 1MB) untouched, the rest could be defined using any layout you want to.

Quote

I think moonman's procedure rely on arch uboot and not yours.. There was no mention of changes to env at all in his post, other than formatting and writing the arch rescue images.

Of course, moonman uses Arch u-boot. But since the layout you want is exactly the same as Arch's (with the rescue rootfs in UBIFS on mtd1), his procedure should be the same. If there is no mention of changes, it's because the envs already defined for booting rescue system in the default envs image for Arch u-boot. If you are not sure, post the envs in Arch u-boot here and I'll point out where.

-bodhi
===========================
Wiki
latest Kirkwood kernel builds and rootfs
latest u-boot-kirkwood builds
latest Oxnas kernel builds and rootfs
latest u-boot-oxnas builds
latest MVEBU Armada kernel builds and rootfs
U-Boot & Kernel Booting process
bodhi's u-boot GitHub
bodhi's corner
Re: booting Pogo V4 with Openwrt on NAND
April 15, 2017 05:47AM
But I wasnt planning to use Arch's uboot.. so where should I start?
Re: booting Pogo V4 with Openwrt on NAND
April 15, 2017 04:20PM
protocold Wrote:
-------------------------------------------------------
> But I wasnt planning to use Arch's uboot.. so wher
> e should I start?

Arch u-boot and my build is almost identical (came from mainline, with some extra patches). Their envs will work the same way. What you can do is to see how their envs are setup for booting UBIFS rootfs on mtd1 and use those.

In any case, I saw that you have been helped with installing LEDE in the Rescue subforum by bobafet.

-bodhi
===========================
Wiki
latest Kirkwood kernel builds and rootfs
latest u-boot-kirkwood builds
latest Oxnas kernel builds and rootfs
latest u-boot-oxnas builds
latest MVEBU Armada kernel builds and rootfs
U-Boot & Kernel Booting process
bodhi's u-boot GitHub
bodhi's corner
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: