Skip to contentSkip to conversation

Allow easier use of mainline-based BSP on i.MX products (Nitrogen6x support)

PATCH Superseded Otavio Salvador 3 participants 17 messages Mar 24, 2017 – Mar 27, 2017

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover Allow easier use of mainline-based BSP on i.MX products (Nitrogen6x support)

This patchset makes use of the infrastructure added to meta-freescale to enable easier use of mainline-based BSP. To enable it, include:

MACHINEOVERRIDES .= ":use-mainline-bsp"

To the local.conf and everything is done automatically.

The bootscript still needs some love to work out of box but this will be left for Boundary Devices ;-)

Otavio Salvador (4):
u-boot-script-boundary: Enable 'use-mainline-bsp' support
nitrogen6x: Use weak-default for virtual/kernel
nitrogen6x: Add wic image tool support
nitrogen6x: Add 'use-mainline-bsp' support

 conf/machine/nitrogen6x.conf                     | 21 ++++++++++++++++++++-
 recipes-bsp/u-boot/u-boot-script-boundary_git.bb |  3 ++-
 2 files changed, 22 insertions(+), 2 deletions(-)
Signature · 1 line
2.12.1
#1 lore raw

PATCH 1/4 u-boot-script-boundary: Enable 'use-mainline-bsp' support

To easy the test with Linux mainline, we are making use of the new 'use-mainline-bsp' override.

---

 recipes-bsp/u-boot/u-boot-script-boundary_git.bb | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
recipes-bsp/u-boot/u-boot-script-boundary_git.bb +2 -1
index e4108f9..d3ba7a8 100644
@@ -12,7 +12,8 @@ S = "${WORKDIR}/git"
 
 inherit deploy
 
-BOOTSCRIPT ?= "${S}/board/boundary/nitrogen6x/6x_bootscript-yocto-3.14.txt"
+BOOTSCRIPT ??= "${S}/board/boundary/nitrogen6x/6x_bootscript-yocto-3.14.txt"
+BOOTSCRIPT_use-mainline-bsp ??= "${S}/board/boundary/nitrogen6x/6x_bootscript-mainline.txt"
 
 UPGRADESCRIPT = "${S}/board/boundary/nitrogen6x/6x_upgrade.txt"
 
Signature · 1 line
2.12.1
#3 lore raw

PATCH 2/4 nitrogen6x: Use weak-default for virtual/kernel

In reply to Otavio Salvador

The virtual/kernel sometimes need to be overriden, adding the weak-default allow for easier handler of different providers.

---

 conf/machine/nitrogen6x.conf | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
conf/machine/nitrogen6x.conf +1 -1
index f9b6cab..f35460d 100644
@@ -43,7 +43,7 @@ KERNEL_DEVICETREE = "imx6q-sabrelite.dtb \
 KERNEL_IMAGETYPE = "zImage"
 
 PREFERRED_PROVIDER_u-boot = "u-boot-boundary"
-PREFERRED_PROVIDER_virtual/kernel ?= "linux-boundary"
+PREFERRED_PROVIDER_virtual/kernel ??= "linux-boundary"
 
 # Use SPI NOR U-Boot by default
 IMAGE_BOOTLOADER ?= ""
Signature · 1 line
2.12.1
#5 lore raw

PATCH 3/4 nitrogen6x: Add wic image tool support

In reply to Otavio Salvador

The wic image needs to install the bootscript and it loads the respective kernel image and device-tree files from the image, thus those need to be included.

---

 conf/machine/nitrogen6x.conf | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
conf/machine/nitrogen6x.conf +15 -0
index f35460d..8af1b1f 100644
@@ -54,10 +54,25 @@ do_rootfs[depends] += "u-boot-script-boundary:do_deploy"
 # Boot scripts to install
 BOOT_SCRIPTS = "6x_bootscript-${MACHINE}:6x_bootscript"
 
+# wic support
+WKS_FILE ?= "sdimage-bootpart.wks"
+IMAGE_BOOT_FILES = " \
+    6x_bootscript-${MACHINE};6x_bootscript \
+    ${KERNEL_IMAGETYPE} \
+    ${KERNEL_IMAGETYPE}-imx6q-sabrelite.dtb;imx6q-sabrelite.dtb \
+    ${KERNEL_IMAGETYPE}-imx6q-nitrogen6_max.dtb;imx6q-nitrogen6_max.dtb ${KERNEL_IMAGETYPE}-imx6qp-nitrogen6_max.dtb;imx6qp-nitrogen6_max.dtb \
+    ${KERNEL_IMAGETYPE}-imx6q-nitrogen6x.dtb;imx6q-nitrogen6x.dtb ${KERNEL_IMAGETYPE}-imx6dl-nitrogen6x.dtb;imx6dl-nitrogen6x.dtb \
+"
+IMAGE_DEPENDS_wic_append = " dosfstools-native mtools-native"
+
 UBOOT_MACHINE ?= "nitrogen6q_config"
 
 SERIAL_CONSOLE = "115200 ttymxc1"
 
 MACHINE_EXTRA_RRECOMMENDS += "linux-firmware-wl12xx"
+MACHINE_ESSENTIAL_EXTRA_RDEPENDS += " \
+    kernel-image \
+    kernel-devicetree \
+"
 
 MACHINE_FEATURES += " pci wifi bluetooth"
Signature · 1 line
2.12.1
#9 lore raw

PATCH 4/4 nitrogen6x: Add 'use-mainline-bsp' support

In reply to Otavio Salvador

The 'use-mainline-bsp' makes use of linux-fslc as kernel and removes the not yet supported device-tree files from installation set.

---

 conf/machine/nitrogen6x.conf | 4 ++++
 1 file changed, 4 insertions(+)
conf/machine/nitrogen6x.conf +4 -0
index 8af1b1f..aa068ac 100644
@@ -40,10 +40,14 @@ KERNEL_DEVICETREE = "imx6q-sabrelite.dtb \
                         imx6q-nitrogen6_som2.dtb imx6qp-nitrogen6_som2.dtb \
                         imx6dl-nitrogen6_vm.dtb imx6dl-nitrogen6_vm-magstripe.dtb \
 "
+KERNEL_DEVICETREE_remove_use-mainline-bsp = "imx6q-nitrogen6_som2.dtb imx6qp-nitrogen6_som2.dtb \
+                                             imx6dl-nitrogen6_vm.dtb imx6dl-nitrogen6_vm-magstripe.dtb"
+
 KERNEL_IMAGETYPE = "zImage"
 
 PREFERRED_PROVIDER_u-boot = "u-boot-boundary"
 PREFERRED_PROVIDER_virtual/kernel ??= "linux-boundary"
+PREFERRED_PROVIDER_virtual/kernel_use-mainline-bsp ??= "linux-fslc"
 
 # Use SPI NOR U-Boot by default
 IMAGE_BOOTLOADER ?= ""
Signature · 1 line
2.12.1
#14 lore raw
In reply to Otavio Salvador

Hi Otavio,

First of all, thank you for this series and the great job you've done to add mainline support, this is highly appreciated!

Quoted 10 lines · Otavio Salvador

This patchset makes use of the infrastructure added to meta-freescale to enable easier use of mainline-based BSP. To enable it, include:

MACHINEOVERRIDES .= ":use-mainline-bsp"

To the local.conf and everything is done automatically.

The bootscript still needs some love to work out of box but this will be left for Boundary Devices ;-)

I've fixed one of the two issues already [1] so bootdir doesn't need to be set any more.

The only thing that still needs to be figured out is the root= parameter which right now requires the following variable to be set when booting a Nitrogen6X with WiFi module from first SD slot:
=> setenv root /dev/mmcblk1p2

The reason is that mainline kernel doesn't allow to change the numbering order of SDHC devices based on aliases. Sascha offered a patch which never got accepted (but is in the NXP tree) [2].

So on a device where a WiFi module is present, the first sdcard device will be named mmcblk1. But on a SabreLite (no WiFi), it will be mmcblk0 as the bootscript thinks it is.

I haven't found a good approach yet to fix it, ideas are welcomed ;)

Regards,
Gary

[1] https://github.com/boundarydevices/u-boot-imx6/commit/bc55c1e2
[2] https://patchwork.kernel.org/patch/4223911/

Reviewed-by on v1 2/4
#4 lore raw

Re: [3rdparty PATCH 2/4] nitrogen6x: Use weak-default for virtual/kernel

In reply to Otavio Salvador

Hi Otavio,

Quoted 24 lines · Otavio Salvador

The virtual/kernel sometimes need to be overriden, adding the weak-default allow for easier handler of different providers.

---

 conf/machine/nitrogen6x.conf | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
conf/machine/nitrogen6x.conf +1 -1
index f9b6cab..f35460d 100644
@@ -43,7 +43,7 @@ KERNEL_DEVICETREE = "imx6q-sabrelite.dtb \
 KERNEL_IMAGETYPE = "zImage"
 
 PREFERRED_PROVIDER_u-boot = "u-boot-boundary"
-PREFERRED_PROVIDER_virtual/kernel ?= "linux-boundary"
+PREFERRED_PROVIDER_virtual/kernel ??= "linux-boundary"
 
 # Use SPI NOR U-Boot by default
 IMAGE_BOOTLOADER ?= ""
Signature · 1 line
2.12.1

Same here, looks good.

Regards,
Gary

#6 lore raw

Re: [3rdparty PATCH 3/4] nitrogen6x: Add wic image tool support

In reply to Otavio Salvador

Hi Otavio,

Quoted 3 lines · Otavio Salvador

The wic image needs to install the bootscript and it loads the respective kernel image and device-tree files from the image, thus those need to be included.

Not sure to understand the wic image requirement. First, is the wic image only applies when "use-mainline-bsp" is set? I couldn't find where it was mainline specific.

Regards,
Gary

#10 lore raw

Re: [3rdparty PATCH 4/4] nitrogen6x: Add 'use-mainline-bsp' support

In reply to Otavio Salvador

Hi Otavio,

Quoted 14 lines · Otavio Salvador

The 'use-mainline-bsp' makes use of linux-fslc as kernel and removes the not yet supported device-tree files from installation set.

---

 conf/machine/nitrogen6x.conf | 4 ++++
 1 file changed, 4 insertions(+)
conf/machine/nitrogen6x.conf +0 -0
index 8af1b1f..aa068ac 100644

conf/machine/nitrogen6x.conf KERNEL_DEVICETREE = "imx6q-sabrelite.dtb \ · line 45

Quoted 6 lines
conf/machine/nitrogen6x.conf +3 -0
@@ -40,10 +40,14 @@ KERNEL_DEVICETREE = "imx6q-sabrelite.dtb \
                         imx6q-nitrogen6_som2.dtb imx6qp-nitrogen6_som2.dtb \
                         imx6dl-nitrogen6_vm.dtb imx6dl-nitrogen6_vm-magstripe.dtb \
 "
+KERNEL_DEVICETREE_remove_use-mainline-bsp = "imx6q-nitrogen6_som2.dtb imx6qp-nitrogen6_som2.dtb \
+                                             imx6dl-nitrogen6_vm.dtb imx6dl-nitrogen6_vm-magstripe.dtb"
+

Why do you remove the imx6q-nitrogen6_som2 whereas it is now in linux-fslc (and in 4.10)?

Regards,
Gary

#7 lore raw

Re: [3rdparty PATCH 3/4] nitrogen6x: Add wic image tool support

In reply to Gary Bisson
Quoted 8 lines · Gary Bisson
Quoted 3 lines · Otavio Salvador

The wic image needs to install the bootscript and it loads the respective kernel image and device-tree files from the image, thus those need to be included.

Not sure to understand the wic image requirement. First, is the wic image only applies when "use-mainline-bsp" is set? I couldn't find where it was mainline specific.

It is not mainline specific but as we move away the mx6 override the image class does not work. So I end using it so we can get it building an out of box image to use.

Signature · 3 lines
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750
#11 lore raw

Re: [3rdparty PATCH 4/4] nitrogen6x: Add 'use-mainline-bsp' support

In reply to Gary Bisson
Quoted 10 lines · Gary Bisson
Quoted 9 lines · Otavio Salvador

The 'use-mainline-bsp' makes use of linux-fslc as kernel and removes the not yet supported device-tree files from installation set.

---

 conf/machine/nitrogen6x.conf | 4 ++++
 1 file changed, 4 insertions(+)
Quoted 14 lines

conf/machine/nitrogen6x.conf KERNEL_DEVICETREE = "imx6q-sabrelite.dtb \ · line 45

Quoted 11 lines
conf/machine/nitrogen6x.conf +3 -0
index 8af1b1f..aa068ac 100644
@@ -40,10 +40,14 @@ KERNEL_DEVICETREE = "imx6q-sabrelite.dtb \
                         imx6q-nitrogen6_som2.dtb imx6qp-nitrogen6_som2.dtb \
                         imx6dl-nitrogen6_vm.dtb imx6dl-nitrogen6_vm-magstripe.dtb \
 "
+KERNEL_DEVICETREE_remove_use-mainline-bsp = "imx6q-nitrogen6_som2.dtb imx6qp-nitrogen6_som2.dtb \
+                                             imx6dl-nitrogen6_vm.dtb imx6dl-nitrogen6_vm-magstripe.dtb"
+

Why do you remove the imx6q-nitrogen6_som2 whereas it is now in linux-fslc (and in 4.10)?

We are still using 4.9 so it does not provide som2. If you can add it, good.

Signature · 3 lines
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750
#12 lore raw

Re: [3rdparty PATCH 4/4] nitrogen6x: Add 'use-mainline-bsp' support

Hi Otavio,

Quoted 28 lines · Otavio Salvador
Quoted 10 lines · Gary Bisson
Quoted 9 lines · Otavio Salvador

The 'use-mainline-bsp' makes use of linux-fslc as kernel and removes the not yet supported device-tree files from installation set.

---

 conf/machine/nitrogen6x.conf | 4 ++++
 1 file changed, 4 insertions(+)
Quoted 14 lines

conf/machine/nitrogen6x.conf KERNEL_DEVICETREE = "imx6q-sabrelite.dtb \ · line 45

Quoted 11 lines
conf/machine/nitrogen6x.conf +3 -0
index 8af1b1f..aa068ac 100644
@@ -40,10 +40,14 @@ KERNEL_DEVICETREE = "imx6q-sabrelite.dtb \
                         imx6q-nitrogen6_som2.dtb imx6qp-nitrogen6_som2.dtb \
                         imx6dl-nitrogen6_vm.dtb imx6dl-nitrogen6_vm-magstripe.dtb \
 "
+KERNEL_DEVICETREE_remove_use-mainline-bsp = "imx6q-nitrogen6_som2.dtb imx6qp-nitrogen6_som2.dtb \
+                                             imx6dl-nitrogen6_vm.dtb imx6dl-nitrogen6_vm-magstripe.dtb"
+

Why do you remove the imx6q-nitrogen6_som2 whereas it is now in linux-fslc (and in 4.10)?

Quoted 1 line

We are still using 4.9 so it does not provide som2. If you can add it, good.

It is already part of linux-fslc:
https://github.com/Freescale/linux-fslc/commit/404a65b0

Regards,
Gary

#15 lore raw
In reply to Gary Bisson
Quoted 2 lines · Gary Bisson

First of all, thank you for this series and the great job you've done to add mainline support, this is highly appreciated!

This was indeed an important step. It makes easier to compare both BSP support now.

Quoted 7 lines · Otavio Salvador
Quoted 6 lines

This patchset makes use of the infrastructure added to meta-freescale to enable easier use of mainline-based BSP. To enable it, include:

MACHINEOVERRIDES .= ":use-mainline-bsp"

Quoted 7 lines
Quoted 4 lines

To the local.conf and everything is done automatically.

The bootscript still needs some love to work out of box but this will be left for Boundary Devices ;-)

I've fixed one of the two issues already [1] so bootdir doesn't need to be set any more.

Great.

Quoted 9 lines

The only thing that still needs to be figured out is the root= parameter which right now requires the following variable to be set when booting a Nitrogen6X with WiFi module from first SD slot:
=> setenv root /dev/mmcblk1p2

The reason is that mainline kernel doesn't allow to change the numbering order of SDHC devices based on aliases. Sascha offered a patch which never got accepted (but is in the NXP tree) [2].

Quoted 5 lines

So on a device where a WiFi module is present, the first sdcard device will be named mmcblk1. But on a SabreLite (no WiFi), it will be mmcblk0 as the bootscript thinks it is.

I haven't found a good approach yet to fix it, ideas are welcomed ;)

Use UUID for booting. It can be done on U-Boot as it can pass the UUID for the root= argument. See:

https://github.com/Freescale/u-boot-fslc/commit/b4227954508ac995e9ded35ea055456788a2e807

Signature · 3 lines
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750
#13 lore raw

Re: [3rdparty PATCH 4/4] nitrogen6x: Add 'use-mainline-bsp' support

In reply to Gary Bisson
Quoted 32 lines · Gary Bisson

Hi Otavio,

Quoted 28 lines · Otavio Salvador
Quoted 24 lines · Gary Bisson
Quoted 14 lines · Otavio Salvador

The 'use-mainline-bsp' makes use of linux-fslc as kernel and removes the not yet supported device-tree files from installation set.

---

 conf/machine/nitrogen6x.conf | 4 ++++
 1 file changed, 4 insertions(+)
conf/machine/nitrogen6x.conf +0 -0
index 8af1b1f..aa068ac 100644

conf/machine/nitrogen6x.conf KERNEL_DEVICETREE = "imx6q-sabrelite.dtb \ · line 45

Quoted 6 lines
conf/machine/nitrogen6x.conf +3 -0
@@ -40,10 +40,14 @@ KERNEL_DEVICETREE = "imx6q-sabrelite.dtb \
                         imx6q-nitrogen6_som2.dtb imx6qp-nitrogen6_som2.dtb \
                         imx6dl-nitrogen6_vm.dtb imx6dl-nitrogen6_vm-magstripe.dtb \
 "
+KERNEL_DEVICETREE_remove_use-mainline-bsp = "imx6q-nitrogen6_som2.dtb imx6qp-nitrogen6_som2.dtb \
+                                             imx6dl-nitrogen6_vm.dtb imx6dl-nitrogen6_vm-magstripe.dtb"
+

Why do you remove the imx6q-nitrogen6_som2 whereas it is now in linux-fslc (and in 4.10)?

Quoted 4 lines
Quoted 1 line

We are still using 4.9 so it does not provide som2. If you can add it, good.

It is already part of linux-fslc:
https://github.com/Freescale/linux-fslc/commit/404a65b0

Oh indeed; I got it before picking those commits. Thanks for reminding me.

Signature · 3 lines
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750
Reviewed-by
#8 lore raw

Re: [3rdparty PATCH 3/4] nitrogen6x: Add wic image tool support

In reply to Otavio Salvador
Quoted 7 lines · Otavio Salvador
Quoted 5 lines · Gary Bisson
Quoted 3 lines · Otavio Salvador

The wic image needs to install the bootscript and it loads the respective kernel image and device-tree files from the image, thus those need to be included.

Quoted 7 lines
Quoted 3 lines

Not sure to understand the wic image requirement. First, is the wic image only applies when "use-mainline-bsp" is set? I couldn't find where it was mainline specific.

It is not mainline specific but as we move away the mx6 override the image class does not work. So I end using it so we can get it building an out of box image to use.

Ok good to know. I just wanted to check that the other dtb shouldn't be declared as well for "regular" NXP-based BSP.

In that case:

Regards,
Gary

#16 lore raw
In reply to Otavio Salvador

Hi Otavio,

Quoted 10 lines · Otavio Salvador

<snip>

Quoted 9 lines

The only thing that still needs to be figured out is the root= parameter which right now requires the following variable to be set when booting a Nitrogen6X with WiFi module from first SD slot:
=> setenv root /dev/mmcblk1p2

The reason is that mainline kernel doesn't allow to change the numbering order of SDHC devices based on aliases. Sascha offered a patch which never got accepted (but is in the NXP tree) [2].

Quoted 8 lines
Quoted 5 lines

So on a device where a WiFi module is present, the first sdcard device will be named mmcblk1. But on a SabreLite (no WiFi), it will be mmcblk0 as the bootscript thinks it is.

I haven't found a good approach yet to fix it, ideas are welcomed ;)

Use UUID for booting. It can be done on U-Boot as it can pass the UUID for the root= argument. See:

Great idea! I'm going to do that, I need to add the CMD_PART to our config and update the 6x_bootscript accordingly.

I'll let you know once it's done (hopefully I'll have time this week).

Regards,
Gary