Android Tablets Forum banner
1 - 18 of 18 Posts

·
FW Developer
Joined
·
685 Posts
I noticed the "utscript_sd" file which I understand is used to perform install into the internal SD card when NAND is not available. I have a question about these lines:
Code:
uttext  20 70 "Update bootloader..."<br />
fatload mmc 1 20008000 u-boot-sd.bin<br />
mmc write 0 20008000 0x0 0x800<br />
fatload mmc 1 20008000 u-boot.arg<br />
mmc write 0 20008000 0x11 0x20
Specifically I have a question about the fourth line, where the bootloader arguments are written at location 0x11. This would (I believe) certainly corrupt the bootloader which was written before. The location should be 0x400, not 0x11. Considering the locations where "recovery", "kernel" and "logo" are written the bootloader arguments are certainly written into the wrong place. Can anyone confirm?
 

·
Registered
Joined
·
41 Posts
I think You are right. I have a Dropad A8 that comes without internal NAND and since the utscript_sd changed I could not get it to boot, with any of the new firmwares, only if I replaced the u-boot and utscript files with the old versions. Currently I don't have the opportunity to test the theory, because I need a working tablet right now, but I compared the old and new utscript_sd and also compared it with the nand version and the difference seems to be obvious. The nand version copies the u-boot.arg after the u-boot.bin and no one seems to have problems with that. Great finding!
 

·
Banned
Joined
·
432 Posts
Please, notice the write part:

Code:
fatload mmc 1 20008000 u-boot.arg<br />
mmc write 0 20008000 0x11 0x20
It means, that it loads u-boot.arg from MMC1 (external) to RAM address 0x20008000, then writes MMC0 from 0x11, 0x20 long. What means, it will only write 20 bytes, such, it won't overwrite the bootloader.
 

·
Registered
Joined
·
41 Posts
Compare it with utsript from fw 0531 or any older FW. They all have the same utscript. My experience shows that it does overwrite the bootloader not completely, just rendering it unbootable. The nand script contains different addresses even for the writes.
'fatload mmc 1' is to read the files from the external SD.
'nand write' parameters are 1.: read address (20008000 as below), 2.: write start address (80000 as below) and 3.: number of bytes to write
'mmc write' 1. parameter is card to write to, other as above.

NAND version:

fatload mmc 1 20008000 u-boot.bin
nand erase 0 100000
nand write 20008000 0 80000
fatload mmc 1 20008000 u-boot.arg
nand write 20008000 80000 80000


SD version:
uttext 20 70 "Update bootloader..."
fatload mmc 1 20008000 u-boot-sd.bin
mmc write 0 20008000 0x0 0x800
fatload mmc 1 20008000 u-boot.arg
mmc write 0 20008000 0x11 0x20


So u-boot.arg is written in the nand after u-boot.bin. While on the SD over it.
 

·
Banned
Joined
·
432 Posts
Compare it with utsript from fw 0531 or any older FW. They all have the same utscript. My experience shows that it does overwrite the bootloader not completely, just rendering it unbootable. The nand script contains different addresses even for the writes.
'fatload mmc 1' is to read the files from the external SD.
'nand write' parameters are 1.: read address (20008000 as below), 2.: write start address (80000 as below) and 3.: number of bytes to write
'mmc write' 1. parameter is card to write to, other as above.

NAND version:

fatload mmc 1 20008000 u-boot.bin
nand erase 0 100000
nand write 20008000 0 80000
fatload mmc 1 20008000 u-boot.arg
nand write 20008000 80000 80000


SD version:
uttext 20 70 "Update bootloader..."
fatload mmc 1 20008000 u-boot-sd.bin
mmc write 0 20008000 0x0 0x800
fatload mmc 1 20008000 u-boot.arg
mmc write 0 20008000 0x11 0x20


So u-boot.arg is written in the nand after u-boot.bin. While on the SD over it.
a bit wrong.
There are a few commands in u-boot, lemme show you:
Every command set has arguments, or subcommands plus arguments.
nand has subcommands (erase, write, read, etc), plus arguments.
nand erase takes two arguments, first is start adress, second is length
nand write takes three address, first is input start from RAM offset, second is start address on NAND, third is the length
nand read works the same way

mmc has one more argument, what defines which SD card we are talking about. 0 is internal, 1 is external.
fatload takes the input the following way:
fatload [source device] [source device ID if needed] [RAM offset to read to] [file to read into RAM]
so we could easily modify it to read from NAND too:
fatload nand 4 20008000 system/update.img
in this case it would read the file /system/update.img from NAND's 4th partition (by MTD, that's the rootfs partition), and write it to RAM's 0x20008000

But your conclusion is right, the SD only script writes the arguments into the bootloader. No idea why.
 

·
Registered
Joined
·
41 Posts
It would be nice to have here someone else who has no NAND in the tablet, to see what is their experience with the latest ROMs (after 0531). As of now, I will have some time to experiment with this around Christmas
(If no ICS ROM comes up till then ...)
 

·
FW Developer
Joined
·
685 Posts
Discussion Starter · #8 ·
@fonix232:
Code:
mmc write 0 20008000 0x11 0x20
From what I've seen (with my experiments for creating the backup\restore script, and as pointed by another user, steev), mmc commands always take the sector as input. So the command actually writes 0x20 sectors (ie. 0x4000 bytes or 16KiB) starting from the 0x11 sector (ie. 0x2200 byte or 8704th byte). This means that approximately 8KB of the bootloader is valid (the entire bootloader is quite larger, also subtract 512 for MBR if it's sitting in the internal SD). I was wondering in case this script was written by someone, they would know why this is done. But it looks like this script comes from Urbetter (does it?)
 

·
Banned
Joined
·
432 Posts
@fonix232:
Code:
mmc write 0 20008000 0x11 0x20
From what I've seen (with my experiments for creating the backup\restore script, and as pointed by another user, steev), mmc commands always take the sector as input. So the command actually writes 0x20 sectors (ie. 0x4000 bytes or 16KiB) starting from the 0x11 sector (ie. 0x2200 byte or 8704th byte). This means that approximately 8KB of the bootloader is valid (the entire bootloader is quite larger, also subtract 512 for MBR if it's sitting in the internal SD). I was wondering in case this script was written by someone, they would know why this is done. But it looks like this script comes from Urbetter (does it?)
You might be right, I never dug myself into the no-NAND devices' world

And yes, it came from Urbetter.
 

·
FW Developer
Joined
·
685 Posts
Perfect. That means Urbetter did not miss any file for SD-upgrade, they instead messed it. But now I believe it should no longer be a problem - for all no-NAND devices a fix is at hand. I'd advise future firmware updates (from everyone) to fix this.

EDIT:
This should fix it:
View attachment utscript_sd.zip

But still someone needs to test it...
 

Attachments

·
Registered
Joined
·
41 Posts
I've tested it with the Haipad M7 1010 firmware and it works!

[Old news: Ok, I've tested it with Genesis 3.0. It is somewhat better, as now it still doesn't boot after the upgrade, but at least the external rescue disk works
So I can recover without a screwdriver

Maybe I should try with an official FW first ...
]
 

·
FW Developer
Joined
·
685 Posts
Discussion Starter · #13 ·
@fonix232:
Hahahaha... yes that's what I meant. I didn't see any missing file... so this is my guess.

@asterx:
Thanks for testing. Now we know for sure. I don't understand why doesn't it work with Genesis... will try looking into it.
 

·
Registered
Joined
·
41 Posts
@asterx:
Thanks for testing. Now we know for sure. I don't understand why doesn't it work with Genesis... will try looking into it.
Well, Prox said, that he is rebuilding the partition table from scratch in the utscript.sh. It might be interfering with the kernel on the SD. However on a NAND device this would not be a problem, as the kernel is in the NAND there.
 

·
Registered
Joined
·
41 Posts
Yes... quite possible... that must be it.
I've looked into the problem, and I don't know if anyone is still interested in the Genesis ROM, but I found that the problem lies in utscript.sh. It is mounting the root partition at the wrong time when it is not yet created in case of SD only devices. I've moved

Code:
mount -t ext4 /dev/mmcblk0p4 /mnt/root
from its original location after
Code:
mount -t ext4 /dev/mmcblk0p3 /mnt/data
and now the installation works fine.
 

·
Registered
Joined
·
71 Posts
Perfect. That means Urbetter did not miss any file for SD-upgrade, they instead messed it. But now I believe it should no longer be a problem - for all no-NAND devices a fix is at hand. I'd advise future firmware updates (from everyone) to fix this.

EDIT:
This should fix it:
View attachment 3251

But still someone needs to test it...
Put please once again. Link does not work. I want to try. I'm dead tablet. Thank you.
 
1 - 18 of 18 Posts
Top