Enable UBI support for a platform

Deepak Kodihalli dkodihal at linux.vnet.ibm.com
Fri Sep 18 23:06:38 AEST 2020


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 at 0 {
+               status = "okay";
+               m25p,fast-read;
+-#include "openbmc-flash-layout.dtsi"
++
++                partitions {
++                        #address-cells = < 1 >;
++                        #size-cells = < 1 >;
++                        compatible = "fixed-partitions";
++                        u-boot at 0 {
++                                reg = < 0 0x60000 >;
++                                label = "u-boot";
++                        };
++                        u-boot-env at 60000 {
++                                reg = < 0x60000 0x20000 >;
++                                label = "u-boot-env";
++                        };
++                        obmc-ubi at 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 at 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
> 



More information about the openbmc mailing list