LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Warnings during Kernel Compilation (https://www.linuxquestions.org/questions/linux-newbie-8/warnings-during-kernel-compilation-732709/)

vasmakk 06-13-2009 11:33 AM

Warnings during Kernel Compilation
 
Hi there !

Every time I compile a new kernel (from source) under ubuntu 9.04, I get a series of annoying warnings like:

scripts/mod/modpost.c: In function ‘get_markers’:
scripts/mod/modpost.c:1542: warning: ignoring return value of ‘asprintf’, declared with attribute warn_unused_result
scripts/mod/modpost.c: In function ‘add_marker’:
scripts/mod/modpost.c:1962: warning: ignoring return value of ‘asprintf’, declared with attribute warn_unused_result
scripts/kallsyms.c: In function ‘read_symbol’:
scripts/kallsyms.c:74: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result
init/main.c: In function ‘start_kernel’:
init/main.c:571: warning: format not a string literal and no format arguments
init/initramfs.c: In function ‘populate_rootfs’:
init/initramfs.c:581: warning: format not a string literal and no format arguments
arch/x86/kernel/dumpstack_64.c: In function ‘print_trace_warning_symbol’:
arch/x86/kernel/dumpstack_64.c:254: warning: format not a string literal and no format arguments
arch/x86/kernel/dumpstack_64.c: In function ‘print_trace_address’:
arch/x86/kernel/dumpstack_64.c:276: warning: format not a string literal and no format arguments
...

I guess this is normal, since my compiled kernel, after installation works fine!

I found a way to get rid of this warnings by redirecting the standard error e.g 2> /dev/null or 2> some_file. But both these ways have the disadvantage that I can't tell which one of those warnings might be critical...
Are there any "flags" to use with make-kpkg in order to output only the critical warnings, and not all of this ?

P.S. When I compile the same source under Debian Lenny, none of these warnings appear. Why?


Regards
Vas

jamescondron 06-13-2009 11:39 AM

Kernel version? Where did you get the sources? Strictly speaking, these are just indicative of poor programming, or a minor issue.

Make sure you're using the correct kernel and uptodate code

vasmakk 06-13-2009 12:25 PM

Quote:

Originally Posted by jamescondron (Post 3572779)
Kernel version? Where did you get the sources? Strictly speaking, these are just indicative of poor programming, or a minor issue.

Make sure you're using the correct kernel and uptodate code

Hi james!

I got the sources from http://www.kernel.org
kernel version 2.6.28.10 This is the last one of the 2.6.28 series right ?

file: linux-2.6.28.10.tar.bz2

It is the official, trust me.
This is the exact location of the source...
ftp://ftp.kernel.org/pub/linux/kernel/v2.6/

Maybe in low-level programming with so many independent modules such warnings are possible ...

Look at this (over-simplified) example to see what I mean..

int foo(int x) {

int result;

if(x==0) result= 15;
if(x==1) result=-15;

return result;
}

Let x represents e.g an event!

the programmer knows in advance that x variable can take only two possible values, 0 and 1 but the compiler doesn't. Because variable result is not initialized in function foo() the compiler might complain. But the code (from the programers perspective) is correct!

The question is how to avoid getting all these messy warnings, and project only the serious ones (if they ever occured)?

Vas

jamescondron 06-13-2009 12:34 PM

Try 26.6.30; When I built that yesterday no errors occurred. And yes, I am well aware of what the warnings are saying, but kernel code is usually clean as... well... kernel code really; you should have no compilation warnings in kernel code.

That being said, take a look at the patch between kernel versions for
arch/x86/kernel/dumpstack_64.c
Not exactly brilliant code there.( http://www.linuxhq.com/kernel/v2.6/2...dumpstack_64.c )

But yes, try the upto date kernel

vasmakk 06-13-2009 01:01 PM

Quote:

Originally Posted by jamescondron (Post 3572811)
Try 26.6.30; When I built that yesterday no errors occurred. And yes, I am well aware of what the warnings are saying, but kernel code is usually clean as... well... kernel code really; you should have no compilation warnings in kernel code...

Yes, that is what I think too ...
Thanks my friend! I'll try 26.6.30 (you mean 2.6.30 ?)

P.S. I've noticed you are using Debian Lenny right ? In Debian the compilation is clean and crystal clear... It is in ubuntu 9.04 where I get all these warnings


Regards
Vas

jamescondron 06-13-2009 01:05 PM

Well, remember all those hoops you had to jump through to even be able to get to building a kernel in ubuntu? Thats because ubuntu don't really want you to compile your own; so this could be related.

Of course, I'm guessing here ;)

vasmakk 06-13-2009 01:13 PM

Quote:

Originally Posted by jamescondron (Post 3572833)
Well, remember all those hoops you had to jump through to even be able to get to building a kernel in ubuntu? Thats because ubuntu don't really want you to compile your own; so this could be related.

Of course, I'm guessing here ;)

Actually I'm new to Linux and certainly I've missed episodes!

I am basically a Debian fun... But now with ubuntu 9.04 I thought I could try my luck at this distro also... I saw some interesting characteristics and impressed:). But why this should be so different? After all It is based on Debian

P.S. Ubuntu learned me how to compile a kernel... After the first installation the original kernel were droping me into ramdisk. I had to type > modprobe usb_storage and >exit every time to proceed ... ha, ha


Vas

jamescondron 06-13-2009 01:21 PM

Because of the target audience; Ubuntu is, almost completely by philosophy, designed for new users, or users with little or no technical experience. This in mind, they package kernels up for the end user so they wont have to worry about kernel compilation.

This why to compile a kernel on Ubuntu you can't just jump into /usr/src and have a go, you have to install all the development tools first, then set up the environment, then compile everything from scratch.

vasmakk 06-13-2009 02:05 PM

Quote:

Originally Posted by jamescondron (Post 3572847)
Because of the target audience; Ubuntu is, almost completely by philosophy, designed for new users, or users with little or no technical experience. This in mind, they package kernels up for the end user so they wont have to worry about kernel compilation.

This why to compile a kernel on Ubuntu you can't just jump into /usr/src and have a go, you have to install all the development tools first, then set up the environment, then compile everything from scratch.

Yes I know... I followed the instructions of this
http://www.howtoforge.com/kernel_compilation_ubuntu
as well as many similar tutorials (even the traditional way!) before I proceed...

Actually the only change I made to the original .config file was the support of build in usb-storage (USB_STORAGE=y) and build in vesa support (FB_VESA=y). to avoid the problem I pre mentioned, and because I want a system independent of Graphics Cards (portable) ...

Vas


All times are GMT -5. The time now is 01:15 AM.