kernel driver not compiling?

Hi guys,

I am working on Tk1 based little bit modified board, And i need to add wm8978 audio driver,

although I added line CONFIG_SND_SOC_WM8978=y to tegra12_defconfig, wm8978.o didnt compiled. help me

You’ll need to provide more information. Which kernel source did you use, what starting config did you use prior to the edit, and what was the compile command line you used? Was this a cross compile or compiled natively on a TK1?

These are my compiling commands, from it, you can see my compiler, config files.

export CROSS_COMPILE=/usr/bin/arm-linux-gnueabi-
export TEGRA_KERNEL_OUT=…/dobu
export ARCH=arm

make O=$TEGRA_KERNEL_OUT tegra12_defconfig
make O=$TEGRA_KERNEL_OUT zImage
make O=$TEGRA_KERNEL_OUT dtbs

I downloaded my kernel from Jetson Download Center (L4T Kernel Sources V21.5)

Since our modified board has wm8978 instead of rt5639, I have cleaned some rt5639 releted stuff from the kernel like:

  • in tegra12_defconfig, CONFIG_SND_SOC_TEGRA_RT5639=n (from y to n)
  • in board-ardbeg.c,
    deleted following, and where it usues rt5639_board_info,…

static struct i2c_board_info __initdata rt5639_board_info = {
I2C_BOARD_INFO(“rt5639”, 0x1c),
}

I thought that,… If I add following lines proper positions,

static struct i2c_board_info __initdata wm8978_board_info = {
I2C_BOARD_INFO(“wm8978”, 0x1a),
}
i2c_register_board_info(0, &wm8978_board_info, 1);

and included line “CONFIG_SND_SOC_WM8978=y” to tegra12_defconfig will make my audio card work…

/P.s. I am new to kernel, and did I provide you enough information?/

It looks like the basics are correct. Which cross compiler were you using? E.g.:

/usr/bin/arm-linux-gnueabi-gcc --version

When you made the edits to CONFIG_ items, did you use something like “make menuconfig”, or did you edit the .config directly? I ask because sometimes there are dependencies and the GUI-based editors tend to work well with dependencies.

Can you post the relevant error (and perhaps a few lines before the error for context) from the build?

Also, if you do everything the same, except without any edits (purely a tegra12_defconfig) does the kernel build correctly? If not, what error shows?

Thank you for your quick responses,

my compilers version: arm-linux-gnueabi-gcc (Ubuntu/Linaro 4.7.3-12ubuntu1) 4.7.3

Kernel as a whole it compiles without any error(whether tegra12_config edited or not); however, problem is my specific driver(wm8978.c) didn’t become wm8978.o.

I guess you’re right about dependencies. I have edited config file directly, and I have never used GUI based menuconfig before…

where should I (as a beginner) read about menuconfig/xconfig or any other GUI baseds, and what other advices and recommendations you have?

I have tried make menuconfig a little bit, and loaded tegra12_defconfig
and when I searched 8978, following is shown to me.

│ Symbol: SND_SOC_WM8978 [=n] │
│ Type : tristate │
│ Defined at sound/soc/codecs/Kconfig:512 │
│ Depends on: SOUND [=y] && !M68K && !UML && SND [=y] && SND_SOC [=y] │
│ Selected by: SND_SOC_ALL_CODECS [=n] && SOUND [=y] && !M68K && !UML && SND [=y] && SND_SOC [=y] && I2C [=y] || SND_SIU_MIGOR [=n] && SOUND [=y] && !M68K && !UML && SND [=y] && SND_SOC [=y] && (S │

I guess according to it all necessary things are [Y], isn’t it?
And also wm8978 doesn’t have location where I go there, and change it to [Y].
??? what does it mean?

I am kinda lost.

Typically the newest compiler isn’t needed, and the Documentation download even comes with a rather old compiler (crosstool-ng 4.8.2 was originally used, I think it is now 4.8.5), but 4.7 may actually be too old (I don’t know…4.7 may also work fine). Typically the Documentation download with the release has a “baggage” subdirectory with a recommended compiler, or else information on building the recommended compiler. I would not recommend building your own compiler unless have a particular need. Just beware that your compiler version might be slightly too old. Is this version from an Ubuntu 14.04 standard package (I’m using Fedora, I can’t look)?

The README file at the top level directory of the kernel source has a section “Alternative configuration commands are”. This also mentions the “O=” parameter useful for cross compiles, but the downloadable Documentation has more information on this. When you “make Image” or “make zImage” it produces a final file…when you use “make” with any of the config utilities it actually executes a config program you can use interactively.

One possibility as to what you missed from a direct edit:

SND_SOC_ALL_CODECS [=n]

Something else to consider is that when hand editing you may not know which parts can be built as a module, and which parts can only be built as an integrated kernel feature. If you wanted to build your driver as a module and it is only possible as an integrated feature, then hand editing as “=m” could result in an invalid feature.

I suggest you run “make nconfig”, then use the search feature and look for “SND_SOC_WM8978”. Look at the menu at the bottom of nconfig and note that you can enable seeing invisible features…if SND_SOC_WM8978 does not show up normally, perhaps it is because you have something else in need of enabling first.

Do be sure to always start with either tegra12_defconfig target or (better yet) copy/gunzip of the “/proc/config.gz” to “.config”. Never forget to edit CONFIG_LOCALVERSION to match the suffix you get from “uname -r”.

If it still fails post the error message and perhaps a few lines prior to the error.

Thank you linuxdev, It was a dependency related problem.

Is your wm8978 audio successful?

Almost yes. At least, I could audio files.

Can you help me? I use the TX2 wm8978 audio, I finished configuring, no error, but can not record and play music

Can you share your amixer configuration?