Skip to contentSkip to conversation

No subject

DISCUSSION Martynov Semen 2 participants 6 messages Apr 9, 2012 – Apr 10, 2012

lore
Share & tools
lore
#0 lore raw

Good afternoon,

I would like to understand, why I can't make the built-in object, when my code is in a folder /samples...

I have my module-code and if I put it in a folder /samples, I can receive only loadable module (.ko) but if I want to receive the built-in object - it turns out nothing (.?-file is created, but my code doesn't get in a kernel). When I allocate my module-code in any other folder (for example, /drivers) it works normally - I can receive .ko and I can make the built-in object.

Question - why I can't receive the built-in object when my code is in the folder /samples? What instruction in a make-file restricts it, and how?

P.S.: Sorry for my english.

Signature · 5 lines
Best regards,
Semen A Martynov.

Saint Petersburg, Russia.
https://www.facebook.com/semen.martynov
#1 lore raw

Hi Semen

Could you share a Makefile for your module?

Best wishes,
Vladimir Murzin

-----Original Message-----
From: Martynov Semen <[email protected]>
Sender: kernelnewbies-bounces at kernelnewbies.org
Date: Mon, 09 Apr 2012 23:56:15
To: kernelnewbies at kernelnewbies.org<[email protected]>
Subject: No subject

Good afternoon,

I would like to understand, why I can't make the built-in object, when my code is in a folder /samples...

I have my module-code and if I put it in a folder /samples, I can receive only loadable module (.ko) but if I want to receive the built-in object - it turns out nothing (.?-file is created, but my code doesn't get in a kernel). When I allocate my module-code in any other folder (for example, /drivers) it works normally - I can receive .ko and I can make the built-in object.

Question - why I can't receive the built-in object when my code is in the folder /samples? What instruction in a make-file restricts it, and how?

P.S.: Sorry for my english.

Signature · 10 lines
Best regards,
Semen A Martynov.

Saint Petersburg, Russia.
https://www.facebook.com/semen.martynov

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies at kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
#3 lore raw
In reply to Vladimir Murzin

<one more time in plain text>

Yes, of course.
It contains only one line:

obj-$(CONFIG_MY_PROCLISTOUTPUT) += proclistoutput.o

and works with Kconfig

config MY_PROCLISTOUTPUT
tristate "Display a list of processes"
default y
---help---
This module prints a list of processes

But I'm sure that the reason is not in my file, because:
- If I put my code in a folder /drivers (and include my Makefile and Kconfig) then everything works perfectly (I can build kernel object and I can built-in my code to the kernel)
- If I put my code in a folder /samples (and include my Makefile and Kconfig) then build-in the code I can't, but with .ko it works fine...

I suppose that the reason in the kernel Makefile. The root Makefile contains this code (http://lxr.free-electrons.com/source/Makefile#L914)

ifdef CONFIG_SAMPLES

         $(Q)$(MAKE) $(build)=samples

endif

where
$(Q) = @
$(build) = -f scripts/Makefile.build obj

and further I lose understanding of the events...

10.04.2012, 08:26, "Vladimir Murzin" <[email protected]>:

Quoted 34 lines

Hi Semen

Could you share a Makefile for your module?

Best wishes,
Vladimir Murzin

-----Original Message-----
From: Martynov Semen <[email protected]>
Sender: kernelnewbies-bounces at kernelnewbies.org
Date: Mon, 09 Apr 2012 23:56:15
To: kernelnewbies at kernelnewbies.org<[email protected]>
Subject: No subject

Good afternoon,

I would like to understand, why I can't make the built-in object, when my code is in a folder /samples...

I have my module-code and if I put it in a folder /samples, I can receive only loadable module (.ko) but if I want to receive the built-in object - it turns out nothing (.?-file is created, but my code doesn't get in a kernel). When I allocate my module-code in any other folder (for example, /drivers) it works normally - I can receive .ko and I can make the built-in object.

Question - why I can't receive the built-in object when my code is in the folder /samples? What instruction in a make-file restricts it, and how?

P.S.: Sorry for my english.
--
Best regards,
Semen A Martynov.

Saint Petersburg, Russia.
https://www.facebook.com/semen.martynov

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies at kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

Signature · 1 line
? ?? Facebook: http://www.facebook.com/profile.php?id=1095131825
#4 lore raw
Quoted 61 lines · Martynov Semen

<one more time in plain text>

Yes, of course.
It contains only one line:

obj-$(CONFIG_MY_PROCLISTOUTPUT) += proclistoutput.o

and works with Kconfig

config MY_PROCLISTOUTPUT
tristate "Display a list of processes"
default y
---help---
This module prints a list of processes

But I'm sure that the reason is not in my file, because:
- If I put my code in a folder /drivers (and include my Makefile and Kconfig) then everything works perfectly (I can build kernel object and I can built-in my code to the kernel)
- If I put my code in a folder /samples (and include my Makefile and Kconfig) then build-in the code I can't, but with .ko it works fine...

I suppose that the reason in the kernel Makefile. The root Makefile contains this code (http://lxr.free-electrons.com/source/Makefile#L914)

ifdef CONFIG_SAMPLES

         $(Q)$(MAKE) $(build)=samples

endif

where
$(Q) = @
$(build) = -f scripts/Makefile.build obj

and further I lose understanding of the events...

10.04.2012, 08:26, "Vladimir Murzin" <[email protected]>:

Quoted 27 lines

Hi Semen

Could you share a Makefile for your module?

Best wishes,
Vladimir Murzin

-----Original Message-----
From: Martynov Semen <[email protected]>
Sender: kernelnewbies-bounces at kernelnewbies.org
Date: Mon, 09 Apr 2012 23:56:15
To: kernelnewbies at kernelnewbies.org<[email protected]>
Subject: No subject

Good afternoon,

I would like to understand, why I can't make the built-in object, when my code is in a folder /samples...

I have my module-code and if I put it in a folder /samples, I can receive only loadable module (.ko) but if I want to receive the built-in object - it turns out nothing (.?-file is created, but my code doesn't get in a kernel). When I allocate my module-code in any other folder (for example, /drivers) it works normally - I can receive .ko and I can make the built-in object.

Question - why I can't receive the built-in object when my code is in the folder /samples? What instruction in a make-file restricts it, and how?

P.S.: Sorry for my english.
--
Best regards,
Semen A Martynov.

Quoted 11 lines
Quoted 7 lines

Saint Petersburg, Russia.
https://www.facebook.com/semen.martynov

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies at kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

Signature · 1 line
? ?? Facebook: http://www.facebook.com/profile.php?id=1095131825

Hi Semen

It happens because ./script isn't listed as a subdir for visiting and linking objects into vmlinux. Please, refer to [1] for details.

[1] http://lxr.linux.no/linux+*/Makefile#L508

Best wishes,
Vladimir Murzin

#5 lore raw

Yes, this is it! Thank you!

10.04.2012, 20:08, "Vladimir Murzin" <[email protected]>:

Quoted 81 lines · Martynov Semen
Quoted 63 lines

?<one more time in plain text>

?Yes, of course.
?It contains only one line:

?obj-$(CONFIG_MY_PROCLISTOUTPUT) += proclistoutput.o

?and works with Kconfig

?config MY_PROCLISTOUTPUT
?????tristate "Display a list of processes"
?????default y
?????---help---
??????This module prints a list of processes

?But I'm sure that the reason is not in my file, because:
?- If I put my code in a folder /drivers (and include my Makefile and Kconfig) then everything works perfectly (I can build kernel object and I can built-in my code to the kernel) ?- If I put my code in a folder /samples (and include my Makefile and Kconfig) then build-in the code I can't, but with .ko it works fine...

?I suppose that the reason in the kernel Makefile. The root Makefile contains this code (http://lxr.free-electrons.com/source/Makefile#L914)

?ifdef CONFIG_SAMPLES
??????????$(Q)$(MAKE) $(build)=samples
?endif

?where
?$(Q) = @
?$(build) = -f scripts/Makefile.build obj

?and further I lose understanding of the events...

?10.04.2012, 08:26, "Vladimir Murzin" <[email protected]>:

Quoted 30 lines

?Hi Semen

?Could you share a Makefile for your module?

?Best wishes,
?Vladimir Murzin

?-----Original Message-----
?From: Martynov Semen <[email protected]>
?Sender: kernelnewbies-bounces at kernelnewbies.org
?Date: Mon, 09 Apr 2012 23:56:15
?To: kernelnewbies at kernelnewbies.org<[email protected]> ?Subject: No subject

?Good afternoon,

?I would like to understand, why I can't make the built-in object, when my code is in a folder /samples...

?I have my module-code and if I put it in a folder /samples, I can receive only loadable module (.ko) but if I want to receive the built-in object - it turns out nothing (.?-file is created, but my code doesn't get in a kernel). When I allocate my module-code in any other folder (for example, /drivers) it works normally - I can receive .ko and I can make the built-in object.

?Question - why I can't receive the built-in object when my code is in the folder /samples? What instruction in a make-file restricts it, and how?

?P.S.: Sorry for my english.
?--
?Best regards,
?Semen A Martynov.

?Saint Petersburg, Russia.
?https://www.facebook.com/semen.martynov

Quoted 7 lines
Quoted 4 lines

?_______________________________________________ ?Kernelnewbies mailing list
?Kernelnewbies at kernelnewbies.org ?http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

?--

?? ?? Facebook: http://www.facebook.com/profile.php?id=1095131825

Hi Semen

It happens because ./script isn't listed as a subdir for visiting and linking objects into vmlinux. Please, refer to [1] for details.

[1] http://lxr.linux.no/linux+*/Makefile#L508

Best wishes,
Vladimir Murzin

Signature · 5 lines
Best regards,
Semen A Martynov.

Saint Petersburg, Russia.
https://www.facebook.com/semen.martynov