LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 02-09-2011, 09:08 PM   #1
archieval
Member
 
Registered: Apr 2007
Location: Philippines
Distribution: Kubuntu, Ubuntu, CentOS
Posts: 289

Rep: Reputation: 41
How to change linux kernel image while device is running?


Hello everyone,

I have a device which run linux kernel, i want to update the kernel image while it is running, so that the next time it reboots the new kernel image. I thought of using dd (inside the device while running), but I do not know the possible arguments. The sector map for the device is here.
http://dev.odroid.com/projects/odroid-t/#s-3
Any suggestion is welcome. Thanks!

Regards,
archieval
 
Old 02-09-2011, 11:27 PM   #2
indienick
Senior Member
 
Registered: Dec 2005
Location: London, ON, Canada
Distribution: Arch, Ubuntu, Slackware, OpenBSD, FreeBSD
Posts: 1,853

Rep: Reputation: 65
I highly suggest you read the man-page for dd(1).
Code:
$ man 1 dd
 
Old 02-10-2011, 01:07 AM   #3
archieval
Member
 
Registered: Apr 2007
Location: Philippines
Distribution: Kubuntu, Ubuntu, CentOS
Posts: 289

Original Poster
Rep: Reputation: 41
Ah sorry about that, I know how dd works, I mean I do not know the actual device file that I will overwrite. But I have found the solution already.
 
Old 02-10-2011, 01:10 AM   #4
indienick
Senior Member
 
Registered: Dec 2005
Location: London, ON, Canada
Distribution: Arch, Ubuntu, Slackware, OpenBSD, FreeBSD
Posts: 1,853

Rep: Reputation: 65
I'm glad to hear you found a solution. Might I suggest posting your solution here so people who stumble across this post, with a similar issue, can see how you did it?
 
Old 02-10-2011, 01:28 AM   #5
archieval
Member
 
Registered: Apr 2007
Location: Philippines
Distribution: Kubuntu, Ubuntu, CentOS
Posts: 289

Original Poster
Rep: Reputation: 41
I was supposed to use the values of the sector in the link I provided there for ODROID-T, but the value is wrong. I found out during bootup the actual sector:

Code:
reading kernel.. 1081, 8192 
MMC read: dev # 0, block # 1081, count 8192 ...8192 blocks read: OK
completed
reading RFS.. 9273, 6144 
MMC read: dev # 0, block # 9273, count 6144 ...6144 blocks read: OK
completed
Boot with zImage
I used 1081 here:

I just got lucky with the output device file:

Code:
# mount
rootfs / rootfs rw 0 0
tmpfs /dev tmpfs rw,relatime,mode=755 0 0
devpts /dev/pts devpts rw,relatime,mode=600 0 0
proc /proc proc rw,relatime 0 0
sysfs /sys sysfs rw,relatime 0 0
tmpfs /mnt/asec tmpfs rw,relatime,mode=755,gid=1000 0 0
none /dev/cpuctl cgroup rw,relatime,cpu 0 0
/dev/block/mmcblk0p1 /system ext4 rw,noatime,nodiratime,barrier=1,data=writeback 0 0
/dev/block/mmcblk0p2 /data ext4 rw,noatime,nodiratime,barrier=1,data=writeback 0 0
I know the 2 mmc block partitions are not to be used:

Code:
# fdisk /dev/block/mmcblk0

The number of cylinders for this disk is set to 61440.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): p

Disk /dev/block/mmcblk0: 2013 MB, 2013265920 bytes
4 heads, 16 sectors/track, 61440 cylinders
Units = cylinders of 64 * 512 = 32768 bytes

              Device Boot      Start         End      Blocks  Id System
/dev/block/mmcblk0p1             532        8805      264740  83 Linux
Partition 1 does not end on cylinder boundary
/dev/block/mmcblk0p2            8805       60032     1639265  83 Linux
Partition 2 does not end on cylinder boundary
I noticed that the start of mmcblk0p1 does not start on 0, so below that could be the location of uboot, kernel, and ramdisk. So I tried that, along with the 1081 above.

using mmcblk0 only (the unpartitioned location)

Code:
# dd if=/root/zImage of=/dev/block/mmcblk0 bs=512 seek=1081
and it works! =)

Regards,
archieval
 
  


Reply



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
Running kernel.org "mainline" Linux on Xen: FAILED to find root device bojanap Linux - Kernel 1 09-17-2010 11:42 PM
Running application in kernel mode as device driver! hank007 Linux - Newbie 1 05-29-2009 07:21 AM
Will rfs change when kernel image is built(for a target board) LN85 Linux - Kernel 3 07-04-2007 03:34 PM
difference netween linux-image and kernel image? mariogarcia Linux - Software 2 06-19-2006 08:01 AM
Kernel-image renamed to linux-image? powadha Debian 2 08-02-2005 05:07 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 08:56 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
Open Source Consulting | Domain Registration