Quantcast

Flashing kernel and rfs from usb.

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Flashing kernel and rfs from usb.

rogecol
Has anyone been successful in flashing the kernel and root file system to NAND by using USB?
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Flashing kernel and rfs from usb.

Pettinato, Jim
Yes I have sourced the new images from USB successfully, though there seems to be not much benefit. You can't boot from USB, and things tend to go awry if you try to flash your fs to nand while running from nand, so you are best off booting from either an SD card or an NFS share to flash your fs - so why not just place your target NAND images on the boot media, and flash from there?

Note: As a timesaver, when testing kernel mods, you CAN safely update MLO, u-boot and kernel in flash (mtd0-3) from Linux while running out of NAND as those aren't accessed (normally) once the kernel is loaded. I often do this, it is easy to transfer a new kernel image to the target Linux file system via ftp or ssh, then run a script to write it to mtd3, then reboot.

-----Original Message-----
From: rogecol [mailto:[hidden email]]
Sent: Wednesday, August 28, 2013 10:13 AM
To: [hidden email]
Subject: [Gumstix-users] Flashing kernel and rfs from usb.

Has anyone been successful in flashing the kernel and root file system to NAND by using USB?



--
View this message in context: http://gumstix.8.x6.nabble.com/Flashing-kernel-and-rfs-from-usb-tp4967824.html
Sent from the Gumstix mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies and advance your career. Get an incredible 1,500+ hours of step-by-step tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk
_______________________________________________
gumstix-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gumstix-users

------------------------------------------------------------------------------
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk
_______________________________________________
gumstix-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gumstix-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Flashing kernel and rfs from usb.

rogecol
Thanks for the response!

We are exploring field upgrade capability and the USB is the only thing exposed without dismantling the hardware.

I was wondering if UBoot could detect and mount a USB key and write the kernel and root files system to the NAND.
During field upgrade, the root file system and the kernel would be stored on the USB. MLO and UBoot would not be changed.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Flashing kernel and rfs from usb.

Peter A. Bigot
On 08/28/2013 02:17 PM, rogecol wrote:
> Thanks for the response!
>
> We are exploring field upgrade capability and the USB is the only thing
> exposed without dismantling the hardware.
>
> I was wondering if UBoot could detect and mount a USB key and write the
> kernel and root files system to the NAND.
> During field upgrade, the root file system and the kernel would be stored on
> the USB. MLO and UBoot would not be changed.

Shouldn't be too hard: doc/README.usb in the u-boot sources shows
various supported capabilities including flash drives.  You'd have to
build u-boot with the USB commands enabled, and modify its autostart
sequence to scan for presence of the upgrade drive.

Peter


------------------------------------------------------------------------------
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk
_______________________________________________
gumstix-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gumstix-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Flashing kernel and rfs from usb.

Frank Agius
In reply to this post by rogecol
On 8/28/2013 10:12 AM, rogecol wrote:
> Has anyone been successful in flashing the kernel and root file system to
> NAND by using USB?

Haven't updated NAND, but I have updated the kernel and root file system
on the MMC from a USB memory stick.  From Linux, the inserted memory
stick is auto mounted and then scanned for the update script.  The first
phase of the update script replaces the kernel with a new kernel with an
initramfs.  The boot parameters are modified to start this kernel.  The
system is rebooted and starts with a minimal file system running in RAM.
  The second phase of the update is then run.  In this phase the MMC
card is formatted and partitioned.  This may sound drastic, but it can
fix file system errors and corruptions.  The normal kernel and boot
parameters are restored to the first partition on the MMC.  The
filesystem is then restored to the second partition.  The system is then
rebooted.

In a similar fashion, NAND instead of the MMC could be updated in the
second phase of this scheme.

frank








------------------------------------------------------------------------------
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk
_______________________________________________
gumstix-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gumstix-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Flashing kernel and rfs from usb.

Patrick Maheral
On 29/08/13 09:05 AM, Frank Agius wrote:

> On 8/28/2013 10:12 AM, rogecol wrote:
>> Has anyone been successful in flashing the kernel and root file system to
>> NAND by using USB?
>
> Haven't updated NAND, but I have updated the kernel and root file system
> on the MMC from a USB memory stick.  From Linux, the inserted memory
> stick is auto mounted and then scanned for the update script.  The first
> phase of the update script replaces the kernel with a new kernel with an
> initramfs.  The boot parameters are modified to start this kernel.  The
> system is rebooted and starts with a minimal file system running in RAM.
>   The second phase of the update is then run.  In this phase the MMC
> card is formatted and partitioned.  This may sound drastic, but it can
> fix file system errors and corruptions.  The normal kernel and boot
> parameters are restored to the first partition on the MMC.  The
> filesystem is then restored to the second partition.  The system is then
> rebooted.
>
> In a similar fashion, NAND instead of the MMC could be updated in the
> second phase of this scheme.
>
> frank

I've done something similar to update NAND from a USB flash stick.  The
stick contained a root file system image, and I used pivot_root to
switch from the onboard NAND root fs to the USB flash root fs image.
Once the root fs was "pivoted" out of the way, I used mount with the
--move option to move the mount points (e.g. /tmp, /sys, /proc, /dev,
etc.) to the USB root fs.  Then, the NAND can be wiped and updated.  My
scripts are a too bit ugly to share here, but here is a brief outline of
the scripts:


- take down network interfaces and stop all services
- mount file system image from USB:
   mount -o loop /mnt/sdc/fs.img /mnt/newroot)
- unmount anything you don't need
- pivot root file systems:
   cd /mnt/newroot
   pivot_root . mnt/oldroot
- move all mount points you need to new root:
   mount --move /mnt/oldroot/proc /proc
   ...
- restart init so it "releases" its hold on the old root fs
   telinit u
- restart dbus and syslog
- kill anything that is still "holding on to" the old root fs
   killall getty # they will be restarted by init
   ...
- bring network and up any services you'd like (eg. ssh)
- run install script in background and exit.  This is necessary because
this script is still holding on to the old root fs.
   someInstallScript.sh &
   exit 0

Then, in the install script, kill any remaining processes that are still
using the old root fs and umount the old root.  Now, you can reformat
the NAND fs to your hearts content.

Hope this helps.
Patrick




------------------------------------------------------------------------------
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk
_______________________________________________
gumstix-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gumstix-users
Loading...