Unable to build simple Hello world kernel module
I have just started writing kernel modules. I am referring to this guide.
I wrote a simple Hello world program exactly as specified in the guide.
#include <linux/module.h> /* Needed by all modules */
#include <linux/kernel.h> /* Needed for KERN_INFO */
int init_module(void)
{
printk(KERN_INFO "Hello world 1.n");
/*
* A non 0 return means init_module failed; module can't be loaded.
*/
return 0;
}
void cleanup_module(void)
{
printk(KERN_INFO "Goodbye world 1.n");
}
I tried compiling it using the following makefile:
obj-m += hello-1.o
all:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
clean:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
I get the error:
error: code model kernel does not support PIC mode
I looked up on this forum and others and found the following
- Somebody who was trying to build the Linux kernel and couldn't. Here
- That lead me to this patch. But I don't know how to use it.
- Then I tried with gcc-5 (just ot see what happens. It still doesn't work.
- I basically went through all steps as this guy. I tried adding
-fno-pie
, then the other steps that guy follows.
$ uname -a
Linux cristopher 4.15.0-43-generic #46-Ubuntu SMP Thu Dec 6 14:45:28 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
According to the bug link, this has been fixed in gcc
. But i think it is not yet in the stable release that I am using.
I can think of multiple solutions to this problem.
1. Installing the patch from (2) above.
2. Using an old version of gcc
where this is not an issue.
3. Usinng some more extra flags in the kernel makefile. (Not sure of this though.)
I don't know how to do any of the above things. Any help would be appreciated.
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.1 LTS
Release: 18.04
Codename: bionic
PS: I recently upgraded to 18.04 from 16.04. It was working fine previously.
Including the complete output of make all
.
$ make all
make -C /lib/modules/4.15.0-43-generic/build M=/media/parth/F/Parth/programs/dev modules
make[1]: Entering directory '/usr/src/linux-headers-4.15.0-43-generic'
CC [M] /media/parth/F/Parth/programs/dev/hello-1.o
/media/parth/F/Parth/programs/dev/hello-1.c:1:0: error: code model kernel does not support PIC mode
#include <linux/module.h> /* Needed by all modules */
^
scripts/Makefile.build:339: recipe for target '/media/parth/F/Parth/programs/dev/hello-1.o' failed
make[2]: *** [/media/parth/F/Parth/programs/dev/hello-1.o] Error 1
Makefile:1551: recipe for target '_module_/media/parth/F/Parth/programs/dev' failed
make[1]: *** [_module_/media/parth/F/Parth/programs/dev] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-4.15.0-43-generic'
Makefile:7: recipe for target 'all' failed
make: *** [all] Error 2
Okay, I am not really sure how, or why, but the original error is not coming anymore.
But there is a new error:
In file included from ./include/linux/list.h:5:0,
from ./include/linux/module.h:9,
from /media/parth/F/Parth/programs/dev/hello-1.c:1:
./include/linux/types.h:17:9: error: unknown type name ‘__kernel_ino_t’
typedef __kernel_ino_t ino_t;
^~~~~~~~~~~~~~
./include/linux/types.h:18:9: error: unknown type name ‘__kernel_mode_t’
typedef __kernel_mode_t mode_t;
^~~~~~~~~~~~~~~
./include/linux/types.h:21:9: error: unknown type name ‘__kernel_off_t’
typedef __kernel_off_t off_t;
^~~~~~~~~~~~~~
etc, etc, etc....
It all seems to stem from this:
In file included from ./include/linux/list.h:9:0,
from ./include/linux/module.h:9,
from /media/parth/F/Parth/programs/dev/hello-1.c:1:
./include/linux/kernel.h:6:10: fatal error: stdarg.h: No such file or directory
#include <stdarg.h>
^~~~~~~~~~
I tried removing the -fno-pie
from the kernel build makefile in the following lines(around line 650) in my system. and got the original error message back.
KBUILD_CFLAGS += $(call cc-option,-fno-PIE)
KBUILD_AFLAGS += $(call cc-option,-fno-PIE)
Okay,
I updated my system, after the release files at this, this, and this links became valid. Seems that they have fixed the error. Or, is there a clause that you cannot upgrade to the latest packages once you perform a clean install of UBUNTU?
Either way, would still like to know more...
18.04 kernel gcc
New contributor
|
show 2 more comments
I have just started writing kernel modules. I am referring to this guide.
I wrote a simple Hello world program exactly as specified in the guide.
#include <linux/module.h> /* Needed by all modules */
#include <linux/kernel.h> /* Needed for KERN_INFO */
int init_module(void)
{
printk(KERN_INFO "Hello world 1.n");
/*
* A non 0 return means init_module failed; module can't be loaded.
*/
return 0;
}
void cleanup_module(void)
{
printk(KERN_INFO "Goodbye world 1.n");
}
I tried compiling it using the following makefile:
obj-m += hello-1.o
all:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
clean:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
I get the error:
error: code model kernel does not support PIC mode
I looked up on this forum and others and found the following
- Somebody who was trying to build the Linux kernel and couldn't. Here
- That lead me to this patch. But I don't know how to use it.
- Then I tried with gcc-5 (just ot see what happens. It still doesn't work.
- I basically went through all steps as this guy. I tried adding
-fno-pie
, then the other steps that guy follows.
$ uname -a
Linux cristopher 4.15.0-43-generic #46-Ubuntu SMP Thu Dec 6 14:45:28 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
According to the bug link, this has been fixed in gcc
. But i think it is not yet in the stable release that I am using.
I can think of multiple solutions to this problem.
1. Installing the patch from (2) above.
2. Using an old version of gcc
where this is not an issue.
3. Usinng some more extra flags in the kernel makefile. (Not sure of this though.)
I don't know how to do any of the above things. Any help would be appreciated.
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.1 LTS
Release: 18.04
Codename: bionic
PS: I recently upgraded to 18.04 from 16.04. It was working fine previously.
Including the complete output of make all
.
$ make all
make -C /lib/modules/4.15.0-43-generic/build M=/media/parth/F/Parth/programs/dev modules
make[1]: Entering directory '/usr/src/linux-headers-4.15.0-43-generic'
CC [M] /media/parth/F/Parth/programs/dev/hello-1.o
/media/parth/F/Parth/programs/dev/hello-1.c:1:0: error: code model kernel does not support PIC mode
#include <linux/module.h> /* Needed by all modules */
^
scripts/Makefile.build:339: recipe for target '/media/parth/F/Parth/programs/dev/hello-1.o' failed
make[2]: *** [/media/parth/F/Parth/programs/dev/hello-1.o] Error 1
Makefile:1551: recipe for target '_module_/media/parth/F/Parth/programs/dev' failed
make[1]: *** [_module_/media/parth/F/Parth/programs/dev] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-4.15.0-43-generic'
Makefile:7: recipe for target 'all' failed
make: *** [all] Error 2
Okay, I am not really sure how, or why, but the original error is not coming anymore.
But there is a new error:
In file included from ./include/linux/list.h:5:0,
from ./include/linux/module.h:9,
from /media/parth/F/Parth/programs/dev/hello-1.c:1:
./include/linux/types.h:17:9: error: unknown type name ‘__kernel_ino_t’
typedef __kernel_ino_t ino_t;
^~~~~~~~~~~~~~
./include/linux/types.h:18:9: error: unknown type name ‘__kernel_mode_t’
typedef __kernel_mode_t mode_t;
^~~~~~~~~~~~~~~
./include/linux/types.h:21:9: error: unknown type name ‘__kernel_off_t’
typedef __kernel_off_t off_t;
^~~~~~~~~~~~~~
etc, etc, etc....
It all seems to stem from this:
In file included from ./include/linux/list.h:9:0,
from ./include/linux/module.h:9,
from /media/parth/F/Parth/programs/dev/hello-1.c:1:
./include/linux/kernel.h:6:10: fatal error: stdarg.h: No such file or directory
#include <stdarg.h>
^~~~~~~~~~
I tried removing the -fno-pie
from the kernel build makefile in the following lines(around line 650) in my system. and got the original error message back.
KBUILD_CFLAGS += $(call cc-option,-fno-PIE)
KBUILD_AFLAGS += $(call cc-option,-fno-PIE)
Okay,
I updated my system, after the release files at this, this, and this links became valid. Seems that they have fixed the error. Or, is there a clause that you cannot upgrade to the latest packages once you perform a clean install of UBUNTU?
Either way, would still like to know more...
18.04 kernel gcc
New contributor
1
Hmm... that's odd - it appears to work for me, with the exact same kernel and GCC 7.3.0-27ubuntu1~18.04. Can you provide a more complete transcription of themake
command output?
– steeldriver
Jan 20 at 17:16
3
The only way I can reproduce this error is to do something likemake EXTRA_CFLAGS=-fpic
- do you perhaps have such a variable defined somewhere in your environment (perhaps look atenv | grep FLAGS
)?
– steeldriver
Jan 20 at 17:44
Perhaps this could be useful: askubuntu.com/q/1083091/295286 In my specific case, makefile had to useshell pwd
instead ofPWD
.
– Sergiy Kolodyazhnyy
Jan 21 at 0:34
By the way tldp guide you're referring to seems to be for 2.6 kernel. Whole lot of things have changed since then, so these guides often may not work with modern kernels
– Sergiy Kolodyazhnyy
Jan 21 at 0:36
@SergiyKolodyazhnyy Do you have some other guide that I could use?
– Parth K
Jan 21 at 1:45
|
show 2 more comments
I have just started writing kernel modules. I am referring to this guide.
I wrote a simple Hello world program exactly as specified in the guide.
#include <linux/module.h> /* Needed by all modules */
#include <linux/kernel.h> /* Needed for KERN_INFO */
int init_module(void)
{
printk(KERN_INFO "Hello world 1.n");
/*
* A non 0 return means init_module failed; module can't be loaded.
*/
return 0;
}
void cleanup_module(void)
{
printk(KERN_INFO "Goodbye world 1.n");
}
I tried compiling it using the following makefile:
obj-m += hello-1.o
all:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
clean:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
I get the error:
error: code model kernel does not support PIC mode
I looked up on this forum and others and found the following
- Somebody who was trying to build the Linux kernel and couldn't. Here
- That lead me to this patch. But I don't know how to use it.
- Then I tried with gcc-5 (just ot see what happens. It still doesn't work.
- I basically went through all steps as this guy. I tried adding
-fno-pie
, then the other steps that guy follows.
$ uname -a
Linux cristopher 4.15.0-43-generic #46-Ubuntu SMP Thu Dec 6 14:45:28 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
According to the bug link, this has been fixed in gcc
. But i think it is not yet in the stable release that I am using.
I can think of multiple solutions to this problem.
1. Installing the patch from (2) above.
2. Using an old version of gcc
where this is not an issue.
3. Usinng some more extra flags in the kernel makefile. (Not sure of this though.)
I don't know how to do any of the above things. Any help would be appreciated.
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.1 LTS
Release: 18.04
Codename: bionic
PS: I recently upgraded to 18.04 from 16.04. It was working fine previously.
Including the complete output of make all
.
$ make all
make -C /lib/modules/4.15.0-43-generic/build M=/media/parth/F/Parth/programs/dev modules
make[1]: Entering directory '/usr/src/linux-headers-4.15.0-43-generic'
CC [M] /media/parth/F/Parth/programs/dev/hello-1.o
/media/parth/F/Parth/programs/dev/hello-1.c:1:0: error: code model kernel does not support PIC mode
#include <linux/module.h> /* Needed by all modules */
^
scripts/Makefile.build:339: recipe for target '/media/parth/F/Parth/programs/dev/hello-1.o' failed
make[2]: *** [/media/parth/F/Parth/programs/dev/hello-1.o] Error 1
Makefile:1551: recipe for target '_module_/media/parth/F/Parth/programs/dev' failed
make[1]: *** [_module_/media/parth/F/Parth/programs/dev] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-4.15.0-43-generic'
Makefile:7: recipe for target 'all' failed
make: *** [all] Error 2
Okay, I am not really sure how, or why, but the original error is not coming anymore.
But there is a new error:
In file included from ./include/linux/list.h:5:0,
from ./include/linux/module.h:9,
from /media/parth/F/Parth/programs/dev/hello-1.c:1:
./include/linux/types.h:17:9: error: unknown type name ‘__kernel_ino_t’
typedef __kernel_ino_t ino_t;
^~~~~~~~~~~~~~
./include/linux/types.h:18:9: error: unknown type name ‘__kernel_mode_t’
typedef __kernel_mode_t mode_t;
^~~~~~~~~~~~~~~
./include/linux/types.h:21:9: error: unknown type name ‘__kernel_off_t’
typedef __kernel_off_t off_t;
^~~~~~~~~~~~~~
etc, etc, etc....
It all seems to stem from this:
In file included from ./include/linux/list.h:9:0,
from ./include/linux/module.h:9,
from /media/parth/F/Parth/programs/dev/hello-1.c:1:
./include/linux/kernel.h:6:10: fatal error: stdarg.h: No such file or directory
#include <stdarg.h>
^~~~~~~~~~
I tried removing the -fno-pie
from the kernel build makefile in the following lines(around line 650) in my system. and got the original error message back.
KBUILD_CFLAGS += $(call cc-option,-fno-PIE)
KBUILD_AFLAGS += $(call cc-option,-fno-PIE)
Okay,
I updated my system, after the release files at this, this, and this links became valid. Seems that they have fixed the error. Or, is there a clause that you cannot upgrade to the latest packages once you perform a clean install of UBUNTU?
Either way, would still like to know more...
18.04 kernel gcc
New contributor
I have just started writing kernel modules. I am referring to this guide.
I wrote a simple Hello world program exactly as specified in the guide.
#include <linux/module.h> /* Needed by all modules */
#include <linux/kernel.h> /* Needed for KERN_INFO */
int init_module(void)
{
printk(KERN_INFO "Hello world 1.n");
/*
* A non 0 return means init_module failed; module can't be loaded.
*/
return 0;
}
void cleanup_module(void)
{
printk(KERN_INFO "Goodbye world 1.n");
}
I tried compiling it using the following makefile:
obj-m += hello-1.o
all:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
clean:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
I get the error:
error: code model kernel does not support PIC mode
I looked up on this forum and others and found the following
- Somebody who was trying to build the Linux kernel and couldn't. Here
- That lead me to this patch. But I don't know how to use it.
- Then I tried with gcc-5 (just ot see what happens. It still doesn't work.
- I basically went through all steps as this guy. I tried adding
-fno-pie
, then the other steps that guy follows.
$ uname -a
Linux cristopher 4.15.0-43-generic #46-Ubuntu SMP Thu Dec 6 14:45:28 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
According to the bug link, this has been fixed in gcc
. But i think it is not yet in the stable release that I am using.
I can think of multiple solutions to this problem.
1. Installing the patch from (2) above.
2. Using an old version of gcc
where this is not an issue.
3. Usinng some more extra flags in the kernel makefile. (Not sure of this though.)
I don't know how to do any of the above things. Any help would be appreciated.
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.1 LTS
Release: 18.04
Codename: bionic
PS: I recently upgraded to 18.04 from 16.04. It was working fine previously.
Including the complete output of make all
.
$ make all
make -C /lib/modules/4.15.0-43-generic/build M=/media/parth/F/Parth/programs/dev modules
make[1]: Entering directory '/usr/src/linux-headers-4.15.0-43-generic'
CC [M] /media/parth/F/Parth/programs/dev/hello-1.o
/media/parth/F/Parth/programs/dev/hello-1.c:1:0: error: code model kernel does not support PIC mode
#include <linux/module.h> /* Needed by all modules */
^
scripts/Makefile.build:339: recipe for target '/media/parth/F/Parth/programs/dev/hello-1.o' failed
make[2]: *** [/media/parth/F/Parth/programs/dev/hello-1.o] Error 1
Makefile:1551: recipe for target '_module_/media/parth/F/Parth/programs/dev' failed
make[1]: *** [_module_/media/parth/F/Parth/programs/dev] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-4.15.0-43-generic'
Makefile:7: recipe for target 'all' failed
make: *** [all] Error 2
Okay, I am not really sure how, or why, but the original error is not coming anymore.
But there is a new error:
In file included from ./include/linux/list.h:5:0,
from ./include/linux/module.h:9,
from /media/parth/F/Parth/programs/dev/hello-1.c:1:
./include/linux/types.h:17:9: error: unknown type name ‘__kernel_ino_t’
typedef __kernel_ino_t ino_t;
^~~~~~~~~~~~~~
./include/linux/types.h:18:9: error: unknown type name ‘__kernel_mode_t’
typedef __kernel_mode_t mode_t;
^~~~~~~~~~~~~~~
./include/linux/types.h:21:9: error: unknown type name ‘__kernel_off_t’
typedef __kernel_off_t off_t;
^~~~~~~~~~~~~~
etc, etc, etc....
It all seems to stem from this:
In file included from ./include/linux/list.h:9:0,
from ./include/linux/module.h:9,
from /media/parth/F/Parth/programs/dev/hello-1.c:1:
./include/linux/kernel.h:6:10: fatal error: stdarg.h: No such file or directory
#include <stdarg.h>
^~~~~~~~~~
I tried removing the -fno-pie
from the kernel build makefile in the following lines(around line 650) in my system. and got the original error message back.
KBUILD_CFLAGS += $(call cc-option,-fno-PIE)
KBUILD_AFLAGS += $(call cc-option,-fno-PIE)
Okay,
I updated my system, after the release files at this, this, and this links became valid. Seems that they have fixed the error. Or, is there a clause that you cannot upgrade to the latest packages once you perform a clean install of UBUNTU?
Either way, would still like to know more...
18.04 kernel gcc
18.04 kernel gcc
New contributor
New contributor
edited Jan 21 at 0:10
Parth K
New contributor
asked Jan 20 at 17:07
Parth KParth K
1263
1263
New contributor
New contributor
1
Hmm... that's odd - it appears to work for me, with the exact same kernel and GCC 7.3.0-27ubuntu1~18.04. Can you provide a more complete transcription of themake
command output?
– steeldriver
Jan 20 at 17:16
3
The only way I can reproduce this error is to do something likemake EXTRA_CFLAGS=-fpic
- do you perhaps have such a variable defined somewhere in your environment (perhaps look atenv | grep FLAGS
)?
– steeldriver
Jan 20 at 17:44
Perhaps this could be useful: askubuntu.com/q/1083091/295286 In my specific case, makefile had to useshell pwd
instead ofPWD
.
– Sergiy Kolodyazhnyy
Jan 21 at 0:34
By the way tldp guide you're referring to seems to be for 2.6 kernel. Whole lot of things have changed since then, so these guides often may not work with modern kernels
– Sergiy Kolodyazhnyy
Jan 21 at 0:36
@SergiyKolodyazhnyy Do you have some other guide that I could use?
– Parth K
Jan 21 at 1:45
|
show 2 more comments
1
Hmm... that's odd - it appears to work for me, with the exact same kernel and GCC 7.3.0-27ubuntu1~18.04. Can you provide a more complete transcription of themake
command output?
– steeldriver
Jan 20 at 17:16
3
The only way I can reproduce this error is to do something likemake EXTRA_CFLAGS=-fpic
- do you perhaps have such a variable defined somewhere in your environment (perhaps look atenv | grep FLAGS
)?
– steeldriver
Jan 20 at 17:44
Perhaps this could be useful: askubuntu.com/q/1083091/295286 In my specific case, makefile had to useshell pwd
instead ofPWD
.
– Sergiy Kolodyazhnyy
Jan 21 at 0:34
By the way tldp guide you're referring to seems to be for 2.6 kernel. Whole lot of things have changed since then, so these guides often may not work with modern kernels
– Sergiy Kolodyazhnyy
Jan 21 at 0:36
@SergiyKolodyazhnyy Do you have some other guide that I could use?
– Parth K
Jan 21 at 1:45
1
1
Hmm... that's odd - it appears to work for me, with the exact same kernel and GCC 7.3.0-27ubuntu1~18.04. Can you provide a more complete transcription of the
make
command output?– steeldriver
Jan 20 at 17:16
Hmm... that's odd - it appears to work for me, with the exact same kernel and GCC 7.3.0-27ubuntu1~18.04. Can you provide a more complete transcription of the
make
command output?– steeldriver
Jan 20 at 17:16
3
3
The only way I can reproduce this error is to do something like
make EXTRA_CFLAGS=-fpic
- do you perhaps have such a variable defined somewhere in your environment (perhaps look at env | grep FLAGS
)?– steeldriver
Jan 20 at 17:44
The only way I can reproduce this error is to do something like
make EXTRA_CFLAGS=-fpic
- do you perhaps have such a variable defined somewhere in your environment (perhaps look at env | grep FLAGS
)?– steeldriver
Jan 20 at 17:44
Perhaps this could be useful: askubuntu.com/q/1083091/295286 In my specific case, makefile had to use
shell pwd
instead of PWD
.– Sergiy Kolodyazhnyy
Jan 21 at 0:34
Perhaps this could be useful: askubuntu.com/q/1083091/295286 In my specific case, makefile had to use
shell pwd
instead of PWD
.– Sergiy Kolodyazhnyy
Jan 21 at 0:34
By the way tldp guide you're referring to seems to be for 2.6 kernel. Whole lot of things have changed since then, so these guides often may not work with modern kernels
– Sergiy Kolodyazhnyy
Jan 21 at 0:36
By the way tldp guide you're referring to seems to be for 2.6 kernel. Whole lot of things have changed since then, so these guides often may not work with modern kernels
– Sergiy Kolodyazhnyy
Jan 21 at 0:36
@SergiyKolodyazhnyy Do you have some other guide that I could use?
– Parth K
Jan 21 at 1:45
@SergiyKolodyazhnyy Do you have some other guide that I could use?
– Parth K
Jan 21 at 1:45
|
show 2 more comments
0
active
oldest
votes
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Parth K is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1111417%2funable-to-build-simple-hello-world-kernel-module%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Parth K is a new contributor. Be nice, and check out our Code of Conduct.
Parth K is a new contributor. Be nice, and check out our Code of Conduct.
Parth K is a new contributor. Be nice, and check out our Code of Conduct.
Parth K is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1111417%2funable-to-build-simple-hello-world-kernel-module%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Hmm... that's odd - it appears to work for me, with the exact same kernel and GCC 7.3.0-27ubuntu1~18.04. Can you provide a more complete transcription of the
make
command output?– steeldriver
Jan 20 at 17:16
3
The only way I can reproduce this error is to do something like
make EXTRA_CFLAGS=-fpic
- do you perhaps have such a variable defined somewhere in your environment (perhaps look atenv | grep FLAGS
)?– steeldriver
Jan 20 at 17:44
Perhaps this could be useful: askubuntu.com/q/1083091/295286 In my specific case, makefile had to use
shell pwd
instead ofPWD
.– Sergiy Kolodyazhnyy
Jan 21 at 0:34
By the way tldp guide you're referring to seems to be for 2.6 kernel. Whole lot of things have changed since then, so these guides often may not work with modern kernels
– Sergiy Kolodyazhnyy
Jan 21 at 0:36
@SergiyKolodyazhnyy Do you have some other guide that I could use?
– Parth K
Jan 21 at 1:45