Boot From Sd - Boot Problems


Cannibal

Still Fresh
Joined
Nov 22, 2005
Messages
55
Age
44
Location
Oxford, UK
Website
Visit site
Hi,

Partitioned an SD card with as EXT2 with a 512MB Swap partition, using GParted on Ubuntu 10.10.

I followed: http://pandorawiki.o...rom_an_SD_card, used the second example 'autoboot.txt', the problem is I've only gotten my Pandora to boot from SD twice... On next boot it just sticks on the Pandora logo, hard-resetting then holding R-Button I can see lots of errors about failure to read 'autoboot.txt', then the kernel image ending with a CRC error.

So I formatted and extracted the Pandora image again to the SD, still wouldn't boot same errors. Booted from NAND, restarted then it now decided to boot from the SD.
This seems to be a common theme, If I'm to have any chance of booting from SD I MUST boot from NAND then restart to get it to boot from SD, cold boot never succeeds, the last time I did this however all the fonts were squares... sounds like corruption?

Camera shot of the boot error:

BootErr.jpg


UPDATE: Tried using mkfs.ext2, no better... tried doing the format and the unpack on the Pandora itself... no good.
UPDATE2: Both my SD cards do the same, doesn't sound like corruption to me.
UPDATE3: This looks like it could be a bug U-boot? http://www.mail-arch...e/msg26953.html & http://plugcomputer....age;topic=517.0

This looks very relevant: http://lists.denx.de...une/072198.html - [U-Boot] cannot load file from ext2 partition on OMAP3 evm

UPDATE4: Logged as a bug that needs verification: http://bugs.openpand...ils&task_id=192
UPDATE5: Found the code responsible /fs/ext2/dev.c in u-boot-1.3.2.tar::

Code:
    if (ext2fs_block_dev_desc->block_read (ext2fs_block_dev_desc->dev,
                           part_info.start + sector,
                           block_len / SECTOR_SIZE,
                           (unsigned long *) buf) !=
        block_len / SECTOR_SIZE) {
        printf (" ** ext2fs_devread() read error - blockn");
        return (0);
    }

Answers on a postcard... ?

Thanks.
 
As an immediate work around, use the multiple partition example. Destroy all your partitions to start from scratch. I know for a fact that FAT loading works, the ext2 loader may need some work though. The FAT partition doesn't need to be that big, only a couple hundred K really, but for safety make it 50MB.
There's two ways of doing it: leave the /boot on the EXT2 and try to load it from there, or copy it to the FAT and load it from there. Try both, though I suspect if you're having problems loading from the EXT2 directly it won't do any better to just load the u-image from it.

edit: and for clarity, if you copy the contents of /boot to the FAT partition (which must be created first!) your autoboot.txt will look like this:
Code:
setenv bootargs debug root=/dev/mmcblk0p2 rw rootdelay=2 console=ttyS0,115200n8 vram=6272K omapfb.vram=0:3000K
fatload mmc 0 0x80300000 uImage
bootm 0x80300000'
 
Many thanks for the workaround, I've read that you can create a Swap partition, will Angstrom use it if I simply create one
Update: The workaround worked a charm! Thanks again.
 
Probably won't add start it automatically. Type "free -m" in a terminal to see if it has swap or not (it'll say swap, but under total it'll either be 0 or not 0)
If it didn't pick it up automatically you'll have to manually add it to the /etc/fstab file. Just add the line
Code:
/dev/mmcblk0p3       none    swap    sw      0       0
 
Thanks again! I get squares instead of the font loading... Something still isn't right. Wow, if I knew it was going to be this much trouble...
 
It usually isn't. I honestly have no idea what is wrong. When I did it, it was just a straight drop and go.
 
Phew... for anyone following, in the end I unpacked the tar file again to the SD whilst booted from the NAND and everything seems fine now... *fingers crossed*
 
Things are still very flakey, Wifi password will never save to the keyring, opkg just hangs... could this be a hardware fault on my Pandora? Or perhaps the ext2 driver on SDHC cards isn't very robust?
Occassionally I'm left with a black screen whilst booting. Just to rule out permissions, is there a way to reset permissions across the filesystem? NAND has none of these problems.
 
Could be some corruption on your SD card. Try running an fsck against it, and also try h2testw to see if there are any bad blocks.
 
WizardStan said:
Could be some corruption on your SD card. Try running an fsck against it, and also try h2testw to see if there are any bad blocks.

Both SD cards are working fine, although I had made an 'oopsie' at one point directing mkfs to the entire device rather than a partition - school boy mistake.

Right looks like I've gotten to the bottom of this with some pointers from Notaz, it seems that the Pandora I recieved did not have the latest version of U-Boot installed, once I had installed the latest complete flash update, I immediately noticed more boot options were visible and it now boots from EXT2, generally speaking (as you said before) the EXT2 driver needs work so the general recommendation is to go with NAND for now as UBIFS and it's wondering tree stuff should be enough to stop any real concern over wear.

Thanks for the help on this.
 
Last edited by a moderator:
hey stan, a bit off topic but I don't want to start a new topic:

I just loaded up the image and am booting fine from sd but I was just wondering, do I need to have a swap partition? I formatted an entire 8gig to ext2 without a swap partiton. What would I need a swap for? I mainly decided to boot from sd so that I can install packages and keep my nand clean and at factory so I can test my scripts on a factory system. Should I reformat and add a swap?
 
You don't need swap. It won't really gain you very much. Sometime down the road, you may encounter a situation where a particularly large program requires more memory, in which case you can actually just create a swap file on the SD card. Swap files are almost as efficient as swap partitions, especially on flash media with no seek time.
To create a swap file:
Code:
sudo su (enter password)
dd if=/dev/zero of=/swapfile1 bs=1024 count=524288
mkswap /swapfile1
swapon /swapfile1
exit
That'll create a 512MB swap file, which is suitable for a 256MB ram space. Every time you want to use swap, you'll need to run "sudo swapon /swapfile1", or you can modify /etc/fstab and add the line
Code:
/swapfile1 swap swap defaults 0 0
to get it to start automatically at bootup.
Really swap isn't all that important so long as you're careful. It can save you, but at the same time it can make the system run slow if you abuse it.
 
Thanks :)
is there a reason I need sudo for everything I do to my boot sd? It's like the whole card is write protected now, I can't delete or create files in a windows manager, I have to do everything in terminal with sudo, is that normal? can I turn it off?
 
EXT2 is a permissioned file system and it is behaving exactly as expected. Only root user can edit most files across the system. The only files a regular user should be able to modify/delete/create are in their /home directory. If you want to make a particular directory fully read/write for anyone, run "sudo chmod -r a+w <directory>". You can make the entire card writable with "sudo chmod -r a+w /". DO NOT DO THAT! IT IS DANGEROUS! Not really really dangerous, but it's one of the ways Linux is kept safer than Windows.
Think about why you want to do this though, and see if there's a better way. What files are you editing regularly?
 
I wanted to make a pandora directory for pnd's, I'll just make that directory unprotected I guess, How do I sign in as root user?
 
From a terminal, "sudo su" will let you promote yourself to super user temporarily.
There should already be a /pandora directory in the firmware. "sudo chmod a+w /pandora" will give you a place to stick your PND files unencumbered.
I'm pretty sure the /pandora directory is part of the PND system's search path, anyway. Hopefully it is.
Alternatively, you could create two partitions on that card. Make the first one a large FAT or NTFS partition so it can be read and written by windows if you find yourself in that situation (or not, either way is fine), and stick your PND, MP3, AVI, ROMs, etc...
 
WizardStan said:
..., run "sudo chmod -r a+w <directory>...".
Erm, isn't the upper case option 'chmod -R' and not 'chmod -r' for recursively changing mode?
 
Last edited by a moderator:
ricki said:
Erm, isn't the upper case option 'chmod -R' and not 'chmod -r' for recursively changing mode?
yes it is. Good catch.
 
Last edited by a moderator:
Back
Top