Closed aib closed 7 years ago
I have compiled your modified u-boot and I would like to know how to use it, I have prepared it in a Linux distribution that I have not started yet, I will try it in a few hours. Is it possible to see or mount the 512MB NAND partition from linux booted from microSD? For example using "fdisk -l"
This is my boot info (with your u-boot): ......... NAND: metal 28 hwcfg 286, use eMMC, skip nand init 0 Mib
Have you a HOWTO or a tutorial? thanks for your work
Since the NAND is not really a block device (or even a random access device, at least with regard to writing) your usual image creating and mounting methods will not work. You will, in all likelihood, need to create a UBIFS volume and image.
And yes, I am planning on writing a HOWTO, but I'm not sure when it would come about.
As for my fork, it's still at the stage where I want to see the changes merged, so it doesn't force a NAND boot. (Is your jumper in the correct position? I forgot what the original-yet-modified code used to do.) I will probably create a "NAND" branch soon.
(The thing is I've dismantled my setup and am taking a much needed break. I want to polish everything before I make it available for public consumption, but in order to do that I need to want to polish everything. Hence the break :)
On top of the current master, if you modify rda_media_get
to force a NAND boot and modify the boot command, it should work.
Provided you have a partition table and the partition images... oh boy
Thanks for your work, if I can contribute something for your tests you can let me know. Thank you
These are great news, you think with the new NAND we could use the gpio?
These are great news, you think with the new NAND we could use the gpio?
There was a problem with GPIO, wasn't there? What was it?
I honestly haven't tried. Can we use it on the MMC with a custom u-boot? If so I don't see why we shouldn't be able to do it on the NAND.
We go by parts, writing linux in the NAND of this board is a very important step, in this url who left a Linux distribution designed to be installed in the NAND: Http://www.orangepi.org/orangepibbsen/forum.php?mod=viewthread&tid=2963 This guy has access to the software that allows to record in the NAND but does not share it because it has copyright (that says). I will try to create the three files, I have not understood well to "compile twice to get pl1.bin and pl2.bin", the intention is to generate them and upload them to github to work on this.
Well the gpio just allow to test leds at this moment, but a group of guys in a private chat tried to make it work but without results, they tried the wiringx soft and nothing, so maybe with the datasheet is possible to get the hardware works, have you try to test a sensor?
I have compiled the sources of u-boot (it generares u-boot.rda) but I do not know how generates pdl1.bin and pdl2.bin can you help me?
I have compiled the sources of u-boot (it generares u-boot.rda) but I do not know how generates pdl1.bin and pdl2.bin can you help me?
make pdl=1 PDL
You can also use the bin_read script to extract them from the Android image. A modified pdl2 is required only to change the partition scheme. (Hex editing the original pdl2.bin works, too). The only issue is that of the partition table coming into play the next reboot after uploading a modified pdl2. This is discussed in #1. A workaround is removing the call to mtdparts_init_from_ptbl
in pdl/pdl2/pdl_nand.c:pdl_nand_init
. I haven't committed this because I'm not sure how hacky it is.
Oh, and do make it a clean build from scratch. I've had problems due to some files not being regenerated.
Also, there already seems to be stuff I have forgotten about in #1. Give it a read if the whole partition table thing troubles you.
Feel free to redirect the people in the forums here. Let them know that Linux on the NAND is possible with just the publicly available downloads and the scripts here.
$x00 per person is ridiculous. People are much better off pooling money together and hiring a consult. (And while it did cost me quite a lot more than that in working hours, nobody else needs to suffer.)
I have done this files, i have uploaded to https://github.com/txurtxil/OpiIoT2G_NAND, i go to invetigate how to do next fases..(use your tools, etc..) thanks
I have the opi2g_nand_write.py script and the 3 files the same folder, what step should I follow to format the NAND?. The opti iot 2g must have Android booted and connected by usb-TTY to the PC? I guess you can restore android via official tools and firmware. it is right?. On the other hand, I see that you use the port / dev / ttyACM0, in my case the opti iot 2g is connected to the / dev / usb0 port, I suppose I have to change it, is that correct? Thank you very much
The must be in, err, "OTG mode"? You get to it by holding the button down while powering up the device. No Android or other OS necessary.
In this mode the device registers as a CDC ACM device so I think you will have /dev/ttyACM0 too.
I can paste an actual command line when I get home, but for now you'll have to make do with --help and experimentation. Good luck :)
On Aug 24, 2017 9:49 AM, "txurtxil" notifications@github.com wrote:
I have the opi2g_nand_write.py script and the 3 files the same folder, what step should I follow to format the NAND?. The opti iot 2g must have Android booted and connected by usb-TTY to the PC? I guess you can restore android via official tools and firmware. it is right?. On the other hand, I see that you use the port / dev / ttyACM0, in my case the opti iot 2g is connected to the / dev / usb0 port, I suppose I have to change it, is that correct? Thank you very much
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/aib/opi2g-utils/issues/2#issuecomment-324549024, or mute the thread https://github.com/notifications/unsubscribe-auth/AAJbILsfP6qpz2cnbYTQpTjW43KLw5Owks5sbRzdgaJpZM4O85dJ .
Now I do not have the card in a few hours I try. On the other hand, I have created a development environment for the Orange Pi IoT 2G (a fork from xumlong), I want to facilitate the development in this card: From the menus let's say:
I have this problem: it sleep on this command:
./opi2g_nand_write.py --format-flash Sending partition pdl1 (len 40352) to 0x00100100
What does the device's serial console say?
Also, can you specify -v
or -vv
?
This is great! I'll test it out soon as I have the time.
I have used OrangePi_2G-IOT_NandStartup_V1.3.rar (downloaded form orangepi.org):
./opi2g_bin_read.py OrangePi_2G-IOT_Nand_Startup_V1.3.bin extrat/ OrangePi_2G-IOT_Nand_Startup_V1.3.bin:
Sections: 7 Header length: 000023ac (9132) Data length (calculated): 108a67bc (277505980) Data length (actual): 108a67bc (277505980) Total (calculated): 108a8b68 (277515112) Total (actual): 108a8b68 (277515112) File size: 108a8b68 (277515112)
[.........]
now i have used ./opi2g_nand_write.py -v Sending partition pdl1 (len 32640) to 0x00100100 Sent chunk 0, size 4096, total 4096 (1000) ....................................... Sending partition pdl2 (len 435652) to 0x80008000 Sent chunk 0, size 4096, total 4096 (1000) ..................................................... Sent chunk 106, size 1476, total 435652 (6a5c4) Partition table: mtdparts=rda_nand:2M@0(bootloader),2M(factorydata),2M(misc),4M(modem),8M(boot),10M(recovery),145M(system),180M(vendor),-(userdata)
now i have used ./opi2g_nand_write.py -v [...] Partition table: mtdparts=rda_nand:2M@0(bootloader),2M(factorydata),2M(misc),4M(modem),8M(boot),10M(recovery),145M(system),180M(vendor),-(userdata)
Okay, it seems to be working. Now you actually need to specify partitions, such as:
./opi2g_nand_write.py -v bootloader:bootloader.bin userdata:userdata.bin
If you want a different partition scheme, you will need a modified pdl2.bin and either an extra reboot or --format-flash
I have used the following command, it seems that the execution has been correct but I do not know that it has done, I must investigate it but it looks very good;)
./opi2g_nand_write.py -v bootloader:bootloader.img userdata:vendor.img Sending partition pdl1 (len 32640) to 0x00100100 Sent chunk 0, size 4096, total 4096 (1000) ...................................................... Sending partition pdl2 (len 435652) to 0x80008000 ....................................... Sent chunk 106, size 1476, total 435652 (6a5c4) Partition table: mtdparts=rda_nand:2M@0(bootloader),2M(factorydata),2M(misc),4M(modem),8M(boot),10M(recovery),145M(system),180M(vendor),-(userdata) Sending partition bootloader (len 509640) to 0x00000000 .......................................................
./opi2g_nand_write.py -v --format-flash Sending partition pdl1 (len 32640) to 0x00100100 ....... Sending partition pdl2 (len 435652) to 0x80008000 ........ Partition table: mtdparts=rda_nand:2M@0(bootloader),2M(factorydata),2M(misc),4M(modem),8M(boot),10M(recovery),145M(system),180M(vendor),-(userdata) Formatting flash memory... Partition table: mtdparts=rda_nand:2M@0(bootloader),2M(factorydata),2M(misc),4M(modem),8M(boot),10M(recovery),145M(system),180M(vendor),-(userdata)
Now i have NAND clean...
Well... I have restored all android partition on NAND witch the following command:
./opi2g_nand_write.py -v bootloader:bootloader.img modem:modem.img boot:boot.img system:system.img vendor:vendor.img
And android boots again...
Good work!!!! Now it is necessary to create a linux that gets in the NAND
Thanx aib!!! :
0.661437] NAND device: Manufacturer ID: 0x98, Chip ID: 0xac (Toshiba TC58NYG2S0H 4G 1.8V 8-bit), 512MiB, page size: 4096, OOB size: 256
root@OrangePi:~# uname -a Linux OrangePi 3.10.62-rel5.0.2 #54 PREEMPT Mon Jun 5 16:46:56 CST 2017 armv7l armv7l armv7l GNU/Linux
I have documented the process:
http://surfero.blogspot.com.es/2017/08/orange-pi-iot-2g-trabajar-con-la.html
Ahh, excellent, great job!
Weird thing: I seem to be able to follow it even though I don't speak Spanish :) I will keep this issue open, though, to force me to write that tutorial :)
My apologies not to mention that it is in Spanish ... . I look forward to your tutorial, on the other hand it would be excellent to porting linux to NAND natively. Thank you for your excellent work and thanks for sharing :)
a question: Is it possible to remove all the units of the NAND and create a single of 512mb? For example / dev / nand
Almost: We need the first partition for the bootloader. We can do 2/510 (or is it 2/498? I don't remember whether the NAND is 500 or 512 MiB).
You will need to modify the "mtdparts=..." line in a couple of places: pdl2.bin, u-boot.rda and whatever script boots the Linux image (it needs to be passed as a kernel command line parameter).
I have started writing the article, by the way. It should be ready in a couple of days.
This is the info abouto Orange Pi Iot 2G NAND : NAND device: Manufacturer ID: 0x98, Chip ID: 0xac (Toshiba TC58NYG2S0H 4G 1.8V 8-bit), 512MiB, page size: 4096, OOB size: 256
I will update partition table via u-boot, for example: U-Boot> setenv bootargs 'console=ttyS0,115200 root=/dev/mtdblock0 mtdparts=atmel_nand:448M(root),64M(data),-(aux) ro rootfstype=jffs2 video=AMPIRE'
More info: http://wiki.emacinc.com/wiki/Repartitioning_NAND_Flash_with_JFFS2_for_Linux
Thanks for your info!! i think the best option is use dietpi linux (dietpi.com)
wow this is cool, you guys are amazing :)
I found "tgt_ap_flash_parts.h" U-boot file:
"2M@128K(bootloader)," \
"2M(factorydata)," \
"2M(misc)," \
"4M(modem)," \
"8M(boot)," \
"10M(recovery)," \
MTDPARTS_ANDROID_DEF
"300M(system)," \
"300M(vendor)," \
"-(userdata)"
/ kernel need handle mtd from 0, so define a dummy partions whose size is bootloader+factorydata+modem+boot+recovery /
"28M@0(dummy)," \
MTDPARTS_ANDROID_DEF
There a util document about this rda NAND memory: https://wenku.baidu.com/view/a364d8489b6648d7c1c746e5.html
I think that it is not possible to partition the NAND (for example to create a partition of 440MB), I have tried in many ways but I always leave the same partitions.
I have found that the guilty of making 5 partitions is the kernel, it does them during the boot. I think that the parameters of U-Boot do not arrive so when watching the NAND decides to make the 5 partitions predetermined:
/ *
We can find this configuration in: ./drivers/mtd/nand/rda_spi_nand.c ./drivers/mtd/nand/rda_nand_v1_low.c ./drivers/mtd/nand/rda_nand_v1.c
Changing these parameters for the ones we decide (up to 512MB) seems to provide a solution but I need to prove this (I'm on it) and I need to know if it creates new units in each boot.
Passing mtdparts= to kernel from u-boot allows you to change the partition scheme used by Linux.
You can modify /boot/boot.cmd (+.scr)
I am in the process of documenting this in the article. It's taking longer than I expected due to the tutorial angle, but I recon I'll be done in a few days.
On Sep 2, 2017 8:23 AM, "txurtxil" notifications@github.com wrote:
I have found that the culprit of making 5 partitions is the kernel, it does them during the boot. I think that the parameters of U-Boot do not arrive so when watching the NAND decides to make the 5 partitions predetermined:
/ *
- Default mtd partitions, used when mtdparts = not present in cmdline
- / static struct mtd_partition partition_info [] = { { .name = "reserved", .offset = 0, .size = 24 SZ_1M}, { .name = "vendor", .offset = 24 SZ_1M, .size = SZ_8M}, { .name = "system", .offset = SZ_32M, .size = 192 SZ_1M}, { .name = "cache", .offset = 224 SZ_1M, .size = SZ_8M}, { .name = "userdata", .offset = 232 SZ_1M, .size = 280 SZ_1M}, }; We can find this configuration in: ./drivers/mtd/nand/rda_spi_nand.c ./drivers/mtd/nand/rda_nand_v1_low.c ./drivers/mtd/nand/rda_nand_v1.c
Changing these parameters for the ones we decide (up to 512MB) seems to provide a solution but I need to prove this (I'm on it) and I need to know if it creates new units in each boot.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/aib/opi2g-utils/issues/2#issuecomment-326723063, or mute the thread https://github.com/notifications/unsubscribe-auth/AAJbIFagF0b1WyOzmo6WUTaDwx1uqU--ks5seOZDgaJpZM4O85dJ .
Thanks for your work!!! now i have two NAND partitions: .......................................................... cat /proc/mtdisk /dev/mtdblock0: 2 MiB, 2097152 bytes, 4096 sectors Units: sectors of 1 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk /dev/mtdblock1: 510 MiB, 534773760 bytes, 1044480 sectors Units: sectors of 1 512 = 512 bytes
dev: size erasesize name mtd0: 00200000 00040000 "bootloader" mtd1: 1fe00000 00040000 "nandroot" ....................................................
I have do changes to boot.cmd:
setenv bootargs "_mtdparts=rdanand:2M@0(bootloader),510M(nandroot) root=${rootdev} rootwait rootfstype=${rootfstype} console=ttyS0,921600 panic=10 consoleblank=0 loglevel=${verbosity} ${extraargs} ${extraboardargs}"
Now i can boot Linux from NAND, but is necessary u-boot to use boot.scr, it is necessary to tell wher is rootfs (UBI partion of 512Mb):
Excellent!
I have a preliminary version of my article/tutorial at https://www.aib42.net/article/hacking-orangepi-2g
I'm still building the website so you may experience some weirdness, but that URL should be stable.
Thanks for your time, i will read your great job to use it.
I have spoken of you work and thanked your immense help at http://www.orangepi.org/orangepibbsen/forum.php?mod=viewthread&tid=3031#lastpost
Thank you, I had trouble signing up to the forums.
I will close this GitHub issue now, but feel free to continue posting or create other issues. You can also e-mail me directly, my address is on my website.
Tried t5o use your 2 utilities but I get: Checksum error... any ideas?
@netomx Some logs would be helpful. Feel free to open another issue, by the way.
Nevermind, fixed it :P will open a new issue anyway
The more I try to write here, the more I think this process warrants a blog post or a tutorial. But in the meantime we can try to collect out thoughts here.
Requirements:
The partition scheme, along with u-boot code for booting from the NAND must be baked into u-boot ( https://github.com/RDA8810/u-boot-RDA8810 , my fork at https://github.com/aib/u-boot-RDA8810 ) It should be compiled twice, once giving us
u-boot.rda
and oncepdl1.bin
andpdl2.bin
. Then all four (or more) files can be flashed at once using theopi2g_nand_write.py
script.