Skip to content

imx-defconfig: Add support to build SOF for imx8 - #13

Merged
plbossart merged 2 commits into
thesofproject:masterfrom
dbaluta:master
Nov 15, 2019
Merged

plbossart merged 2 commits into
thesofproject:masterfrom
dbaluta:master

Conversation

@dbaluta

@dbaluta dbaluta commented Jul 23, 2019

Copy link
Copy Markdown

Signed-off-by: Daniel Baluta [email protected]

@plbossart

Copy link
Copy Markdown
Member

@dbaluta shouldn't we start with the baseline for compilation on ARM in general.
Also we typically leave nocodec aside and use nocodec-defconfig

@dbaluta

dbaluta commented Jul 24, 2019 •

Copy link
Copy Markdown
Author

@plbossart By reading the README I understood that the baseline for each architecture is the defconfig file (e.g arch/arm64/configfs/defconfig).

As far as I understand from defconfig we generate initial .config then merge it with base-defconfig then with imx-defconfig.

So, the final .config used for compilation would be:

  • defconfig (arm64) + base-defconfig + imx-defconfig

In the case of arm64 this is far from ideal because defconfig on arm64 contains all arm64 based boards and the compilation takes around 10 minutes on a 8 core Xeon(R) CPU E5-1620 machine.

I have a reduced config for arm and the combination:

  • defconfig + base-defconfig + imx-defconfig

takes under 2 minutes.

How can we propagate my reduced config to the CI server?

@plbossart

Copy link
Copy Markdown
Member

@plbossart By reading the README I understood that the baseline for each architecture is the defconfig file (e.g arch/arm64/configfs/defconfig).

As far as I understand from defconfig we generate initial .config then merge it with base-defconfig then with imx-defconfig.

So, the final .config used for compilation would be:

  • defconfig (arm64) + base-defconfig + imx-defconfig

In the case of arm64 this is far from ideal because defconfig on arm64 contains all arm64 based boards and the compilation takes around 10 minutes on a 8 core Xeon(R) CPU E5-1620 machine.

I have a reduced config for arm and the combination:

  • defconfig + base-defconfig + imx-defconfig

Sorry I don't get your point. The two options look identical to me, it's the same set of defconfig+base+imx, and the defconfig is arch-specific. What I am missing? Is there a typo in your explanation or a concept I am missing?

takes under 2 minutes.

How can we propagate my reduced config to the CI server?

Once we agree on the default, we'd need @xiulipan to reflect the changes but I understand he's taking personal time off.

@dbaluta

dbaluta commented Jul 24, 2019

Copy link
Copy Markdown
Author

@plbossart By reading the README I understood that the baseline for each architecture is the defconfig file (e.g arch/arm64/configfs/defconfig).
As far as I understand from defconfig we generate initial .config then merge it with base-defconfig then with imx-defconfig.
So, the final .config used for compilation would be:

  • defconfig (arm64) + base-defconfig + imx-defconfig

In the case of arm64 this is far from ideal because defconfig on arm64 contains all arm64 based boards and the compilation takes around 10 minutes on a 8 core Xeon(R) CPU E5-1620 machine.
I have a reduced config for arm and the combination:

  • defconfig + base-defconfig + imx-defconfig

Sorry I don't get your point. The two options look identical to me, it's the same set of defconfig+base+imx, and the defconfig is arch-specific. What I am missing? Is there a typo in your explanation or a concept I am missing?

You are right it is confusing. Both options look identical with a minor difference. See below:

First test:

  1. defconfig - arm64 defconfig (vanilla)
  2. base-defconfig - this basically enables everything related to ASoC
  3. imx-defconfig - this basically enables everything related to SOF imx

This takes 10 mintues.

Second test:

Everything as above but reduce 1) defconfig by removing all other arm64 boards except imx. This takes under 1 minute.

Does this make sense?

The problem is that starting with a plain arm64 vanilla defconfig would be a pain because by default arm64 enables all supported platforms (and they are a lot!).

@plbossart

Copy link
Copy Markdown
Member

right, so we'd need an arm64-lite-defconfig where you remove all the unsupported boards, right?

@xiulipan

Copy link
Copy Markdown

@plbossart @dbaluta
I still got some random online time :)

So for the IMX kconfig
I believe we can get the bigger defconfig by run make ARCH=arm64 defconfig
And then the merge config is simple.

Here are few question before adding arm64 linux build into CI.

  • where is the

Everything as above but reduce 1) defconfig by removing all other arm64 boards except imx.
defconfig.

  • what compiler should I use? I tried default gcc7.3 from X86 ubuntu and could not work.

@dbaluta

dbaluta commented Jul 25, 2019 •

Copy link
Copy Markdown
Author

@plbossart @dbaluta
I still got some random online time :)

So for the IMX kconfig
I believe we can get the bigger defconfig by run make ARCH=arm64 defconfig
And then the merge config is simple.

Here are few question before adding arm64 linux build into CI.

@plbossart @xiulipan sorry for delayed response I'm not in the office these days.

I have updated this PR with imx lite config and with instruction how to cross compile the kernel image.

d1ee54c

@xiulipan i am using the default cross compiler aarch64-linux-gnu- in Ubuntu 18.04 (gcc 7.4). Please find all the instruction in the commit above.

@lgirdwood lgirdwood left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feel free to add these instruction on sof-docs too.

@plbossart

Copy link
Copy Markdown
Member

@dbaluta isn't it easier if you take a defconfig and remove what you don't need with a fragment? the last fragment overrides the initial ones, so you don't need to keep track of everything, e.g. selecting stuff like CONFIG_HZ is a bit too much in the details?

@dbaluta

dbaluta commented Jul 26, 2019

Copy link
Copy Markdown
Author

@plbossart, to remove what I don't need with a fragment means that I create a fragment where options from the initial defconfig that I do not need are marked as =n right?

@plbossart

Copy link
Copy Markdown
Member

@plbossart, to remove what I don't need with a fragment means that I create a fragment where options from the initial defconfig that I do not need are marked as =n right?

yes, or commented out (as for HDaudio)

@dbaluta

dbaluta commented Jul 26, 2019

Copy link
Copy Markdown
Author

yes, or commented out (as for HDaudio)

OK, let me give it a try.

@plbossart

plbossart commented Jul 26, 2019 •

Copy link
Copy Markdown
Member

e.g.

# Disable HDAudio legacy
# CONFIG_SND_HDA_INTEL is not set

is enough to remove the default in defconfig.

@dbaluta

dbaluta commented Jul 29, 2019

Copy link
Copy Markdown
Author

@plbossart thanks for your comments. I have added a kconfig fragment named nobloat-imx-defconfig this should remove most of unrelated to imx8 config options.

Comment thread nobloat-imx-defconfig Resolved
@dbaluta

dbaluta commented Jul 29, 2019

Copy link
Copy Markdown
Author

@xiulipan, out of curiosity how long does it take to compile arm64 with default config on your machines? i just checked now and on our side the bottleneck actually is the disk + weird combination of network backed fs

@dbaluta

dbaluta commented Jul 29, 2019

Copy link
Copy Markdown
Author

@plbossart @xiulipan i think the commit now it's a good first start for compiling support for arm64 targeted for imx8 platform.

@plbossart

Copy link
Copy Markdown
Member

@dbaluta I just tried on my Skylake NUC (i7+1TB SSB), I can compile the defconfig+no_bloat config in about 6mn. You still have quite a few things in there that are probably useless such Nouveau drivers and other DRM things.

With the ARM64 defconfig the time is about 7mn30, so the speed-up is limited.

Also I wasn't able to select iMX in SOF with the merge_config script, I have to go in and select them manually. Not sure if this is because of the kconfig files or rather the kernel PR that's still WIP.

@xiulipan

Copy link
Copy Markdown

@dbaluta @plbossart
On my machine is about 5min, on our build node it is about 8mins.
It seems Linux patch for IMX support is still pending? The merge scripts will have some invalid kconfig option with the sof-dev branch.

@dbaluta

dbaluta commented Jul 30, 2019

Copy link
Copy Markdown
Author

@plbossart drm + nouveau are first suspect indeed, even with them out i don't think we can go under 5 mins. There are tons of not useful drivers regarding i.MX board.

Will try to do more experiments, but as you said i will try to keep nobloat-imx config super small because it will be hard to maintain in the future.

For imx SOF did you try merge of .config + no_bloat + sof-defconfig right? Because on my side the merge actually selects IMX SOF configs?

@plbossart

Copy link
Copy Markdown
Member

@plbossart drm + nouveau are first suspect indeed, even with them out i don't think we can go under 5 mins. There are tons of not useful drivers regarding i.MX board.

Will try to do more experiments, but as you said i will try to keep nobloat-imx config super small because it will be hard to maintain in the future.

For imx SOF did you try merge of .config + no_bloat + sof-defconfig right? Because on my side the merge actually selects IMX SOF configs?

yep. Can you send me the exact commands you tried?

@dbaluta

dbaluta commented Jul 30, 2019

Copy link
Copy Markdown
Author

@plbossart i have used the following commands. Please mind that i also have the imx8 patches applied thesofproject/linux#1048. Without these patches indeed there is no IMX8 SOF config to select.

# setup crosscompiler for arm64
$ make defconfig
$ ./scripts/kconfig/merge_config.sh .config /work/repos/kconfig/base-defconfig /work/repos/kconfig/nobloat-imx-defconfig /work/repos/kconfig/sof-defconfig 

the resulted .config file has

CONFIG_SND_SOC_SOF_IMX_TOPLEVEL=y
CONFIG_SND_SOC_SOF_IMX8=m

I will try to send asap a next version of the patches your feedback applied.

@plbossart

plbossart commented Jul 30, 2019 via email

Copy link
Copy Markdown
Member

@dbaluta

dbaluta commented Jul 31, 2019

Copy link
Copy Markdown
Author

@plbossart strange. Will try to reproduce your setup on my side. Sorry for wasting your time.

@plbossart

Copy link
Copy Markdown
Member

@plbossart strange. Will try to reproduce your setup on my side. Sorry for wasting your time.

no worries, it could be a bug that needs to be fixed in the scripts. If this helps maybe we can have a first pass with the changes to sof-defconfig and you add the optimized defconfig later in a followup PR

@xiulipan

xiulipan commented Aug 1, 2019

Copy link
Copy Markdown

@plbossart @dbaluta
A soft reminder, the IMX support is still in PR. Do you build with Linux PR thesofproject/linux#1048

I can get the right kconfig with both PR.

CONFIG_SND_SOC_SOF_TOPLEVEL=y
CONFIG_SND_SOC_SOF_PCI=m
CONFIG_SND_SOC_SOF_ACPI=m
CONFIG_SND_SOC_SOF_DT=y
CONFIG_SND_SOC_SOF_OPTIONS=y
# CONFIG_SND_SOC_SOF_NOCODEC_SUPPORT is not set
# CONFIG_SND_SOC_SOF_STRICT_ABI_CHECKS is not set
CONFIG_SND_SOC_SOF_DEBUG=y
# CONFIG_SND_SOC_SOF_DEBUG_XRUN_STOP is not set
CONFIG_SND_SOC_SOF_DEBUG_VERBOSE_IPC=y
# CONFIG_SND_SOC_SOF_DEBUG_FORCE_IPC_POSITION is not set
CONFIG_SND_SOC_SOF_DEBUG_ENABLE_DEBUGFS_CACHE=y
CONFIG_SND_SOC_SOF_DEBUG_ENABLE_FIRMWARE_TRACE=y
CONFIG_SND_SOC_SOF_DEBUG_IPC_FLOOD_TEST=y
CONFIG_SND_SOC_SOF=y
CONFIG_SND_SOC_SOF_IMX_TOPLEVEL=y
CONFIG_SND_SOC_SOF_IMX8=y

@dbaluta

dbaluta commented Aug 1, 2019

Copy link
Copy Markdown
Author

@xiulipan can you let us know the commands you used to get the right Kconfig? As mentioned above I do also get them correctly but on @plbossart it seems there are some problems.

So, I'm trying to find some time to look at this but I am also working on new version of thesofproject/linux#1048

@xiulipan

xiulipan commented Aug 1, 2019

Copy link
Copy Markdown

@dbaluta the same command with you, but in the linux kernel with thesofproject/linux#1048

You defined

SND_SOC_SOF_IMX_TOPLEVEL
SND_SOC_SOF_IMX8

in thesofproject/linux#1048, if you do not use the right source code. The Kconfig option you mentioned is invalid for the make system.

@dbaluta

dbaluta commented Aug 1, 2019

Copy link
Copy Markdown
Author

@xiulipan thanks! It means that @plbossart is not working on this branch but on topic/sof-dev. Let me test this again with the new patches incoming and perhaps then we can agree on merging this PR.

@plbossart

Copy link
Copy Markdown
Member

@xiulipan thanks! It means that @plbossart is not working on this branch but on topic/sof-dev. Let me test this again with the new patches incoming and perhaps then we can agree on merging this PR.

no, I did test with pr1048. That's why I don't get why the options are not selected.

@xiulipan

xiulipan commented Aug 2, 2019

Copy link
Copy Markdown

@plbossart
Will try to use make.cross to check. I used normal make with
ARCH=arm64 CROSS_COMPILE=/usr/bin/aarch64-linux-gnu- make defconfig

@dbaluta

dbaluta commented Oct 15, 2019

Copy link
Copy Markdown
Author

@plbossart I think I missed to select an option, it seems that merge doesn't resolve dependencies. So, I think it should work now.

@dbaluta

dbaluta commented Oct 15, 2019

Copy link
Copy Markdown
Author

On another look I have a compilation error. Will fix it in few hours and let you know.

@dbaluta

dbaluta commented Oct 16, 2019 •

Copy link
Copy Markdown
Author

@plbossart I think frag config are OK now. Can you give it another try?
@singalsu if everything is OK can we merge this and have arm64 build?
Build on my side takes 3:30 minutes.

@dbaluta

dbaluta commented Oct 23, 2019

Copy link
Copy Markdown
Author

@xiulipan let me know if you get some spare time to pull my patches in the CI so that we can have a minimum compilation for the ARM platform :)

@xiulipan

Copy link
Copy Markdown

@dbaluta Will try and update the result here.

@dbaluta

dbaluta commented Oct 30, 2019

Copy link
Copy Markdown
Author

@lgirdwood @xiulipan did you get a chance to look into this? I think @Mihaix can provide some help if you guide us what to do

@plbossart plbossart left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see comment below

Comment thread sof-defconfig Outdated

#SOF i.MX platform drivers
CONFIG_SND_SOC_SOF_IMX_TOPLEVEL=y
CONFIG_SND_SOC_SOF_IMX8=y

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this will have to be changed, see the PR to fix the Kconfigs thesofproject/linux#1382

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@plbossart all right, will handle this asap. I'm now at ELCE :).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no worries, I probably broke a number of eggs with my Kconfig changes, so it can wait next week. Enjoy ELC!

…n time

arm64 world uses a huge defconfig which compiles support
for all arm64 boards.

This results in huge compilation times not suitable for
a CI. Introduce nobloat-imx-defconfig kconfig frament which
removes as much config options as possible.

How to compile a kernel for i.MX8QXP (Ubuntu 18.04):

1) Download cross compiler
$ sudo apt-get install gcc-aarch64-linux-gnu

2) Build .config based on defconfig

$ ARCH=arm64 CROSS_COMPILE=/usr/bin/aarch64-linux-gnu- make defconfig

4) Reduce defconfig (by merging with imx-no-bloat) and add support for
compiling SOF by merging sof-defconfig kconfig fragment.

$ ARCH=arm64 CROSS_COMPILE=/usr/bin/aarch64-linux-gnu-
./scripts/kconfig/merge_config.sh .config
<>/kconfig/nobloat-imx-defconfig <>/kconfig/sof-defconfig

5) Build kernel

$ ARCH=arm64 CROSS_COMPILE=/usr/bin/aarch64-linux-gnu- make -j8

Signed-off-by: Daniel Baluta <[email protected]>
@dbaluta

dbaluta commented Nov 15, 2019

Copy link
Copy Markdown
Author

@xiulipan @plbossart we are ready to go with arm64 build :)

@plbossart
plbossart merged commit c03e118 into thesofproject:master Nov 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants