LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-25-2011, 06:04 AM   #1
sant_dcg
LQ Newbie
 
Registered: Nov 2010
Location: Bangalore
Posts: 4

Rep: Reputation: 0
How to get kernel version from an image file


Hi,

I know that it is possible to get the kernel version from a running system using "uname" command.
I have a kernel image file in linux/arch/arm/boot/uImage.
Is it possible to get similar information from this image file? and how?
 
Old 03-25-2011, 07:38 AM   #2
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 332Reputation: 332Reputation: 332Reputation: 332
I'm not sure if it will work on an ARM image, but the file command works on x86/x86_64:

Code:
$ file vmlinuz
 
vmlinuz: Linux kernel x86 boot executable bzImage, version 2.6.38.1-6.fc15.x86_64 (mockbui, RO-rootFS, root_dev 0x902, swap_dev 0x3, Normal VGA
 
1 members found this post helpful.
Old 03-25-2011, 08:02 AM   #3
sant_dcg
LQ Newbie
 
Registered: Nov 2010
Location: Bangalore
Posts: 4

Original Poster
Rep: Reputation: 0
@macemoneta: Thank you for the response. I tried this command, but it does not work as I expected.
I tried
$file uImage
$uImage: u-boot/PPCBoot image
What I expect is something like below:
$ uname -a
$ Linux 2.6.33.5-ptx-trunk #1 PREEMPT Wed Mar 16 14:40:18 CET 2011 armv5tejl GNU/Linux

This info is available in the image file, but I don't know how to extract it.
 
Old 03-25-2011, 08:47 AM   #4
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 332Reputation: 332Reputation: 332Reputation: 332
You need to update the '/etc/magic' or '/usr/share/misc/magic' (whichever exists on your system) with the displacements for the information. See man 5 magic. Once that's updated, the file command will be able to pull the information automatically.

Update: Google says you need:

Code:
# u-boot/PPCBoot image file
# From: Mark Brown <broonie@sirena.org.uk>
0	belong	0x27051956	u-boot/PPCBoot image
>4	string  PPCBoot
>>12	string  x		version %s

Last edited by macemoneta; 03-25-2011 at 08:55 AM.
 
Old 08-05-2011, 07:12 AM   #5
temp_sny
LQ Newbie
 
Registered: Aug 2011
Posts: 1

Rep: Reputation: Disabled
mkimage -l <uimage-name>
can tell u the kernel version
 
Old 08-05-2011, 02:48 PM   #6
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,396
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
If the kernel image is compressed, you might be able to de-compress it first (but, as I recall, this is not as straightforward as you might expect). Otherwise, the strings command will find any strings of human-readable text in files of any description. It should be too hard to isolate the one that you're looking for.

--- rod.
 
Old 08-05-2011, 05:25 PM   #7
jefro
Moderator
 
Registered: Mar 2008
Posts: 15,374

Rep: Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198
Check crc against other kernels if worse comes to worse.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Any idea what file system(s) the kernel image is formatted in? Kenny_Strawn Linux - Kernel 7 09-13-2010 06:19 AM
file type for the Linux kernel image file, (vmlinuz) is unknown james2b Linux - Software 6 11-12-2009 03:39 PM
Redboot - Loading Kernel Image & File Jffs2 MKSrivastava Debian 1 04-21-2007 08:03 PM
how to combine kernel and ramdisk to a single image file KitKat08 Linux - Distributions 1 02-09-2006 06:18 PM
linking the kernel and the ramdisk to a single image file. KitKat08 Red Hat 1 02-09-2006 09:59 AM


All times are GMT -5. The time now is 02:34 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration