cancel
Showing results for 
Search instead for 
Did you mean: 

Hello I'm trying to write a loadable kernel module driver. I get an error during compilation: ERROR: modpost: "platform_device_alloc" [/home/rdm/ethtest/eth-ins.ko] undefined! Do I need something to set in the Kernel Config? Helloworld works as LKM.

NKorn.3
Associate

#include <linux/platform_device.h>

#include <linux/module.h

#include <linux/types.h>

MODULE_LICENSE("GPL");

MODULE_AUTHOR("Robert W. Oliver II");

MODULE_DESCRIPTION("A simple example Linux module.");

MODULE_VERSION("0.01");

static struct platform_device *pdev;

static int __init fake_eth_add(void)

{

  int inst_id = 0;

  pdev = platform_device_alloc("fake-eth", inst_id);

  return 0;

}

static void __exit fake_eth_put(void)

{

}

module_init(fake_eth_add);

module_exit(fake_eth_put);

1 REPLY 1
Olivier GALLIEN
ST Employee

Hi @Community member​ 

Did you refer to following wiki page ?

https://wiki.st.com/stm32mpu/wiki/How_to_cross-compile_with_the_Developer_Package#Modifying-2Fadding_an_external_Linux_kernel_module

Such kind of error usually come from bad installation / initialization of the SDK.

Double check your environment.

Hope it help,

Olivier

Olivier GALLIEN
In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.