A13 NAND with Read Only Partition, Running Debian?

Started by cspurr, July 08, 2013, 11:20:14 PM

Previous topic - Next topic

cspurr

My goal is to utilize the A13 Olinuxino as a potential product platform. But for this I need it to be as reliable as an embedded device can be when placed in the field with only remote access via some network connection. So, I would like to run the OS from the NAND and be as close as possible to 100% reliable when it comes to file system corruption due to inadvertent power loss.
So, I would like to run a version of Debian but configure the distro to hopefully utilize a read only partition for the most critical part of the file system, and come up with something for the writable/configurable portions of my application, maybe two additional partitions to house a primary and backup of configuration/application nonvolatile data.
I am new to Linux especially as an Embedded solution and have spent weeks reading everything I can find on the subject, installing Debian as dual boot on my laptop to have a working test environment. I am not new to embedded real time development and hardware, spending my whole career so far developing real time embedded solutions mostly in static memory environments with simple safe run-to-completion rate monotonic scheduling schemes. 
My current application ideas do not require hard real time deadlines to be met, but would like the use of all the abundant open source features already developed for Linux. So, no need to reinvent the wheel.
I have read one thread on here talking about building everything you need to run Debian from the NAND, and using already built file systems. Building U-Boot and Script.bin file, etc. I have not ready to much about customizing these processes to get to where I want to be with this open hardware board.
I am not even sure LiveSuite can be used to do what I am hoping to do.
I have done a lot of research and try not to ask questions I can answer myself through my own work, but I think I am getting too much information muddled together so I am starting to confuse myself.
My main questions include:
1.   Is it possible to build a custom Debian image meant to work from a read only main file system and create additional partions for config/application data (which is how I assume most embedded Linux devices would do it from what I have read)?
2.   Can Live Suite be setup to create/format these partitions?
3.   I assume I have to customize U-Boot and maybe Script.bin for this?
4.   If not, has anyone used any of the tools from: https://github.com/linux-sunxi to accomplish what I am asking?

As soon as I figure this out, and it is possible, I plan on writing a very detailed HOWTO so that if I am successful, I can pay it forward.

If someone has some insight and/or can point me to some specifics that I obviously have not found yet, it will be greatly appreciated.

Thanks for your time,

cspurr



oldpenguin

Hello cspurr

I too would like to adopt the A13 as a potential product platform. But I have mixed feelings concerning cpu and cpu support (not from Olimex of course  ;)).
I have tested the platform in several ways, running Linux from NAND and from SD.
Running from SD is slow and sometimes I find it is unstable. Running from NAND is much faster.
I have been running a test application for several months now, in a tough (hot) environment and it is working quite well.
The problem is I can't rely on the way the NAND flash is beeing used. There is a driver that exposes the NAND as a block device and you can run a any FS you want on top of it. But, where is the bad block management ? where is the wear levelling ? What happens when things go wrong with the flash ? Of course I can read the driver code  >:(, but probably to find out things are not beeing done as expected. I had very bad experience in the past with proprietary flash driver and would not like to repeat that. What is needed is mtd support for the NAND flash. That way you can run appropriate FS for flash chips like UBI/UBIFS.
There are some experiments around. If you are patient enough to read this thread from the start https://www.olimex.com/forum/index.php?topic=154.0 you can see this issue has been discussed. Unfortunately what is needed is more commitment from Allwinner. Without proper documentation it will be difficult to come up with a good mtd driver.
So, my advice is if you really need some good cpu support stick to Freescale or TI - they have excellent reference designs and bsp. Olimex has a nice design with imx233, but is it missing the NAND flash  :).

Concering your questions
Quote1.   Is it possible to build a custom Debian image meant to work from a read only main file system and create additional partions for config/application data (which is how I assume most embedded Linux devices would do it from what I have read)?
Debian is a little bit weird running as read-only but it can be done.
Quote2.   Can Live Suite be setup to create/format these partitions?
Livesuit is the most dumbest stupid loader application I've ever seen. You can't change anything. You can't define how many partitions you want or partitions size. You can't upload an image of the flash. Everything is prepackaged by dozens of script files with misterious options with chinese comments. There is no documentation whatsoever on the packaging process. There is no source for the packaging applications (?). Livesuit only runs reliably on Windows. I wish you good luck to try to package a root file-system larger than 1.5G. Unless someone with knowledge on this steps up, you wont be able customize anything.
Quote3.   I assume I have to customize U-Boot and maybe Script.bin for this?
See previous answer
Quote4.   If not, has anyone used any of the tools from: https://github.com/linux-sunxi to accomplish what I am asking?
The bsp tool works fine http://linux-sunxi.org/BSP, but with the limitations above.
I hope I was helpful


cspurr

oldpenguin,

Yes those comments were very helpful. Thank you for taking the time to comment as it is always appreciated. So I guess I should probably keep searching for a more appropriate, more reliable and not so closed BSP that I can really dig into and understand. I guess I will keep on looking 

Thanks again for the information,
cspurr

JohnS

I think awutils / awtools now mean you don't need LiveSuit.

Allwinner probably don't care to provide complete doc and this may be true for most or even all SoC makers.  They need to sell hundreds of thousands so those of us who maybe want tens or hundreds are of no interest.

John

oldpenguin

@JohnS
I haven't tried awutils / awtools lately. I'll have a look again.

I agree with you concerning the SoC manufacturers. Some of them just leak out a bare minimum information, like Broadcom on the Raspberry Pi. You can't say these platforms are open. There are no details on most functionalities.
So, if a developer wants to design a solid product and make sure there are no bad surprises it should stick to manufacturers like Freescale and TI.




Tele

I agree with penguin totally.

So far I have tried RPi, Olinuxino A13, Pandaboard EX (TI Omap44xx), Sabre Lite (Freescale i.MX6)

RPi, is not in the same team with the others, its a toy with marvellous marketing and hype. It's GPU is not even documented and theres no source of drivers. I wouldn't recommend it.

Panda is the best of all in term of quality, very steady construction. Its not a huge suprise, TI is a very old and famous brand. Everything just simply works at first try. For example I have built a Xenomai 3.5.7 kernel for it, and it worked immediately after the compilation. It took about a half hour. No struggling. It's boring. TI4460's Reference Manual has 5871 pages.

Sabre Lite is a very high quality card also, but its smaller, looks and feels fragile, with tiny connectors and thingies. Looks like a miniaturized Japanese, although Boundary Devices is American. Very powerful and fast card, with a little bit strange and unusual build environments, but if you get used to it, then it work nicely, without any problems. Very well documented, totally open source just like Panda. i.MX6's Reference Manual has 5827 pages.

At last Olinuxino is the cheapest one of all, very sympathetic and cute. Its quite underdocumented as every Allwinner SoC, but somehow I always could manage to solve the problems on it. I don't sell my A13 card, but still I use it and develop things on it, though I have much better cards. Don't ask me why. Building Xenomai kernel took 2 weeks not 1 hour, but at last it worked, and it was stable. Olimex has good community, this forum for example. The new A20 version would seem very promising, if it had a running linux on it, not only android. That would be very important and urgent problem to solve in my opinion.

I would recommend Olimex for enthusiast and hobbyists(a capable and cheap card, perfect for learning), Panda for production(quite expensive but very steady), Sabre if you need big power(a bit sophisticated and expensive but huge power)

I have read controversial things about NVidia Tigra and the Samsung Exynos. They are actually not bad, but expensive and not well documented, not totally opensource.

Andrew Smalley

Hello, Anyone still interested? or has this task been completed?

I have my trusty build server happily making buildroot images for the A13 with Wifi and obviously the 4GB NAND chip. I am also interested in putting Debian on NAND and am working towards this.

Debian will run fine on NAND, just think about passwords and things in /etc

I will/would put /var /home /etc in a tmpfs or random partition on SD/MMC after detecting partition label

/run and /var/run (same) can also be in tmpfs or wherever you want, local or remote.

I will be building over the next week a custom kernel with modules custom to my own project (Bluetooth, ext WiFi, usb/serial pl232 and GPS , same USB). and put together an olimex A13 image online and available for download!

but I will also be compiling in all the custom SUNIX things and have it optimised for armhf with all gpio available to the user.

Aim , custom embedded http server with GUI to configure the kernel on the fly, much like you would a router and reboot if needed with complete usability of the CPU/RAM/WIFI

this will be before the OS or a separate QEMU VM hopefully. ( Not sure how the Cortex will handle this yet?)

4GB is massive and base system could happily come inside 256mb to boot base Linux image. with these things in mind there is 3.25GB left less the u-boot space etc etc.


End of Day: Ive had this board 3 days now and want Linux on NAND and ive just shared a few ideas to get minds sparking.

if it makes you spark of interest help me to meet this end.