kuba2k2 has quit [Read error: Connection reset by peer]
kuba2k2 has joined #linux-sunxi
Daanct12 has joined #linux-sunxi
joaoSchim_ has quit [Remote host closed the connection]
kuba2k2 has quit [Read error: Connection reset by peer]
kuba2k2 has joined #linux-sunxi
kuba2k2 has quit []
kuba2k2 has joined #linux-sunxi
mripard has joined #linux-sunxi
mripard has quit [Quit: leaving]
la_mettrie has joined #linux-sunxi
<kuba2k2>
Hi, I'm trying to run mainline U-Boot (v2021.10) from NAND flash on a Q8-format A13 tablet, and I'm running into every problem possible. Here are few things that I tried:
<kuba2k2>
1. flashing stock LiveSuit .img - Android boots, as expected (so the board is not faulty)
<kuba2k2>
2. flashing U-boot and SPL (with/without ECC) directly to NAND (as described in board/sunxi/README.nand) - board jumps to FEL, doesn't detect the image
<kuba2k2>
3. unpacking the .img, swapping boot0.bin with SPL, repacking ("dragon.exe" tool), flashing with LiveSuit - no signs of booting, no FEL, no serial output (I think it jumps somewhere and hangs)
<kuba2k2>
4. using vendor boot0, using U-Boot as boot1 (wrapped in eGON header / not wrapped / with base addr changed in Kconfig / not changed) - boot0 runs, I see serial output, then hangs at "Jump to Boot1."
<kuba2k2>
5. using vendor boot0 and boot1, putting U-Boot in FAT16 bootloader partition - all three bootloaders run sequentially, but U-Boot can't access neither NAND nor SD-Card - probably Boot1 is leaving them in an unusable state, or something (both media work when booting UB from SD or FEL)
<kuba2k2>
About boot0: it seems that A13 (or this specific board) doesn't detect SPL when written directly to NAND; LiveSuit images are somehow spread into 1140-byte parts over the first 2 megabytes of the NAND (the first MB and second are equal/redundant). The data has some kind of ECC applied, as it doesn't resemble the source binary at all. I don't know if this behavior is specific to A13, but the only place that mentions this specific format is a
<kuba2k2>
thread on Google Groups from 2013.
<gamiee>
kuba2k2: hi, tbh, NAND never worked correctly for me
<kuba2k2>
I think I read the entire wiki by now :) my NAND is 4096B/page, 224B OOB, 24b/1024B ECC. I'm not sure how should I understand the values at the bottom.. is it in "pages" or "bytes"? are they different for 4096B pages (the article mentions 2048B)
<kuba2k2>
here I uploaded first 2MB of the NAND after flashing stock firmware (this boots fine)
<kuba2k2>
you can see how weirdly this is split in 1140-byte chunks on every page
<kuba2k2>
the input SPL file is 24k in size, but on the NAND there are 256 chunks of 1140-byte each, which gives about 290k in total
apritzel has joined #linux-sunxi
kuba2k2 has quit [Quit: Going offline, see ya! (www.adiirc.com)]
la_mettrie has left #linux-sunxi [WeeChat 2.7.1]
kuba2k2 has joined #linux-sunxi
<kuba2k2>
For now I think flashing repacked images with LiveSuit Isa better idea, as it somehow generates that weird chunked format from standard eGON images. So it would help if I knew how to troubleshoot the SPL not running after actually being detected by BROM
kuba2k2_ has joined #linux-sunxi
<kuba2k2>
Which is 3) and 4)
mripard has joined #linux-sunxi
mripard has quit []
kuba2k2_ has quit []
mripard[m] has joined #linux-sunxi
Daanct12 has quit [Quit: Leaving]
paulk1 has joined #linux-sunxi
la_mettrie has joined #linux-sunxi
cnxsoft has joined #linux-sunxi
kuba2k2 has quit [Read error: Connection reset by peer]
kuba2k2 has joined #linux-sunxi
JohnDoe_71Rus has quit []
kuba2k2 has quit []
kuba2k2 has joined #linux-sunxi
<kuba2k2>
There has been some development in https://groups.google.com/g/linux-sunxi/c/Bpp9qaD97tg which actually describes the same issue - jumping to FEL when using "nand write" / failing SCSI operations when using boot0+boot1+u-boot / some images hanging without FEL
<kuba2k2>
I will try to come up with a solution from the last email
kuba2k2 has quit [Quit: Going offline, see ya! (www.adiirc.com)]
JohnDoe_71Rus has joined #linux-sunxi
rajkosto has joined #linux-sunxi
kuba2k2 has joined #linux-sunxi
cnxsoft has quit [Remote host closed the connection]
rajkosto has quit [Quit: Leaving]
<kuba2k2>
okay, after all these days I finally have something successful! SPL image built as described in the last mail boots correctly
<libv>
kuba2k2: congrats, make sure to document your findings :)
<kuba2k2>
will do, after I get a working system
sunshavi_ has joined #linux-sunxi
sunshavi has quit [Ping timeout: 480 seconds]
<kuba2k2>
the thread describes additional steps about preceding Boot1 (u-boot) with 2000h bytes of zeroes, because LiveSuit refuses to flash a plain u-boot binary (it needs the eGON header). Currently, I'm trying to patch the binaries in the LiveSuit image (update_boot1.axf) to do what I tell them :)
kuba2k2 has quit [Quit: Going offline, see ya! (www.adiirc.com)]
chewitt has joined #linux-sunxi
machinehum has joined #linux-sunxi
anarsoul|2 has quit []
anarsoul has joined #linux-sunxi
apritzel has quit [Ping timeout: 480 seconds]
kuba2k2 has joined #linux-sunxi
ftg^ has joined #linux-sunxi
apritzel has joined #linux-sunxi
JohnDoe_71Rus has quit []
kuba2k2 has quit [Quit: Going offline, see ya! (www.adiirc.com)]
kuba2k2 has joined #linux-sunxi
<kuba2k2>
ok, I think I partially know what can the issues be caused by:
<kuba2k2>
while disassembling update_boot1.axf, I see that it's updating offset 0x81D0 of the eGON header - which corresponds to "storage data"
<kuba2k2>
it fills that part with data that it receives from some parent program, I think (i.e. one of the other .axf binaries pass the data here, possibly based on script.fex)
<kuba2k2>
then it *recalculates the checksum* (after first verifying the CRC before modifications), so that Boot0 thinks it's correct
<kuba2k2>
after that, the modified boot1 image is written to NAND
<kuba2k2>
If you take a look at the header of Boot0, "storage data" is on offset 0x1C8
<kuba2k2>
that's probably why flashing the sunxi-spl.bin image from U-Boot mainline using LiveSuit just hangs the board
<kuba2k2>
(because the SPL is corrupted during flashing, by the .axf files)
<kuba2k2>
it just doesn't expect actual program data at that offset - for some reason, sunxi-spl starts at 0x60
mirko has quit [Ping timeout: 480 seconds]
<kuba2k2>
in the thread on Google Groups that I mentioned earlier (and with which I had my first success booting SPL from NAND), the SPL starts at 0x2C8, through a modified mksunxiboot - right after "storage data" - that's why it's not corrupted and it works.
<kuba2k2>
I can't believe it was that simple... to help other people, I will try to document all this in some github repo, and put some of it in the wiki (if I figure out how to)
<gamiee>
kuba2k2: thanks for research. Putting things to wiki is simple, just create account and press edit on the page :)
<kuba2k2>
Sure, thanks. With a bit more time and determination, one could possibly research the exact algorithm for putting boot0 on the NAND, in this weird chunked format... but I don't think that's me :D anyway, I'm another step towards a fully NAND-only system