Hello, I am using SPI U-Boot. Would it be safe to build U-Boot with an option to store env to SPI, instead of a FAT partition? That is, is it safe to enable CONFIG_ENV_IS_IN_SPI_FLASH in U-Boot build config?
Yes ! why not ? its works fine
Nice, thanks! I just wanted to ask first as it’s my first time messing with bootloaders
@hyphop Uh I just figured U-Boot images are built from your repo here: https://github.com/krescue/khadas-uboot
Since the scripts are highly automated, how do I edit the U-Boot config before it gets built?
i will try to check tomorrow
Thank you! I tried to figure out how to get saveenv
runing myself today by playing around with the board to save some U-Boot env variables regarding usb boot and this is a quick report:
- Legacy U-Boot in a Ubuntu EMMC image can run
saveenv
, but can’t do USB boot - Mainline U-Boot can do USB boot, but I can’t
saveenv
. I have three ideas so far that I think could work, but I don’t know how to do any of these three things:
- Create a FAT EMMC partition after flashing U-Boot mainline, or
- Build U-Boot mainline with support for
saveenv
to SPI, or - Build U-Boot with a modified environment
I hoped to figure something out so I don’t have to bug you guys, but as my knowledge ends here, unfortunately so do my attempts at saveenv
with mainline U-Boot, and I await your kind assistance @hyphop
same can boot but need change default uboot env
Mainline U-Boot can do USB boot, but I can’t
saveenv
. I have three ideas so far that I think could work, but I don’t know how to do any of these three things:
our mainline uboot variant can save env but need fat partition
PS: tell me what you need from uboot ?
UPDATE: https://dl.khadas.com/Firmware/uboot/mainline/Khadas.UBOOT.mainline.emmc.kresq - was updated now with fat partition (no need to create it )
AMAZING, thank you! That’s exactly what I needed!
Well, I’ve got a problem booting from a USB HDD where U-Boot recognizes it as a USB device, but not as a storage device, and skips it. If I run the command prompt and just do usb reset
, that takes care of it - U-Boot then recognizes it as a storage device, and can boot from it. I posted some logs etc. to the forum, and then after playing around some more I posted an issue to GitHub, but to the wrong repo (this GitHub issue is more complete than the forum post).
Anyway, I suspect the problem is simply that the disk hasn’t spun up or something like that, so I plan on adding a boot delay, and, if needed, a usb reset
to the USB boot command. I’ll try playing around now that I can save env to a FAT partition, thanks again!
Okay, I got it working by modifying preboot
- I suspect there is a bug in U-Boot. To repeat, U-Boot sees my USB HDD, but doesn’t recognize it as a storage device, unless I do usb reset
.
Default preboot
, which fails:
run load_logo; usb start; kbi init; sleep 1;
Setting sleep 10;
before usb start
doesn’t work, so it’s not related to HDD powerup or something like that. Strictly usb reset
is needed after usb start
, so there is something happening differently between usb start
and usb start; usb reset
, when there shouldn’t be any difference. I thought kbi init
might need to be run before usb start
, so I tried it, and it still failed.
So usb start; usb reset;
is the only thing that works - this is my current preboot
:
run load_logo; usb start; kbi init; sleep 1; usb reset; sleep 1;
So my system works and I’m very happy, but it’s still just a workaround and I am pretty sure there’s some kind of bug in U-Boot (and/or its USB subsystem) that’s causing it. If I can be of any help, please let me know! Relevant logs are here. Thanks for the help!
tell me more about your USB HDD - model etc … , and power supply and which usb port used !
and we can test and improve it !!!
-
USB HDD:
ID 125f:a83a A-DATA Technology Co., Ltd. HD330
(1TB, USB3) - Power supply: 9VDC, 1.67A; or 5VDC 2A
- USB ports: happens on both, but I’m using the USB3 900 mA port (KBI set to USB3)
I don’t think it’s the power supply because a 10 second boot delay would’ve likely given a weak PSU more than enough time to level out its voltage. On the other hand, nothing except a usb reset
helps.
However, that’s just my educated guess, and not a test! I have three things I’ll do in order to rule out the power supply:
- I ordered an official Khadas 24W power supply plus USB-C cable directly from the Khadas AliExpress store two weeks ago, will test as soon as it arrives. If it doesn’t in the next few days, then…:
- I’ll hook up an oscilloscope to the power supply line and see what happens to the power supply voltage during the boot process.
- If it has dips, I’ll hook up a beefy capacitor across the power supply lines and see if that helps.