Enable UBI support for a platform
Kun Zhao
zkxz at hotmail.com
Tue Sep 15 11:11:25 AEST 2020
On 9/8/20 8:26 AM, Deepak Kodihalli wrote:
> On 08/09/20 12:39 am, Kun Zhao wrote:
>>
>> On 9/5/20 5:49 AM, Deepak Kodihalli wrote:
>>> Hi Kun,
>>>
>>> On 05/09/20 5:32 am, Kun Zhao wrote:
>>>> Hi Team,
>>>>
>>>> My platform is based on ast2500, and I’ve already been able to built out the ubi image. But when I tried to test it with qemu, it just stopped at u-boot because ‘can’t get kernel image,
>>>>
>>>> qemu-system-arm: Aspeed iBT has no chardev backend
>>>>
>>>> U-Boot 2016.07 (Sep 04 2020 - 19:47:48 +0000)
>>>>
>>>> Watchdog enabled
>>>>
>>>> DRAM: 496 MiB
>>>>
>>>> Flash: 32 MiB
>>>>
>>>> *** Warning - bad CRC, using default environment
>>>>
>>>> In: serial
>>>>
>>>> Out: serial
>>>>
>>>> Err: serial
>>>>
>>>> Net: MAC0 : RGMII
>>>>
>>>> MAC1 : RGMII
>>>>
>>>> FTGMAC100#0
>>>>
>>>> Error: FTGMAC100#0 address not set.
>>>>
>>>> , FTGMAC100#1
>>>>
>>>> Error: FTGMAC100#1 address not set.
>>>>
>>>> Hit any key to stop autoboot: 0
>>>>
>>>> Wrong Image Format for bootm command
>>>>
>>>> ERROR: can't get kernel image!
>>>>
>>>> ast#
>>>>
>>>> And I found the bootargs is not right,
>>>>
>>>> ast# print
>>>>
>>>> baudrate=115200
>>>>
>>>> bootargs=console=ttyS4,115200n8 root=/dev/ram rw
>>>>
>>>> bootcmd=bootm 20080000
>>>>
>>>> bootdelay=2
>>>>
>>>> Checked in the build folder for tmp/work/myplatform-openbmc-linux-gnueabi/u-boot-aspeed/1_v2016.07+gitAUTOINC+1ded9fa3a2-r0/ and found the none of the following patches are there,
>>>>
>>>> 0002-config-ast-common-hack-bootopts.patch
>>>>
>>>> 0003-config-ast-common-Add-bootopts-to-support-ubi-and-mt.patch
>>>>
>>>> 0004-config-ast-common-Add-conditional-factory-reset-comm.patch
>>>>
>>>> 0005-config-ast-common-Fall-back-to-secondary-flash-on-fa.patch
>>>>
>>>> I think that’s why the bootargs is not correct.
>>>>
>>>> This is the details of how I enabled the ubi support in my platform recipes,
>>>>
>>>> 1. In meta-myplatform/conf/distro/openbmc-myplatform.conf, I added,
>>>>
>>>> require conf/distro/include/phosphor-base.inc
>>>>
>>>> require conf/distro/include/phosphor-ubi.inc
>>>
>>> You should just need the one line above, plus a device tree change for your system. The default openbmc-flash-layout.dtsi doesn't make a ubifs partition. You can for eg look at witherspoon's dts, which uses ubifs.
>> Hi Deepak, thank you for reply. I've tried to use the witherspoon's flash layout per your tips here. But it still stops at u-boot with "can't get kernel image!" error. Do I need to enable any kernel config options?
>
>
> Hi Kun, I don't think you need additional kernel config updates. I suspect something wrong with the way the image is built. Are you able to see expected values for the u-boot environment variables and MTD partitions? For eg:
>
> ast# mtdparts
> device nor0 <bmc>, # parts = 3
> #: name size offset mask_flags
> 0: u-boot 0x00060000 0x00000000 0
> 1: u-boot-env 0x00020000 0x00060000 0
> 2: obmc-ubi 0x01f80000 0x00080000 0
> active partition: nor0,0 - (u-boot) 0x00060000 @ 0x00000000
>
Hi Deepak,
Sorry for late response. I've figured out the reason why my u-boot didn't apply those patches for ubi support, that is meta-myplatform/conf/distro/openbmc-myplatform.conf wasn't parsed. When I add this line,
require conf/distro/include/phosphor-ubi.inc
directly into meta-myplatform/conf/machine/myplatform.conf, I see the u-boot supporting ubi, mtdparts cmds. The output for mtdparts is,
ast# mtdparts
device nor0 <bmc>, # parts = 3
#: name size offset mask_flags
0: u-boot 0x00060000 0x00000000 0
1: u-boot-env 0x00020000 0x00060000 0
2: obmc-ubi 0x01f80000 0x00080000 0
active partition: nor0,0 - (u-boot) 0x00060000 @ 0x00000000
defaults:
mtdids : nor0=bmc
mtdparts: mtdparts=bmc:384k(u-boot),128k(u-boot-env),-(obmc-ubi)
And I do see u-boot trying to discover ubi partitions during normal booting, but it still failed on,
. done
|
. done
|
. done
|
. done
|
. done
|
. done
|
. done
UBI init error 12
Error, no UBI device/partition selected!
Wrong Image Format for bootm command
ERROR: can't get kernel image!
Any thought?
The u-boot env is,
ast# print
baudrate=115200
bootalt=run wdt2bite
bootargs=console=ttyS4,115200n8 ubi.mtd=obmc-ubi,0,0,0 ubi.mtd=alt-obmc-ubi,0,0,4 ro rootfstype=squashfs
bootcmd=run set_bootargs; run obmc_bootcmd
bootdelay=2
do_rwreset=if test "${rwreset}" = "true"; then ubi remove rwfs; ubi create rwfs ${rwfs_size}; fi
ethact=FTGMAC100#0
kernelname=kernel-3a859116
loadaddr=80800000
mtddevname=u-boot
mtddevnum=0
mtdids=nor0=bmc
mtdparts=mtdparts=bmc:384k(u-boot),128k(u-boot-env),-(obmc-ubi)
obmc_bootcmd=ubi part obmc-ubi; run do_rwreset; ubi read ${loadaddr} ${kernelname}; bootm ${loadaddr} || run bootalt
partition=nor0,0
root=/dev/ubiblock0_1
rwfs_size=0x600000
set_bootargs=setenv bootargs console=ttyS4,115200n8 ubi.mtd=obmc-ubi,0,0,0 ubi.mtd=alt-obmc-ubi,0,0,4 ro rootfstype=squashfs ubi.block=${ubiblock} root=${root}
spi_dma=yes
stderr=serial
stdin=serial
stdout=serial
ubiblock=0,1
verify=yes
wdt2bite=mw.l 0x1e785024 0xa 1; mw.b 0x1e78502c 0xb3 1Environment size: 994/65531 bytes
BTW, I don't have an alt-obmc-ubi on the system.
>
>>> Does anyone know why the default is static partitions, and not ubifs?
>>>
>>> Regards,
>>> Deepak
>>>
>>>> 2. In meta-myplatform/conf/machine/myplatform.conf, I added,
>>>>
>>>> IMAGE_FSTYPES += " mtd-ubi mtd-ubi-tar"
>>>>
>>>> OBMC_MACHINE_FEATURES += " obmc-ubi-fs"
>>>>
>>>> Do I miss anything?
>>>>
>>>> Thanks.
>>>>
>>>> Best regards,
>>>>
>>>> Kun Zhao
>>>>
>>>> /*
>>>>
>>>> zkxz at hotmail.com <mailto:zkxz at hotmail.com>
>>>>
>>>> */
>>>>
>>>
>> Kun
>>
>
Kun
More information about the openbmc
mailing list