linaro-image-tools create wrong bootargs for arndale

Bug #1231266 reported by vishal
18
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Linaro Android
Fix Released
High
Pranav Tipnis
Linaro Image Tools
Fix Released
High
Milo Casagrande

Bug Description

linaro-image-tools create wrong bootargs for arndale resulting in partitions not mounting.

Related branches

vishal (vishalbhoj)
Changed in linaro-android:
importance: Undecided → High
assignee: nobody → Pranav Tipnis (pranav-tipnis)
Milo Casagrande (milo)
Changed in linaro-image-tools:
assignee: nobody → Milo Casagrande (milo)
milestone: none → 2013.10
importance: Undecided → High
status: New → Confirmed
vishal (vishalbhoj)
Changed in linaro-android:
milestone: none → 13.10
Milo Casagrande (milo)
Changed in linaro-image-tools:
status: Confirmed → In Progress
Revision history for this message
Milo Casagrande (milo) wrote :

Linked branch addresses the error with the wrong newline in the boot command args. It needs to be tested that it really solves the original problem.

Revision history for this message
vishal (vishalbhoj) wrote :

Here is some discussion from IRC:
<Gwaihir> bhoj, can you test this branch of l-i-t: https://code.launchpad.net/~milo/linaro-image-tools/bug1231266
<Gwaihir> bhoj, that addresses the problem with the newline in the boot command args, but needs to be tested with a real boot
<bhoj> Gwaihir, sure.
* pfalcon (~pfalcon@95.15.190.251) has joined #linaro-infrastructure
<bhoj> Gwaihir, the newline issue is resolved but that doesn't seem to be the reason for the bug. We still see the same boot failures. Thanks for the fix. It could be an issue in the bootloader . Will investigate it.
<Gwaihir> bhoj, ack, it would be good to understand why passing the values at boot fix the problem, if the values are always the same...
<bhoj> Gwaihir, the board is not reading the bootargs currently from the boot.scr which we have instead it has some other bootargs set and I am not sure from where they come.
<bhoj> Gwaihir, once we set the manually from u-boot's console we can then boot the board.

Revision history for this message
vishal (vishalbhoj) wrote :

Pranav,

Can you please print and share the boot commands set on your board. The boot commands set by default on the board in my case and Botao is this:
ARNDALE5250 # print
bootargs=console=tty0 console=ttySAC2,115200n8 drm_kms_helper.edid_firmware=edid-1920x1080.fw root=UUID=907abf0b-9c87-4586-80da-980733dd6b32 rootwait ro
bootcmd=fatload mmc 0:2 0x40007000 uImage; fatload mmc 0:2 0x42000000 uInitrd; fatload mmc 0:2 0x41f00000 board.dtb; bootm 0x40007000 0x42000000 0x41f00000
ethact=asx0
ethaddr=02:76:4c:d6:16:33
fdt_high=0xffffffff
initrd_high=0xffffffff
preboot=usb start
stderr=serial
stdin=serial
stdout=serial
usbethaddr=02:76:4c:d6:16:33

Environment size: 502/16380 bytes

Its not reading the bootargs from boot.scr.

Revision history for this message
Botao (botao-sun) wrote :

@pranav-tipnis, here is the output of "print" in u-boot prompt after boot with a fresh flashed SD card with Samsung Arndale build 199 and Linaro Image Tools version 645:

ARNDALE5250 # print
bootargs=console=tty0 console=ttySAC2,115200n8 androidboot.hardware=exynos5250-arndale fbdev=/dev/graphics/fb2 ip=dhcp init=/init
bootcmd= fatload mmc 0:2 0x40007000 uImage; fatload mmc 0:2 0x40050000 uInitrd; fatload mmc 0:2 0x41f00000 board.dtb; bootm 0x40007000 0x40050000 0x41f00000
ethact=asx0
ethaddr=02:0c:8f:56:16:33
fdt_high=0xffffffff
initrd_high=0xffffffff
preboot=usb start
stderr=serial
stdin=serial
stdout=serial
usbethaddr=02:0c:8f:56:16:33

Environment size: 479/16380 bytes
ARNDALE5250 #

You also can find all contents in "/boot" directory of my fresh flashed SD card, refer to attachment.

Revision history for this message
Pranav Tipnis (pranav-tipnis) wrote :

Hello everyone,

Here is the u-boot env variables set on my SD card:

==========================================================
ARNDALE5250 # print
baudrate=115200
bootcmd=if mmc rescan ${mmcdev}; then if run loadbootscript; then run bootscript; else if run loaduimage; then run mmcboot; fi; fi; fi
bootdelay=3
bootscript=echo Running bootscript from mmc${mmcdev} ...; source ${loadaddr}
console=ttySAC2,115200n8
ethact=asx0
ethaddr=02:8e:8f:56:16:33
loadaddr=0x42000000
loadbootscript=fatload mmc ${mmcdev} ${loadaddr} boot.scr
loaduimage=fatload mmc ${mmcdev} ${loadaddr} uImage
mmcargs=setenv bootargs console=${console} root=${mmcroot}
mmcboot=echo Booting from mmc${mmcdev} ...; run mmcargs; bootm ${loadaddr}
mmcdev=0:2
mmcroot=/dev/mmcblk0p2 rw
preboot=usb start
stderr=serial
stdin=serial
stdout=serial
usbethaddr=02:8e:8f:56:16:33

Environment size: 731/16380 bytes
========================================================

I am attaching my boot.txt here. If everyone's boot.txt is same then the problem is not in linaro-image-tools create utility.

The env variables that Vishal shared has correct "bootcmd" but incorrect "bootargs" and the env variables shared by Botao has correct "bootargs" but incorrect "bootcmd".
But in both case the "bootcmd" does not refer to boot.scr. My "bootcmd" correctly loads and runs boot.scr.

Now, this may be because you might have used the same SD card for some other board or might have changed the env variables and did "saveenv". Flashing SD card for arndale using linaro-image-tool does not over-write the env variable section starting from 1073 to 1105 on SD card.

Solution:
The solution to this problem is to set env variables as per my env variables, particularly, bootcmd, mmcdev, loadbootscript, loaduimage, mmcboot, loadaddr and then save env variables using "saveenv" command.

Alternatively you can erase env section by following command:
# dd if=/dev/zero of=/dev/sdc seek=1073 bs=512 count=32
But even then you will have to set env variables and then saveenv. So I would suggest not to erase env variables.

Once you set env variables according to my settings and do saveenv, your subsequent boots will be successful.

Please let me know if you still face the issue

Regards,
Pranav

Revision history for this message
Botao (botao-sun) wrote :

@pranav-tipnis, So here you mean a manually boot environment setting is required for at least the first boot of Samsung Arndale Android, right? I ask because I also did a test last week like this:

1. Using GParted to delete all existing partitions on my SD card;
2. Re-create partition table in GParted for my SD card (MSDOS by default);
3. Format entire SD card to ext4;
4. Using Linaro Image Tools to flash Samsung Arndale Linaro Android image to SD card;
5. Boot the board.

Then same issue occurred. That means, an end-user with a brand new SD card who wants to use Linaro Image Tools to flash Android image to boot Arndale board will be failed, because a manually boot environment setting is required in this condition, which is unnecessary for all other boards. If this is as expected, then we'd better to write it into our release notes as a reminder to end-users.

Revision history for this message
Soumya Basak (soumya-basak) wrote :

Hi,

here is the output of "print" in u-boot prompt with Samsung Arndale build 199 and Linaro Image Tools version 645:

==============================================================================================

ARNDALE5250 # print
baudrate=115200
bootcmd=if mmc rescan ${mmcdev}; then if run loadbootscript; then run bootscript; else if run loaduimage; then run mmcboot; fi; fi; fi
bootdelay=3
bootscript=echo Running bootscript from mmc${mmcdev} ...; source ${loadaddr}
console=ttySAC2,115200n8
ethact=asx0
ethaddr=02:74:ac:95:16:33
loadaddr=0x42000000
loadbootscript=fatload mmc ${mmcdev} ${loadaddr} boot.scr
loaduimage=fatload mmc ${mmcdev} ${loadaddr} uImage
mmcargs=setenv bootargs console=${console} root=${mmcroot}
mmcboot=echo Booting from mmc${mmcdev} ...; run mmcargs; bootm ${loadaddr}
mmcdev=0:2
mmcroot=/dev/mmcblk0p2 rw
preboot=usb start
stderr=serial
stdin=serial
stdout=serial
usbethaddr=02:74:ac:95:16:33

Environment size: 731/16380 bytes
ARNDALE5250 #

board boot successfully after trigger boot.txt commands.

I am attaching my boot.txt here it is same as above ;

Revision history for this message
Pranav Tipnis (pranav-tipnis) wrote :

@botao-sun: No, manually setting env variables is just a temporary solution.

Ideally, lamc should write env variables for arndale while flashing SD card. But currently, it does not update env variables if env variables are already present. Let me elaborate further.

Here are my recent observations on different approaches:

1) I changed bootargs and bootcmd (setting it to incorrect values) in my SD card. Then I flashed my SD card using lamc. The lamc did not update env variables and the boot failed as I had set wrong bootargs and bootcmd.

2) I erased my SD card (bl1, spl, u-boot, and env section) completely. Then I flashed my SD card using lamc. This time lamc updated env section with correct values. So it seems that lamc updates env section only if it is zero. I don't know the intricacies of lamc, but this is my assumption from the observation.

What you did by re-partitioning SD card did not erase env section. Hence you still faced the boot failure issue.

Here is the steps you can follow to erase SD card and flashing SD card through lamc. This should boot without any manual intervention:

# dd if=/dev/zero of=/dev/sdc count=2000 bs=512 (This will erase bl1, spl, u-boot, and uboot env section)

# linaro-android-media-create --mmc /dev/sdc --dev arndale --boot boot.tar.bz2 --system system.tar.bz2 --userdata userdata.tar.bz2 (Flash SD card with arndale images)

The above steps should work without manual setting of any env variables.

@Vishal,
So the bug seems to be in linaro-image-tools only. It does not update env section if something is present. But it writes correctly in case env section is all zeros. This is my observation. Please try at your end to verify.

Revision history for this message
Botao (botao-sun) wrote :

@pranav-tipnis, Yes, after ran the command you mentioned in comment #8, now the board can be booted up successfully. The weird thing here is, as you said, the GParted actually didn't erase the env section, even after I re-created the partition table, which is surprised me because I thought re-create partition table will erase everything.

Attachment is the boot log comes from the procedure list I described on comment #6.

So here brings another topic, assuming I used Linaro Image Tools to flash my SD card for Samsung Arndale Android, then if I don't run that dd command in future, the data in env section will be always there, whatever I delete, re-create partition and partition table, right?

vishal (vishalbhoj)
Changed in linaro-android:
milestone: 13.10 → 13.11
Revision history for this message
Milo Casagrande (milo) wrote :

As requested by Vishal, posting my question here to summarize it all: what is actually needed to fix this?

Is the call to dd (with those parameter as in comment #8) sufficient? lamc already calls "dd" on the device passed: the only parameter that might be missing is the "count=2000", since that is not hardcoded in lamc, but found in the config file (or Android hwpack file).

The command run, is this:

cmd = ["dd", "if=%s" % input_file, "of=%s" % output_file, "bs=%s" % block_size, "conv=notrunc"]

where:
- input_file is /dev/zero
- output_file is the device passed on the command line
- block_size is 512

If the count parameter is defined in the config file, it will be added to the above command. The variable that defines the count parameter is called samsung_env_len.

Fathi Boudra (fboudra)
Changed in linaro-android:
milestone: 13.11 → 13.12
Changed in linaro-image-tools:
milestone: 2013.10 → 2013.12
Changed in linaro-android:
status: New → Fix Committed
Changed in linaro-image-tools:
status: In Progress → Fix Committed
Milo Casagrande (milo)
Changed in linaro-image-tools:
milestone: 2013.12 → 2014.01
milestone: 2014.01 → 2013.12
status: Fix Committed → Fix Released
Revision history for this message
Botao (botao-sun) wrote :

Verified on Samsung Arndale Linaro Android 13.12 release image:

http://releases.linaro.org/13.12/android/arndale/

With the latest version of Linaro Image Tools:

$ git clone git://git.linaro.org/infrastructure/linaro-image-tools.git

System can boot up successfully with the Micro SD card flashed by following command:

$ sudo ./linaro-image-tools/linaro-android-media-create --mmc /dev/sdd --dev arndale --boot boot.tar.bz2 --system system.tar.bz2 --userdata userdata.tar.bz2

Fathi Boudra (fboudra)
Changed in linaro-android:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.