PNY Optima SSD support? [workaround]

Got problems with your B2 or B3? Share and get helped!
Post Reply
Gordon
Posts: 1346
Joined: 10 Aug 2011, 03:18

PNY Optima SSD support? [workaround]

Post by Gordon » 08 May 2015, 05:25

I'm having some issues with this drive. Using the latest Gentoo live USB, which uses UUID, I managed to start my B3 with the drive connected. I can see the partitions I created earlier, with the content from my original disk, but the B3 won't boot from it. I created a fresh installation on it, to no avail. When trying to boot from the disk the B3 goes into some kind of cold boot loop, where if I press the rear button when all the leds turn off, it switches to programming mode (which would normally require me to unplug the power).

I feel reluctant to create a serial console connection on it and actually wonder if it would give me any information at all. Can I assume this is a u-boot issue?
Last edited by Gordon on 05 Jun 2015, 04:30, edited 1 time in total.

redw0001
Posts: 96
Joined: 07 Sep 2009, 14:03

Re: PNY Optima SSD support?

Post by redw0001 » 08 May 2015, 05:56

I have a B3 running with a Crucial SSD, so far it is not doing much, only got FTP server and OwnCloud running on top of the latest Arch live USB, however I have copied it all to the SSD as described in the doc. If there is anything I can do to check out anything in my setup to help let me know.

Sorry, gave up on Gentoo due to the apparent amount of work needed in maintenance.

Gordon
Posts: 1346
Joined: 10 Aug 2011, 03:18

Re: PNY Optima SSD support?

Post by Gordon » 08 May 2015, 06:44

Well, the nice thing about the latest Gentoo Live USB is that it does not get confused by whether a drive is connected or not, or recognized. Using an older version of the Live USB I could not get it to boot as well, but I don't really know if I had the 'with disk' or 'without disk' version on that stick.

What I can confirm is that the disk works in the B3 after a kernel has been loaded. It's just that it won't boot from it, not from an existing install that was cloned onto it and not from a fresh install (which includes writing a new partition table). I would also not normally expect the B3 to go into the cold boot loop as the normal behaviour for a PANIC would be to go into stall.

Gordon
Posts: 1346
Joined: 10 Aug 2011, 03:18

Re: PNY Optima SSD support?

Post by Gordon » 09 May 2015, 05:25

I figured I should try something else and let the B3 boot from a thumb drive as described in THIS topic. Can't seem to make it work though.

I changed:

Code: Select all

fw_setenv bootalt1 run usbinstall \|\| run sataboot \|\| reset
fw_setenv bootcmd run usbinstall \|\| run sataboot \|\| reset
Strangely, the entire flash becomes locked after every time I use fw_setenv and I had to install mtd-utils to release it, not only to be able to change other environment variables in mtd1 but also to be able to use the shutdown command sequence on the B3 (which writes a magic entry to mtd2).

But the main thing is: it doesn't work. Obviously running usbinstall first is just for testing, but it still boots from sata. Am I missing something here?
Last edited by Gordon on 09 May 2015, 12:28, edited 1 time in total.

sakaki
Posts: 172
Joined: 15 Aug 2014, 11:20

Re: PNY Optima SSD support?

Post by sakaki » 09 May 2015, 09:45

Hi Gordon,

I have a similar issue with a Samsung SSD: it won't boot under U-Boot when in the B3, but it will I/O OK once Linux (with its independent drivers) is up and running (via a live-USB, for example). So I think it's likely there is some compatibility issue with U-Boot's sata drivers and certain SSDs (just as there are issues with its USB drivers, which is why the B3 (and other devices) will only boot reliably with certain kinds of USB stick, even though pretty much any USB stick will work with the B3 once Linux is up).

Not all SSDs have this issue: our 'production' B3s at home use Intel SSDs as their internal drive (to minimize noise), and these boot just fine (under Gentoo and Arch).

best

sakaki

Gordon
Posts: 1346
Joined: 10 Aug 2011, 03:18

Re: PNY Optima SSD support?

Post by Gordon » 09 May 2015, 16:45

I think Samsung uses the same Silicon Motion controller as PNY for some of their (low budget) SSD's, so that seems logical. The new Crucial BX range is mentioned to use it as well, so those are bound to fail as well.

So the challenge here is how do I change the boot sequence so that I can still use this drive? Other than in the previously linked topic I would only want to move boot to the USB thumb drive and leave root on sda.

sakaki
Posts: 172
Joined: 15 Aug 2014, 11:20

Re: PNY Optima SSD support?

Post by sakaki » 09 May 2015, 18:00

Hi Gordon,

forcing USB boot without the button pressed down should certainly be possible, I think...

As you have no serial connection on the B3 in question, would you mind trying the following boot tests?
  1. with the Gentoo live-USB plugged in (and no other USB devices plugged in), the stock U-boot environment, no internal drive in the B3, with the button pressed when the power is applied? (it should boot OK, obviously, but just as a control...)
  2. as for 1, but with your modified U-boot environment? (again, it should be fine, unless fw_setenv is doing something odd...)
  3. as for 2, but with the button unpressed when you apply power (if this does not work, probably the bootalt1 command is at issue, somehow)
  4. as for 3, but with a known-good HDD in the B3
  5. as for 3, but with the PNY SSD in the B3 (again, from what you have said I assume it will fail, but just to double-check)
  6. as for 5, but with the button held down on boot
Also, what colour LED do you see initially when trying to boot in each case?

I am travelling at the moment, so can't try a test on my own machine unfortunately...

best, sakaki

Gordon
Posts: 1346
Joined: 10 Aug 2011, 03:18

Re: PNY Optima SSD support?

Post by Gordon » 10 May 2015, 02:46

  1. did that before - this is actually a brand new unit
  2. need to verify on one of the other units - see #3
  3. probably behaved a bit different - it went into a ~1 second cold boot loop (NIC leds flashing together with the purple light). I know it's a cold boot because I can press the button to enter programming mode (green led) but I need to keep it pressed for 2-3 seconds or it continues the loop
  4. boots from disk
  5. ~40-45 second cold boot loop
  6. normal behaviour - enters programming mode
Note: from what I read at Denx the normal u-boot executes what's in the bootcmd environment variable. I've got a strong feeling that this variable is ignored in the B3's u-boot and it executes bootalt1/-2 instead, depending on button state. Another thing I noticed is that most of the environment variable assignments also occur within the u-boot image itself (all except the units unique values - MAC/key/serial). My guess is that the defines in mtd0 take preference over what is defined in mtd1 and thus I'm afraid the soldering equipment will need to come out of storage.

Question: does Moette's version of u-boot also have these values predefined in the image itself?

MouettE
Site admin
Posts: 264
Joined: 06 Oct 2011, 19:45

Re: PNY Optima SSD support?

Post by MouettE » 11 May 2015, 23:56

Gordon wrote:Note: from what I read at Denx the normal u-boot executes what's in the bootcmd environment variable. I've got a strong feeling that this variable is ignored in the B3's u-boot and it executes bootalt1/-2 instead, depending on button state.
That's not exactly how it works ; U-Boot specific B3 code sets bootcmd value when starting from bootalt1 or bootalt2 depending on button state. The bootcmd variable is never written in the environment and if it is it will be replaced by bootalt1 or bootalt2 (only in memory and not in flash ; that's why the flash value is useless and for clarity should never be set).
Gordon wrote:Another thing I noticed is that most of the environment variable assignments also occur within the u-boot image itself (all except the units unique values - MAC/key/serial). My guess is that the defines in mtd0 take preference over what is defined in mtd1 and thus I'm afraid the soldering equipment will need to come out of storage.
The environment in the u-boot image is the default environment ; I don't exactly know what does u-boot make of it (pretty sure it is used when the env storage is somewhat empty or corrupted). However it does not take preference over what is defined in the normal environment in mtd1 (One of my b3 boots from a md raid so I changed the sataroot value to /dev/mtd0 with fw_setenvand it works fine).
Gordon wrote:Question: does Moette's version of u-boot also have these values predefined in the image itself?
Yes

On the b3 I use for development (which has a highly modified u-boot environment), I am unable to make changes to the environment flash after long hours of intense work (compiling a new kernel for example). After a few minutes turned off, everything works again. Probably an overheat problem...

Gordon
Posts: 1346
Joined: 10 Aug 2011, 03:18

Re: PNY Optima SSD support?

Post by Gordon » 12 May 2015, 08:46

MouettE wrote:That's not exactly how it works ; U-Boot specific B3 code sets bootcmd value when starting from bootalt1 or bootalt2 depending on button state. The bootcmd variable is never written in the environment and if it is it will be replaced by bootalt1 or bootalt2 (only in memory and not in flash ; that's why the flash value is useless and for clarity should never be set).
Okay, so that confirms my suspicion. As to clarity, I did not add the bootcmd variable to the environment - it was already there and I changed it after it became clear that changing bootalt1 had no effect
MouettE wrote:The environment in the u-boot image is the default environment ; I don't exactly know what does u-boot make of it (pretty sure it is used when the env storage is somewhat empty or corrupted). However it does not take preference over what is defined in the normal environment in mtd1 (One of my b3 boots from a md raid so I changed the sataroot value to /dev/mtd0 with fw_setenvand it works fine).
I would have assumed the same, but the B3 behaviour does not comply.
MouettE wrote:On the b3 I use for development (which has a highly modified u-boot environment), I am unable to make changes to the environment flash after long hours of intense work (compiling a new kernel for example). After a few minutes turned off, everything works again. Probably an overheat problem...
This is a new unit that I'm building as a plug-in replacement for a currently active one still on the original Bubba OS. Overheating is not an issue , but it is strange that the flash locks up after using fw_setenv.

In any case, this is what fw_printenv currently returns and I don't see any reason here for it to go straight to sataboot. The difference (probably) being that I'm changing the values from userspace while you did it from a serial connection.

Code: Select all

bootdelay=1
baudrate=115200
preboot=
loadaddr=0x800000
console=ttyS0
bootfile=uImage
flashfile=u-boot.kwb
installfile=install.itb
setdiskargs=setenv bootargs root=$diskdev console=$console,$baudrate serial=${serial#} key=$key button=$button
setbootargs=setenv bootargs root=$rootdev rw console=$console,$baudrate $othbootargs
usbbootroot=/dev/sda1
usbbootdev=usb 0:1
usbboot=usb start; setenv diskdev $usbbootroot; run setdiskargs; ext2load $usbbootdev $loadaddr /boot/$bootfile; bootm
usbflashdev=usb 0:1
usbflash=fatload $usbflashdev $loadaddr /install/$flashfile && sf probe 0:0 && sf erase 0 80000; sf write $loadaddr 0 $filesize
satadev=sata 0:1
sataroot=/dev/sda1
sataboot=setenv diskdev $sataroot; run setdiskargs; ext2load $satadev $loadaddr /boot/$bootfile; bootm
usbinstallroot=/dev/ram0
usbinstalldev=usb 0:1
usbinstall=usb start; setenv diskdev $usbinstallroot; run setdiskargs; fatload $usbinstalldev $loadaddr /install/$installfile; bootm
bootalt2=run usbinstall || run usbflash || run sataboot || reset
ethact=egiga0
stdin=serial
stdout=serial
stderr=serial
button=0
ethaddr=00:22:02:ab:cd:e0
eth1addr=00:22:02:ab:cd:e1
serial#=99999
key=ExtremelySecret
bootalt1=run usbinstall || run sataboot || reset
bootcmd=run usbinstall || run sataboot || reset

Gordon
Posts: 1346
Joined: 10 Aug 2011, 03:18

Re: PNY Optima SSD support?

Post by Gordon » 04 Jun 2015, 03:49

This is totally weird. I got the serial connection working and this is what it returns:

Code: Select all

U-Boot 2010.06 (Jun 10 2011 - 09:06:51)
BUBBA|3

SoC:   Kirkwood 88F6281_A0
DRAM:  512 MiB
In:    serial
Out:   serial
Err:   serial
Device not ready on port: 0
Failed to wait for completion on port 0
ATA operation timed out
Failed to wait for completion on port 0
ATA operation timed out
Failed to wait for completion on port 0
ATA operation timed out
Net:   egiga0, egiga1
88E1116 Initializing on egiga0 @08 done
88E1116 Initializing on egiga1 @18 done
Hit any key to stop autoboot:  0
Unknown command 'stall' - try 'help'
** Bad partition 1 **
Wrong Image Format for bootm command
ERROR: can't get kernel image!
resetting ...

So I guess the "Device not ready" messages can't be helped, but the unknown command should not happen. After stopping autoboot and inspecting the environment I found this:

Code: Select all

bootalt2=run usbinstall || run usbflash || run sataboot || reset
bootalt1=run usbinstall || run sataboot || reset
bootcmd=stall || run sataboot || reset
Somehow I seem to be missing the first 9 characters from bootalt1?

Gordon
Posts: 1346
Joined: 10 Aug 2011, 03:18

Re: PNY Optima SSD support?

Post by Gordon » 04 Jun 2015, 15:23

I seem to be mostly answering myself...

Did some further investigation and it turns out that whatever I put in bootalt1 it is always missing the first 9 characters. So now I have

Code: Select all

bootalt1=12345678 run usbboot || run sataboot || reset
and it boots. Obviously it takes significantly more time because of the repeated probing of the SSD and the USB stick also does not impress in speed, but I'm happy so far.

PS Another weird thing I found is that if I create a /boot directory on a FAT partition u-boot refuses to read from it. If I try to list the files it simply says "no fat FS". If I rename it to /boot2 I have no issue listing the files inside it, but if I have a /boot at the same time this folder does not even show when listing the root content (i.e. I only get to see boot2). There is something really wrong with this boot application.

Gordon
Posts: 1346
Joined: 10 Aug 2011, 03:18

Re: PNY Optima SSD support?

Post by Gordon » 05 Jun 2015, 03:59

And yet more fiddling.

I remembered there was something in that topic linked earlier that stated an issue with bootcmd.
The bootalt3 will never be used (without recompiling uboot), its just the old bootalt2 kept as a backup. For some reason I got very strange results with this. I had to save it twice, with a restart in between. Otherwise bootcmd was invalid (had traces of other variables in it). Also note the rootdelay to allow linux to found the usb memory.
So I rewrote the value on bootalt2 - using the same content as it originally was! - and when booting with the button depressed the exact same thing happened. I was missing the first nine characters of bootalt2 in bootcmd. I wiped bootcmd once more, rewrote the environment and after the next reset all was fine. Verified with bootalt1 and that got copied to bootcmd correctly as well.

The conclusion therefore has to be that if you try to change boot order from user space you're bound to fail because of this really nasty bug. You must have serial console access to be able to write, reset and write again to overcome this.

Post Reply