All of lore.kernel.org
 help / color / mirror / Atom feed
* Enable UBI support for a platform
@ 2020-09-05  0:02 Kun Zhao
  2020-09-05 12:49 ` Deepak Kodihalli
  0 siblings, 1 reply; 15+ messages in thread
From: Kun Zhao @ 2020-09-05  0:02 UTC (permalink / raw)
  To: openbmc

[-- Attachment #1: Type: text/plain, Size: 1849 bytes --]

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

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@hotmail.com<mailto:zkxz@hotmail.com>
*/


[-- Attachment #2: Type: text/html, Size: 7967 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Enable UBI support for a platform
  2020-09-05  0:02 Enable UBI support for a platform Kun Zhao
@ 2020-09-05 12:49 ` Deepak Kodihalli
  2020-09-07 19:09   ` Kun Zhao
  0 siblings, 1 reply; 15+ messages in thread
From: Deepak Kodihalli @ 2020-09-05 12:49 UTC (permalink / raw)
  To: Kun Zhao, openbmc

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.

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@hotmail.com <mailto:zkxz@hotmail.com>
> 
> */
> 

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Enable UBI support for a platform
  2020-09-05 12:49 ` Deepak Kodihalli
@ 2020-09-07 19:09   ` Kun Zhao
  2020-09-08 15:26     ` Deepak Kodihalli
  0 siblings, 1 reply; 15+ messages in thread
From: Kun Zhao @ 2020-09-07 19:09 UTC (permalink / raw)
  To: Deepak Kodihalli, openbmc


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?
>
> 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@hotmail.com <mailto:zkxz@hotmail.com>
>>
>> */
>>
>
Kun

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Enable UBI support for a platform
  2020-09-07 19:09   ` Kun Zhao
@ 2020-09-08 15:26     ` Deepak Kodihalli
  2020-09-09  0:45       ` Jiandi An
  2020-09-15  1:11       ` Kun Zhao
  0 siblings, 2 replies; 15+ messages in thread
From: Deepak Kodihalli @ 2020-09-08 15:26 UTC (permalink / raw)
  To: Kun Zhao, openbmc

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


>> 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@hotmail.com <mailto:zkxz@hotmail.com>
>>>
>>> */
>>>
>>
> Kun
> 

^ permalink raw reply	[flat|nested] 15+ messages in thread

* RE: Enable UBI support for a platform
  2020-09-08 15:26     ` Deepak Kodihalli
@ 2020-09-09  0:45       ` Jiandi An
  2020-09-09  8:54         ` Deepak Kodihalli
  2020-09-15  1:11       ` Kun Zhao
  1 sibling, 1 reply; 15+ messages in thread
From: Jiandi An @ 2020-09-09  0:45 UTC (permalink / raw)
  To: Deepak Kodihalli, Kun Zhao, openbmc


> 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+g
> >>> itAUTOINC+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,
One thing is no mtdparts command from u-boot.  Do we need to add CONFIG_CMD_MTDPARTS?
Here the comment says adding CONFIG_CMD_MTDPARTS won't work.
https://lists.denx.de/pipermail/u-boot/2012-December/142837.html

Actually using witherspoon's flash layout
https://github.com/ibm-openbmc/openbmc/blob/OP940/meta-ibm/meta-witherspoon/recipes-kernel/linux/linux-aspeed/0001-ARM-dts-Aspeed-Witherspoon-128-Update-BMC-partitioni.patch

So the one we have in the device tree is as follows..

&fmc {
	status = "okay";
	flash@0 {
		status = "okay";
		m25p,fast-read;
		label = "bmc";
//#include "openbmc-flash-layout.dtsi"

		partitions {
			#address-cells = < 1 >;
			#size-cells = < 1 >;
			compatible = "fixed-partitions";
			u-boot@0 {
				reg = < 0 0x60000 >;
				label = "u-boot";
			};
			u-boot-env@60000 {
				reg = < 0x60000 0x20000 >;
				label = "u-boot-env";
			};
			obmc-ubi@80000 {
				reg = <0x80000 0x7F80000>;
				label = "obmc-ubi";
			};
		};
	};
};

> 
> >> 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@hotmail.com <mailto:zkxz@hotmail.com>
> >>>
> >>> */
> >>>
> >>
> > Kun
> >


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Enable UBI support for a platform
  2020-09-09  0:45       ` Jiandi An
@ 2020-09-09  8:54         ` Deepak Kodihalli
  2020-09-09 16:30           ` Jiandi An
  0 siblings, 1 reply; 15+ messages in thread
From: Deepak Kodihalli @ 2020-09-09  8:54 UTC (permalink / raw)
  To: Jiandi An, Kun Zhao, openbmc

On 09/09/20 6:15 am, Jiandi An 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+g
>>>>> itAUTOINC+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,
> One thing is no mtdparts command from u-boot.  Do we need to add CONFIG_CMD_MTDPARTS?
> Here the comment says adding CONFIG_CMD_MTDPARTS won't work.
> https://lists.denx.de/pipermail/u-boot/2012-December/142837.html

Hi Jiandi, the comment you pointed to is in the context if a very old 
u-boot release, so I don't think it applies to the u-boot release that 
OpenBMC uses. MTD and UBI support is optional in the u-boot AST config, 
and is enabled if MTDPARTS_DEFAULT is set. This flag further sets 
CONFIG_MTD_PARTITIONS. MTDPARTS_DEFAULT is enabled via a u-boot patch 
that we carry, and that is picked up if the 'obmc-ubi-fs' distro feature 
is enabled (see 
meta-phosphor/aspeed-layer/recipes-bsp/u-boot/u-boot-aspeed.inc). So it 
still seems like this feature is not enabled in the image or there is 
some other issue with building the image.

> Actually using witherspoon's flash layout
> https://github.com/ibm-openbmc/openbmc/blob/OP940/meta-ibm/meta-witherspoon/recipes-kernel/linux/linux-aspeed/0001-ARM-dts-Aspeed-Witherspoon-128-Update-BMC-partitioni.patch
> 
> So the one we have in the device tree is as follows..

Witherspoon-128's (which has a different device tree than witherspoon) 
BMC has a 128M flash (you can see the sizes of the partitions below in 
the device tree add up to 128M). So this would work if your BMC has a 
128M flash. The obmc-ubi partition would be smaller for eg for a 32M flash.

> &fmc {
> 	status = "okay";
> 	flash@0 {
> 		status = "okay";
> 		m25p,fast-read;
> 		label = "bmc";
> //#include "openbmc-flash-layout.dtsi"
> 
> 		partitions {
> 			#address-cells = < 1 >;
> 			#size-cells = < 1 >;
> 			compatible = "fixed-partitions";
> 			u-boot@0 {
> 				reg = < 0 0x60000 >;
> 				label = "u-boot";
> 			};
> 			u-boot-env@60000 {
> 				reg = < 0x60000 0x20000 >;
> 				label = "u-boot-env";
> 			};
> 			obmc-ubi@80000 {
> 				reg = <0x80000 0x7F80000>;
> 				label = "obmc-ubi";
> 			};
> 		};
> 	};
> };
> 
>>
>>>> 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@hotmail.com <mailto:zkxz@hotmail.com>
>>>>>
>>>>> */
>>>>>
>>>>
>>> Kun
>>>
> 

^ permalink raw reply	[flat|nested] 15+ messages in thread

* RE: Enable UBI support for a platform
  2020-09-09  8:54         ` Deepak Kodihalli
@ 2020-09-09 16:30           ` Jiandi An
  2020-09-11  8:36             ` Deepak Kodihalli
  0 siblings, 1 reply; 15+ messages in thread
From: Jiandi An @ 2020-09-09 16:30 UTC (permalink / raw)
  To: Deepak Kodihalli, Kun Zhao, openbmc

> On 09/09/20 6:15 am, Jiandi An 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
> >>>>> +g
> >>>>> itAUTOINC+1ded9fa3a2-r0/ and found the none of the following
> >>>>> itAUTOINC+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,
> > One thing is no mtdparts command from u-boot.  Do we need to add
> CONFIG_CMD_MTDPARTS?
> > Here the comment says adding CONFIG_CMD_MTDPARTS won't work.
> > https://lists.denx.de/pipermail/u-boot/2012-December/142837.html
> 
> Hi Jiandi, the comment you pointed to is in the context if a very old u-boot release,
> so I don't think it applies to the u-boot release that OpenBMC uses. MTD and UBI
> support is optional in the u-boot AST config, and is enabled if
> MTDPARTS_DEFAULT is set. This flag further sets CONFIG_MTD_PARTITIONS.
> MTDPARTS_DEFAULT is enabled via a u-boot patch that we carry, and that is
> picked up if the 'obmc-ubi-fs' distro feature is enabled (see meta-
> phosphor/aspeed-layer/recipes-bsp/u-boot/u-boot-aspeed.inc). So it still seems
> like this feature is not enabled in the image or there is some other issue with
> building the image.
> 
> > Actually using witherspoon's flash layout
> > https://github.com/ibm-openbmc/openbmc/blob/OP940/meta-ibm/meta-
> wither
> > spoon/recipes-kernel/linux/linux-aspeed/0001-ARM-dts-Aspeed-Witherspoo
> > n-128-Update-BMC-partitioni.patch
> >
> > So the one we have in the device tree is as follows..
> 
> Witherspoon-128's (which has a different device tree than witherspoon) BMC has
> a 128M flash (you can see the sizes of the partitions below in the device tree add
> up to 128M). So this would work if your BMC has a 128M flash. The obmc-ubi
> partition would be smaller for eg for a 32M flash.

Thanks Deepak.  So I tried with aspeed-bmc-opp-witherspoon.dts now
https://elixir.bootlin.com/linux/latest/source/arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts#L231
with obmc-ubi starting at 0x80000 with size 0x1F80000

&fmc {
	status = "okay";
	flash@0 {
		status = "okay";
		m25p,fast-read;
		label = "bmc";
//#include "openbmc-flash-layout.dtsi"

		partitions {
			#address-cells = < 1 >;
			#size-cells = < 1 >;
			compatible = "fixed-partitions";
			u-boot@0 {
				reg = < 0 0x60000 >;
				label = "u-boot";
			};
			u-boot-env@60000 {
				reg = < 0x60000 0x20000 >;
				label = "u-boot-env";
			};
			obmc-ubi@80000 {
				reg = <0x80000 0x1F80000>;
				label = "obmc-ubi";
			};
		};
	};
};

Still seeing during kernel boot that /dev/mtdblock: can't open blockdev

[    1.356025] Checked W+X mappings: passed, no W+X pages found
[    1.356346] Run /init as init process
rofs = squashfs rwfs = jffs2
[    2.033408] /dev/mtdblock: Can't open blockdev
mount: mounting /dev/mtdblock on run/initramfs/ro failed: No such file or directory
[    2.043247] MTD: Couldn't look up '/dev/mtdblock': -2
mount: mounting /dev/mtdblock on run/initramfs/rw failed: No such file or directory

Mounting read-write /dev/mtdblock filesystem failed.  Please fix and run
	mount /dev/mtdblock run/initramfs/rw -t jffs2 -o rw
to to continue, or do change nothing to run from RAM for this boot.
Enter password to try to manually fix.
After fixing run exit to continue this script, or reboot -f to retry, or
touch /takeover and exit to become PID 1 allowing editing of this script.
Give root password for system maintenance
(or type Control-D for normal startup):

I searched and saw this feature discussion
https://github.com/openbmc/openbmc/issues/3177
which has a commit for uboot: Add support for ubi and mtd partitioning
https://gerrit.openbmc-project.xyz/c/openbmc/openbmc/+/5911
It went in meta-phosphor/common/recipes-bsp/u-boot/files/ as a patch.
https://github.com/openbmc/openbmc/commit/dd7015393fdab93426aab61a08b48a698c9c100d

There is also this
https://gerrit.openbmc-project.xyz/c/openbmc/openbmc/+/10577
These are not in our code base.
Do we need these patches?

> 
> > &fmc {
> >       status = "okay";
> >       flash@0 {
> >               status = "okay";
> >               m25p,fast-read;
> >               label = "bmc";
> > //#include "openbmc-flash-layout.dtsi"
> >
> >               partitions {
> >                       #address-cells = < 1 >;
> >                       #size-cells = < 1 >;
> >                       compatible = "fixed-partitions";
> >                       u-boot@0 {
> >                               reg = < 0 0x60000 >;
> >                               label = "u-boot";
> >                       };
> >                       u-boot-env@60000 {
> >                               reg = < 0x60000 0x20000 >;
> >                               label = "u-boot-env";
> >                       };
> >                       obmc-ubi@80000 {
> >                               reg = <0x80000 0x7F80000>;
> >                               label = "obmc-ubi";
> >                       };
> >               };
> >       };
> > };
> >
> >>
> >>>> 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@hotmail.com <mailto:zkxz@hotmail.com>
> >>>>>
> >>>>> */
> >>>>>
> >>>>
> >>> Kun
> >>>
> >


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Enable UBI support for a platform
  2020-09-09 16:30           ` Jiandi An
@ 2020-09-11  8:36             ` Deepak Kodihalli
  0 siblings, 0 replies; 15+ messages in thread
From: Deepak Kodihalli @ 2020-09-11  8:36 UTC (permalink / raw)
  To: Jiandi An, Kun Zhao, openbmc

Hi Jiandi,

On 09/09/20 10:00 pm, Jiandi An wrote:
>> On 09/09/20 6:15 am, Jiandi An 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
>>>>>>> +g
>>>>>>> itAUTOINC+1ded9fa3a2-r0/ and found the none of the following
>>>>>>> itAUTOINC+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,
>>> One thing is no mtdparts command from u-boot.  Do we need to add
>> CONFIG_CMD_MTDPARTS?
>>> Here the comment says adding CONFIG_CMD_MTDPARTS won't work.
>>> https://lists.denx.de/pipermail/u-boot/2012-December/142837.html
>>
>> Hi Jiandi, the comment you pointed to is in the context if a very old u-boot release,
>> so I don't think it applies to the u-boot release that OpenBMC uses. MTD and UBI
>> support is optional in the u-boot AST config, and is enabled if
>> MTDPARTS_DEFAULT is set. This flag further sets CONFIG_MTD_PARTITIONS.
>> MTDPARTS_DEFAULT is enabled via a u-boot patch that we carry, and that is
>> picked up if the 'obmc-ubi-fs' distro feature is enabled (see meta-
>> phosphor/aspeed-layer/recipes-bsp/u-boot/u-boot-aspeed.inc). So it still seems
>> like this feature is not enabled in the image or there is some other issue with
>> building the image.
>>
>>> Actually using witherspoon's flash layout
>>> https://github.com/ibm-openbmc/openbmc/blob/OP940/meta-ibm/meta-
>> wither
>>> spoon/recipes-kernel/linux/linux-aspeed/0001-ARM-dts-Aspeed-Witherspoo
>>> n-128-Update-BMC-partitioni.patch
>>>
>>> So the one we have in the device tree is as follows..
>>
>> Witherspoon-128's (which has a different device tree than witherspoon) BMC has
>> a 128M flash (you can see the sizes of the partitions below in the device tree add
>> up to 128M). So this would work if your BMC has a 128M flash. The obmc-ubi
>> partition would be smaller for eg for a 32M flash.
> 
> Thanks Deepak.  So I tried with aspeed-bmc-opp-witherspoon.dts now
> https://elixir.bootlin.com/linux/latest/source/arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts#L231
> with obmc-ubi starting at 0x80000 with size 0x1F80000
> 
> &fmc {
> 	status = "okay";
> 	flash@0 {
> 		status = "okay";
> 		m25p,fast-read;
> 		label = "bmc";
> //#include "openbmc-flash-layout.dtsi"
> 
> 		partitions {
> 			#address-cells = < 1 >;
> 			#size-cells = < 1 >;
> 			compatible = "fixed-partitions";
> 			u-boot@0 {
> 				reg = < 0 0x60000 >;
> 				label = "u-boot";
> 			};
> 			u-boot-env@60000 {
> 				reg = < 0x60000 0x20000 >;
> 				label = "u-boot-env";
> 			};
> 			obmc-ubi@80000 {
> 				reg = <0x80000 0x1F80000>;
> 				label = "obmc-ubi";
> 			};
> 		};
> 	};
> };
> 
> Still seeing during kernel boot that /dev/mtdblock: can't open blockdev
> 
> [    1.356025] Checked W+X mappings: passed, no W+X pages found
> [    1.356346] Run /init as init process
> rofs = squashfs rwfs = jffs2
> [    2.033408] /dev/mtdblock: Can't open blockdev
> mount: mounting /dev/mtdblock on run/initramfs/ro failed: No such file or directory
> [    2.043247] MTD: Couldn't look up '/dev/mtdblock': -2
> mount: mounting /dev/mtdblock on run/initramfs/rw failed: No such file or directory
> 
> Mounting read-write /dev/mtdblock filesystem failed.  Please fix and run
> 	mount /dev/mtdblock run/initramfs/rw -t jffs2 -o rw
> to to continue, or do change nothing to run from RAM for this boot.
> Enter password to try to manually fix.
> After fixing run exit to continue this script, or reboot -f to retry, or
> touch /takeover and exit to become PID 1 allowing editing of this script.
> Give root password for system maintenance
> (or type Control-D for normal startup):
> 
> I searched and saw this feature discussion
> https://github.com/openbmc/openbmc/issues/3177
> which has a commit for uboot: Add support for ubi and mtd partitioning
> https://gerrit.openbmc-project.xyz/c/openbmc/openbmc/+/5911
> It went in meta-phosphor/common/recipes-bsp/u-boot/files/ as a patch.
> https://github.com/openbmc/openbmc/commit/dd7015393fdab93426aab61a08b48a698c9c100d

Yes, you do need the patch above, along with few other patches. See my 
previous mail in this thread about the 'obmc-ubi-fs' distro feature. If 
this is enabled, the u-boot patches should be applied. This distro 
feature is enabled by including conf/distro/include/phosphor-ubi.inc.

> There is also this
> https://gerrit.openbmc-project.xyz/c/openbmc/openbmc/+/10577

I'd have to check this one, but I'm certain you don't need this just to 
boot with ubifs.

> These are not in our code base.
> Do we need these patches?
> 
>>
>>> &fmc {
>>>        status = "okay";
>>>        flash@0 {
>>>                status = "okay";
>>>                m25p,fast-read;
>>>                label = "bmc";
>>> //#include "openbmc-flash-layout.dtsi"
>>>
>>>                partitions {
>>>                        #address-cells = < 1 >;
>>>                        #size-cells = < 1 >;
>>>                        compatible = "fixed-partitions";
>>>                        u-boot@0 {
>>>                                reg = < 0 0x60000 >;
>>>                                label = "u-boot";
>>>                        };
>>>                        u-boot-env@60000 {
>>>                                reg = < 0x60000 0x20000 >;
>>>                                label = "u-boot-env";
>>>                        };
>>>                        obmc-ubi@80000 {
>>>                                reg = <0x80000 0x7F80000>;
>>>                                label = "obmc-ubi";
>>>                        };
>>>                };
>>>        };
>>> };
>>>
>>>>
>>>>>> 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@hotmail.com <mailto:zkxz@hotmail.com>
>>>>>>>
>>>>>>> */
>>>>>>>
>>>>>>
>>>>> Kun
>>>>>
>>>
> 

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Enable UBI support for a platform
  2020-09-08 15:26     ` Deepak Kodihalli
  2020-09-09  0:45       ` Jiandi An
@ 2020-09-15  1:11       ` Kun Zhao
  2020-09-15 14:15         ` Deepak Kodihalli
  1 sibling, 1 reply; 15+ messages in thread
From: Kun Zhao @ 2020-09-15  1:11 UTC (permalink / raw)
  To: Deepak Kodihalli, openbmc


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@hotmail.com <mailto:zkxz@hotmail.com>
>>>>
>>>> */
>>>>
>>>
>> Kun
>>
>
Kun

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Enable UBI support for a platform
  2020-09-15  1:11       ` Kun Zhao
@ 2020-09-15 14:15         ` Deepak Kodihalli
  2020-09-16 20:05           ` Adriana Kobylak
  0 siblings, 1 reply; 15+ messages in thread
From: Deepak Kodihalli @ 2020-09-15 14:15 UTC (permalink / raw)
  To: Kun Zhao, anoo; +Cc: openbmc

Hi Kun,

On 15/09/20 6:41 am, Kun Zhao wrote:
> 
> 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?

Some thoughts:

- Have you validated your recipe and device tree changes by trying to 
boot on QEMU an existing supported platform (for eg Romulus/Tiogapass)?

- I don't think not having the partitions for the alt side in your 
devicetree should be a problem, unless the BMC is actually switching to 
the secondary flash. 'md.l 0x1e785030 1' at the u-boot prompt can tell 
us the boot side.

Adriana - do you have any thoughts on this problem?

> 
> 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@hotmail.com <mailto:zkxz@hotmail.com>
>>>>>
>>>>> */
>>>>>
>>>>
>>> Kun
>>>
>>
> Kun
> 

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Enable UBI support for a platform
  2020-09-15 14:15         ` Deepak Kodihalli
@ 2020-09-16 20:05           ` Adriana Kobylak
  2020-09-18  6:37             ` Kun Zhao
  0 siblings, 1 reply; 15+ messages in thread
From: Adriana Kobylak @ 2020-09-16 20:05 UTC (permalink / raw)
  To: Deepak Kodihalli; +Cc: Kun Zhao, openbmc


>> |
>> . 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?
> 
> Some thoughts:
> 
> - Have you validated your recipe and device tree changes by trying to
> boot on QEMU an existing supported platform (for eg
> Romulus/Tiogapass)?
> 
> - I don't think not having the partitions for the alt side in your
> devicetree should be a problem, unless the BMC is actually switching
> to the secondary flash. 'md.l 0x1e785030 1' at the u-boot prompt can
> tell us the boot side.
> 
> Adriana - do you have any thoughts on this problem?
> 

Check if you can list the ubi partitions from u-boot:

ast# ubi part obmc-ubi
ast# ubi info layout

It should print some output like this:

Volume information dump:
         vol_id          0
...
         name            kernel-3a859116
Volume information dump:
         vol_id          1
...
         name            rofs-3a859116


Check that the kernel name on that output is "kernel-3a859116" which is 
the value that your kernelname variable is set to, and also check that 
the rofs volume is in volume 1 since the root and ubiblock variables are 
set to (primary chip (0) volume 1 (ubiblock=0,1)).

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Enable UBI support for a platform
  2020-09-16 20:05           ` Adriana Kobylak
@ 2020-09-18  6:37             ` Kun Zhao
  2020-09-18 13:06               ` Deepak Kodihalli
  0 siblings, 1 reply; 15+ messages in thread
From: Kun Zhao @ 2020-09-18  6:37 UTC (permalink / raw)
  To: Adriana Kobylak, Deepak Kodihalli; +Cc: openbmc

Hi Adriana, Deepak,


On 9/16/20 1:05 PM, Adriana Kobylak wrote:
>
>>> |
>>> . 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?
>>
>> Some thoughts:
>>
>> - Have you validated your recipe and device tree changes by trying to
>> boot on QEMU an existing supported platform (for eg
>> Romulus/Tiogapass)?

Hi Deepak,

I've tried qemu with romuslus/tiogapass machine type, but still has the same problem. I'm using 2.9-dev branch latest code, does it matter?

>>
>> - I don't think not having the partitions for the alt side in your
>> devicetree should be a problem, unless the BMC is actually switching
>> to the secondary flash. 'md.l 0x1e785030 1' at the u-boot prompt can
>> tell us the boot side.
>>
>> Adriana - do you have any thoughts on this problem?
>>
>
> Check if you can list the ubi partitions from u-boot:
>
> ast# ubi part obmc-ubi
> ast# ubi info layout
>
> It should print some output like this:
>
> Volume information dump:
>         vol_id          0
> ...
>         name            kernel-3a859116
> Volume information dump:
>         vol_id          1
> ...
>         name            rofs-3a859116
>
>
> Check that the kernel name on that output is "kernel-3a859116" which is the value that your kernelname variable is set to, 

Hi Adriana,

Here is the output,

ast# ubi part obmc-ubi
ubi0: attaching mtd1
ubi0: scanning is finished
UBI init error 12
ast# ubi info layout
Error, no UBI device/partition selected!
ast# print kernelname
kernelname=kernel-a39b2d07
ast#

Seems ubi can't find any valid ubi partitions. What's the error 12?

> and also check that the rofs volume is in volume 1 since the root and ubiblock variables are set to (primary chip (0) volume 1 (ubiblock=0,1)).

And how to check rofs volume index?


BTW, Adriana, could you also take a look at this email thread https://lists.ozlabs.org/pipermail/openbmc/2020-September/022834.html? It was why I was going to enable ubifs but I'm not sure if ubifs can solve that problem.


Kun

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Enable UBI support for a platform
  2020-09-18  6:37             ` Kun Zhao
@ 2020-09-18 13:06               ` Deepak Kodihalli
  2020-09-21 19:30                   ` Adriana Kobylak
  0 siblings, 1 reply; 15+ messages in thread
From: Deepak Kodihalli @ 2020-09-18 13:06 UTC (permalink / raw)
  To: Kun Zhao, Adriana Kobylak; +Cc: openbmc

On 18/09/20 12:07 pm, Kun Zhao wrote:
> Hi Adriana, Deepak,
> 
> 
> On 9/16/20 1:05 PM, Adriana Kobylak wrote:
>>
>>>> |
>>>> . 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?
>>>
>>> Some thoughts:
>>>
>>> - Have you validated your recipe and device tree changes by trying to
>>> boot on QEMU an existing supported platform (for eg
>>> Romulus/Tiogapass)?
> 
> Hi Deepak,
> 
> I've tried qemu with romuslus/tiogapass machine type, but still has the same problem. I'm using 2.9-dev branch latest code, does it matter?

Hi Kun,

That could matter. Is there a reason you're on that branch? There are 
800+ commits to master since that branch. In general what we follow is 
"live at head" of the master branch.

Also, I was able to boot Tiogapass QEMU with the UBIFS layout with the 
following changes (I'm based off of the latest master) :

diff --git a/meta-facebook/meta-tiogapass/conf/machine/tiogapass.conf 
b/meta-facebook/meta-tiogapass/conf/machine/tiogapass.conf
index 1e6ee08..6b2bf83 100644
--- a/meta-facebook/meta-tiogapass/conf/machine/tiogapass.conf
+++ b/meta-facebook/meta-tiogapass/conf/machine/tiogapass.conf
@@ -1,3 +1,5 @@
+require conf/distro/include/phosphor-ubi.inc
+
  KMACHINE = "aspeed"
  KERNEL_DEVICETREE = "${KMACHINE}-bmc-facebook-${MACHINE}.dtb"

diff --git 
a/meta-facebook/meta-tiogapass/recipes-kernel/linux/linux-aspeed/tp_ubi.patch 
b/meta-facebook/meta-tiogapass/recipes-kernel/linux/linux-aspeed/tp_ubi.patch
new file mode 100644
index 0000000..b31bdaa
--- /dev/null
+++ 
b/meta-facebook/meta-tiogapass/recipes-kernel/linux/linux-aspeed/tp_ubi.patch
@@ -0,0 +1,30 @@
+diff --git a/arch/arm/boot/dts/aspeed-bmc-facebook-tiogapass.dts 
b/arch/arm/boot/dts/aspeed-bmc-facebook-tiogapass.dts
+index 2d44d9a..e4183fd 100644
+--- a/arch/arm/boot/dts/aspeed-bmc-facebook-tiogapass.dts
++++ b/arch/arm/boot/dts/aspeed-bmc-facebook-tiogapass.dts
+@@ -57,7 +57,24 @@
+       flash@0 {
+               status = "okay";
+               m25p,fast-read;
+-#include "openbmc-flash-layout.dtsi"
++
++                partitions {
++                        #address-cells = < 1 >;
++                        #size-cells = < 1 >;
++                        compatible = "fixed-partitions";
++                        u-boot@0 {
++                                reg = < 0 0x60000 >;
++                                label = "u-boot";
++                        };
++                        u-boot-env@60000 {
++                                reg = < 0x60000 0x20000 >;
++                                label = "u-boot-env";
++                        };
++                        obmc-ubi@80000 {
++                                reg = < 0x80000 0x1F80000 >;
++                                label = "obmc-ubi";
++                        };
++                };
+       };
+ };
+
diff --git 
a/meta-facebook/meta-tiogapass/recipes-kernel/linux/linux-aspeed_%.bbappend 
b/meta-facebook/meta-tiogapass/recipes-kernel/linux/linux-aspeed_%.bbappend
index 0eb0884..5b58d8b 100644
--- 
a/meta-facebook/meta-tiogapass/recipes-kernel/linux/linux-aspeed_%.bbappend
+++ 
b/meta-facebook/meta-tiogapass/recipes-kernel/linux/linux-aspeed_%.bbappend
@@ -1,2 +1,3 @@
  FILESEXTRAPATHS_prepend := "${THISDIR}/linux-aspeed:"
-SRC_URI += "file://tiogapass.cfg"
+SRC_URI += "file://tiogapass.cfg \
+            file://tp_ubi.patch



And then on QEMU :

root@tiogapass:~# ubinfo -a
UBI version:                    1
Count of UBI devices:           1
UBI control device major/minor: 10:57
Present UBI devices:            ubi0

ubi0
Volumes count:                           3
Logical eraseblock size:                 65408 bytes, 63.8 KiB
Total amount of logical eraseblocks:     504 (32965632 bytes, 31.4 MiB)
Amount of available logical eraseblocks: 56 (3662848 bytes, 3.4 MiB)
Maximum count of volumes                 128
Count of bad physical eraseblocks:       0
Count of reserved physical eraseblocks:  0
Current maximum erase counter value:     2
Minimum input/output unit size:          1 byte
Character device major/minor:            246:0
Present volumes:                         0, 1, 2

Volume ID:   0 (on ubi0)
Type:        static
Alignment:   1
Size:        46 LEBs (3008768 bytes, 2.8 MiB)
Data bytes:  2992192 bytes (2.8 MiB)
State:       OK
Name:        kernel-e537a16b
Character device major/minor: 246:1
-----------------------------------
Volume ID:   1 (on ubi0)
Type:        static
Alignment:   1
Size:        299 LEBs (19556992 bytes, 18.6 MiB)
Data bytes:  19550208 bytes (18.6 MiB)
State:       OK
Name:        rofs-e537a16b
Character device major/minor: 246:2
-----------------------------------
Volume ID:   2 (on ubi0)
Type:        dynamic
Alignment:   1
Size:        97 LEBs (6344576 bytes, 6.0 MiB)
State:       OK
Name:        rwfs
Character device major/minor: 246:3

Regards,
Deepak

>>>
>>> - I don't think not having the partitions for the alt side in your
>>> devicetree should be a problem, unless the BMC is actually switching
>>> to the secondary flash. 'md.l 0x1e785030 1' at the u-boot prompt can
>>> tell us the boot side.
>>>
>>> Adriana - do you have any thoughts on this problem?
>>>
>>
>> Check if you can list the ubi partitions from u-boot:
>>
>> ast# ubi part obmc-ubi
>> ast# ubi info layout
>>
>> It should print some output like this:
>>
>> Volume information dump:
>>          vol_id          0
>> ...
>>          name            kernel-3a859116
>> Volume information dump:
>>          vol_id          1
>> ...
>>          name            rofs-3a859116
>>
>>
>> Check that the kernel name on that output is "kernel-3a859116" which is the value that your kernelname variable is set to,
> 
> Hi Adriana,
> 
> Here is the output,
> 
> ast# ubi part obmc-ubi
> ubi0: attaching mtd1
> ubi0: scanning is finished
> UBI init error 12
> ast# ubi info layout
> Error, no UBI device/partition selected!
> ast# print kernelname
> kernelname=kernel-a39b2d07
> ast#
> 
> Seems ubi can't find any valid ubi partitions. What's the error 12?
> 
>> and also check that the rofs volume is in volume 1 since the root and ubiblock variables are set to (primary chip (0) volume 1 (ubiblock=0,1)).
> 
> And how to check rofs volume index?
> 
> 
> BTW, Adriana, could you also take a look at this email thread https://lists.ozlabs.org/pipermail/openbmc/2020-September/022834.html? It was why I was going to enable ubifs but I'm not sure if ubifs can solve that problem.
> 
> 
> Kun
> 

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: Enable UBI support for a platform
@ 2020-09-21 19:30                   ` Adriana Kobylak
  0 siblings, 0 replies; 15+ messages in thread
From: Adriana Kobylak @ 2020-09-21 19:30 UTC (permalink / raw)
  To: Deepak Kodihalli; +Cc: openbmc, Kun Zhao

> 
> That could matter. Is there a reason you're on that branch? There are
> 800+ commits to master since that branch. In general what we follow is
> "live at head" of the master branch.
> 
> Also, I was able to boot Tiogapass QEMU with the UBIFS layout with the
> following changes (I'm based off of the latest master) :

Thanks Deepak for providing this working example! I agree that using 
master would be best.


>> BTW, Adriana, could you also take a look at this email thread 
>> https://lists.ozlabs.org/pipermail/openbmc/2020-September/022834.html? 
>> It was why I was going to enable ubifs but I'm not sure if ubifs can 
>> solve that problem.
>> 

Early in the beginning of implementing UBIFS in OpenBMC, we also 
encountered UBIFS corruption due to core dumps, and the only recovery 
was to run a factory reset which deletes and clears the read-write 
filesystem. So corruption may not be tied only to the jffs2 filesystem.

The corruption was so common that core dumps were disabled in OpenBMC - 
https://gerrit.openbmc-project.xyz/c/openbmc/openbmc/+/6699

I don't remember what was fixed, maybe it was something in upstream 
systemd, and core dumps were eventually re-enabled.

If you want to stay at 2.9, you could disable core dumps.
Or you can try moving up to master to see if that solves the corruption 
issues.
And if you do move to master, you can choose UBI if you like (following 
Deepak's example), we haven't seen UBIFS corruption is a very long time, 
also haven't see jffs2 corruption for that matter.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Enable UBI support for a platform
@ 2020-09-21 19:30                   ` Adriana Kobylak
  0 siblings, 0 replies; 15+ messages in thread
From: Adriana Kobylak @ 2020-09-21 19:30 UTC (permalink / raw)
  To: Deepak Kodihalli; +Cc: Kun Zhao, openbmc

> 
> That could matter. Is there a reason you're on that branch? There are
> 800+ commits to master since that branch. In general what we follow is
> "live at head" of the master branch.
> 
> Also, I was able to boot Tiogapass QEMU with the UBIFS layout with the
> following changes (I'm based off of the latest master) :

Thanks Deepak for providing this working example! I agree that using 
master would be best.


>> BTW, Adriana, could you also take a look at this email thread 
>> https://lists.ozlabs.org/pipermail/openbmc/2020-September/022834.html? 
>> It was why I was going to enable ubifs but I'm not sure if ubifs can 
>> solve that problem.
>> 

Early in the beginning of implementing UBIFS in OpenBMC, we also 
encountered UBIFS corruption due to core dumps, and the only recovery 
was to run a factory reset which deletes and clears the read-write 
filesystem. So corruption may not be tied only to the jffs2 filesystem.

The corruption was so common that core dumps were disabled in OpenBMC - 
https://gerrit.openbmc-project.xyz/c/openbmc/openbmc/+/6699

I don't remember what was fixed, maybe it was something in upstream 
systemd, and core dumps were eventually re-enabled.

If you want to stay at 2.9, you could disable core dumps.
Or you can try moving up to master to see if that solves the corruption 
issues.
And if you do move to master, you can choose UBI if you like (following 
Deepak's example), we haven't seen UBIFS corruption is a very long time, 
also haven't see jffs2 corruption for that matter.

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2020-09-21 19:32 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-05  0:02 Enable UBI support for a platform Kun Zhao
2020-09-05 12:49 ` Deepak Kodihalli
2020-09-07 19:09   ` Kun Zhao
2020-09-08 15:26     ` Deepak Kodihalli
2020-09-09  0:45       ` Jiandi An
2020-09-09  8:54         ` Deepak Kodihalli
2020-09-09 16:30           ` Jiandi An
2020-09-11  8:36             ` Deepak Kodihalli
2020-09-15  1:11       ` Kun Zhao
2020-09-15 14:15         ` Deepak Kodihalli
2020-09-16 20:05           ` Adriana Kobylak
2020-09-18  6:37             ` Kun Zhao
2020-09-18 13:06               ` Deepak Kodihalli
2020-09-21 19:30                 ` Adriana Kobylak
2020-09-21 19:30                   ` Adriana Kobylak

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.