Building Embedded Linux Systems by Karim Yaghmour & Jon Masters & Gilad Ben-Yossef & Philippe Gerum
Author:Karim Yaghmour & Jon Masters & Gilad Ben-Yossef & Philippe Gerum [Karim Yaghmour]
Language: eng
Format: epub
Tags: COMPUTERS / Operating Systems / Linux
ISBN: 9780596159085
Publisher: O'Reilly Media
Published: 2009-02-08T16:00:00+00:00
Writing and reading
Whereas flash filesystems such as JFFS2 take advantage of their capability to continue clearing bits to 0 in an erase block to allow transparent read and write access, you cannot usually use user-level tools to write to an MTD device more than once. This is mostly because the tools usually will want to replace an image wholesale, and thus would want to set some bits from 0 to 1, which is not possible with erasing. If you want to update the content of an MTD device or partition using its raw char /dev entry, for example, you generally must erase this device or partition before you can write new data to it.
Although writing to a raw flash device can be done using traditional filesystem commands such as cat and dd, it is better to use the MTD utilities—flashcp for NOR flash and nandwrite for NAND—because they are more suited to the task. The flashcp command will erase flash before writing, and will read back the contents afterward to verify correct programming. The nandwrite command will detect bad blocks on a NAND flash device, and skip over them as appropriate. To write a new initial RAM disk image to the “initrd” partition on my control module, for example, I use the following command:
# flashcp /tmp/initrd.bin /dev/mtd3
In this case, my target’s root filesystem is mounted via NFS, and I am running the MTD commands on my target.
Reading from a CFI MTD partition is no different from reading from any other device. The following command on my control module, for instance, will copy the binary image of the bootloader partition to a file:
# dd if=/dev/mtd0 of=/tmp/ppcboot.img
Since the bootloader image itself may not fill the entire partition, the ppcboot.img file may contain some extra unrelated data in addition to the bootloader image.
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Test-Driven iOS Development with Swift 4 by Dominik Hauser(7768)
Filmora Efficient Editing by Alexander Zacharias(5805)
The Infinite Retina by Robert Scoble Irena Cronin(5284)
Learn Wireshark - Fundamentals of Wireshark. by Lisa Bock(3987)
Linux Device Driver Development Cookbook by Rodolfo Giometti(3935)
Edit Like a Pro with iMovie by Regit(3438)
Linux Administration Best Practices by Scott Alan Miller(2858)
Linux Command Line and Shell Scripting Techniques by Vedran Dakic & Jasmin Redzepagic(2837)
MCSA Windows Server 2016 Study Guide: Exam 70-740 by William Panek(2522)
Mastering PowerShell Scripting - Fourth Edition by Chris Dent(2409)
Docker on Windows by Stoneman Elton(2319)
Kali Linux - An Ethical Hacker's Cookbook: End-to-end penetration testing solutions by Sharma Himanshu(2315)
Creative Projects for Rust Programmers by Carlo Milanesi(2262)
Hands-On AWS Penetration Testing with Kali Linux by Karl Gilbert(2110)
Hands-On Linux for Architects by Denis Salamanca(2053)
Programming in C (4th Edition) (Developer's Library) by Stephen G. Kochan(2006)
Computers For Seniors For Dummies by Nancy C. Muir(2003)
The Old New Thing by Raymond Chen(1941)
Linux Kernel Debugging by Kaiwan N Billimoria(1762)
