[Gta04-owner] Replicant images on GTA04 release

Dr. H. Nikolaus Schaller hns at goldelico.com
Sun Sep 16 21:31:57 CEST 2012


Hi Paul,

Am 14.09.2012 um 21:57 schrieb Paul Kocialkowski:

> Le vendredi 14 septembre 2012 à 12:45 +0200, Radek Polak a écrit :
>> On Friday, September 14, 2012 08:45:43 AM Paul Kocialkowski wrote:
>> 
>>>> I quite dont like that the script deletes the whole SD card (or am i
>>>> wrong?). I have 32GB uSD card with 24GB of data on it (mp3, images,
>>>> videos, maps etc..)
>>> 
>>> You're absolutely right, the script will erase the SD card.
>> 
>> In the end i found second SD card for experimenting. I tried the script, but 
>> since the reader in my notebook reckognizes the sd card as /dev/mmcblk0 (and 
>> the partitions are mmcblk0p1) it did not work. But i have modified it to 
>> prepend "p" in front of partition number and now i got now the system SD card.
> 
> Indeed, the flasher script is made to to deal with /dev/sda1 type
> devices. Perhaps it could be extended to support mmcblk as well, though
> it seems quite uncommon on x86 computers.
> 
>> But i was quite surprised i even cant boot from this SD card. It requires me 
>> to flash bootloader and kernel in NAND (or am i wrong?).
>> 
>> Why? I can understand that android likes 3 partitions on SD card, but why it 
>> needs even flashing stuff to NAND. I have in NAND goldelico's kernel and debian 
>> that came with the phone and it's invaluable when i do something wrong with SD 
>> card. Why does replicant requires to delete all non-android bits on the device 
>> to start running? Is there any technical reason to flash NAND?
> 
> So let me explain a bit what's going on here:
> the boot.scr script does flash the kernel to NAND, because I thought
> it's the place it should be (mainly because there is no room for a
> dedicated partition on uSD). However, it is possible to boot the kernel

Ah, I understand. You would have to install the kernel in the FAT partion.

> from sdcard by setting the replicant_sdcard_boot to yes with setenv. 
> The kernel must then be a file called "boot.img" placed at the root of
> the system partition of the sdcard.

Can't you rename it to be uImage? Or is the name required by a kernel
updating process?

> If it seems that inconvenient to you, maybe we could make this the
> default behaviour.

Hm. Why can't you simply provide a modified boot.scr on the SD card?
That one could load the kernel from whatever partition it wants.

> It would indeed permit to keep another system on-NAND. Though, there
> would be the boot.scr issue in order to decide which system to boot
> (since you need a different boot.scr to boot replicant than to boot
> debian). Then you need to flash one in order to boot replicant or
> debian, so it's pretty much the same as flashing the kernel too.

The boot.scr location is determined dynamically. I.e. if you have no SD
card it is searched for in NAND. If you have inserted a SD it comes from SD.

This is made that you can match the boot.scr with the kernel on the
SD card. It is done by:

setenv loadbootscript 'i2c dev 0; mmc rescan ${mmcdev}; if fatload mmc ${mmcdev} ${bootaddr} boot.scr; then echo did load bootscript from mmc; elif nand read ${bootaddr} 250000 10000; then echo did load bootscript from nand; fi'    

Only X-Loader/U-Boot come from NAND unless you press the User
button. Then, both come from SD.

So there is maximum flexibility by this scheme without need to reflash
the NAND to have a different boot.scr.

> Using some bootmenu wouldn't be such a great solution too because
> distros on uSD will have the kernel in different places.
> 
> Then, the solutions could be not to flash boot.scr and leave it in the
> first partition, required to be fat32, or to put the kernel in a
> specific place on the uSD card (likely on the first fat32 partition as
> well), that would be the same for all distros and that would be used by
> the bootmenu.

Yes, this is a scheme that IMHO should work for any Linux system.

> 
>> I think it will be quite hard for normal users to install normal distro again. 
> 
> I'm pretty sure that a normal install of any distro will erase the
> current boot.scr and replace it by the provided one. I don't see what
> the difference for the user would be.

NAND is touched only if the boot.scr on the SD card instructs U-Boot
to do so. This is of course the default behaviour of the Goldelico system:

http://git.goldelico.com/?p=gta04-uboot.git;a=blob;f=boot-scr/boot.txt;h=71487643607fb32ed95ac2e2c5d15ee85d5f0d80;hb=HEAD

But this feature is mostly intended to initially flash the device during
production testing.

> 
>> I spent many hours troubleshooting Freerunner users because of non standard 
>> bootloader that Android on Freerunner was using. Could we please avoid this on  
>> GTA04... 
> 
> The bootloader here is just a very standard uboot from goldelico tree.
> It is provided in order to flash a more recent version than the one
> currently on the device. I don't see why that could be a bad idea.

Ah, do you just *update* the u-boot to be the latest you know? This
is a little different than what I had thought.

different versions of Goldlico U-Boot and boot.scr are stored in the
GTA04 setenv variable in NAND. And a boot.scr on SD card with
a different number triggers the reflashing (if included in the boot.scr).

> There is nothing non-standard in it like it was with qi on freerunner.

Hope this helps to a better understanding of the problem(s) and
solution(s).

BTW: I am experimenting with modifying the U-Boot menu to have 9 choices.
Then, it could be easy to choose to boot from different SD partitions (in
addition to NAND).

It would work as follows:

if someone presses "MMC0", "MMC1", "MMC2" or "MMC3" the kernel is searched
as ext2 on this partition as /boot/uImage. If it loads, the bootargs are
updated to match the partition. And u-boot tries to execute /boot/bootargs.scr
if it exists to allow for partition specific bootargs. If it was possible to boot,
this setting is made permanent in NAND so that it is used in the next boot
without menu.

This should allow to have a full set bootargs, kernel and rootfs to reside in
a single ext2/3/4 partition. And have up to 4 different of these on a single
SD card. If partitions do not exist, are not ext or FAT or don't have a kernel they
can't be used to boot of course.


BR,
Nikolaus

> 
> -- 
> Paul Kocialkowski, Replicant developer
> 
> Replicant is a fully free Android distribution
> 
> Website:        http://www.replicant.us
> Wiki/Tracker:   http://redmine.replicant.us
> 
> _______________________________________________
> Gta04-owner mailing list
> Gta04-owner at goldelico.com
> http://lists.goldelico.com/mailman/listinfo/gta04-owner



More information about the Gta04-owner mailing list