Create MTD tools for Host and Target

Source: Internet
Author: User

After reading O 'Reilly's Building Embeded Linux System Chapter 1 storage device operations, we can see the MTD utilities of the Target in the house, but according to the introduction of this document, problems occur during the compilation process, I need to add some steps. Below I will describe my compilation process.

I'm rolling moblin, cross-compiling environment using i586-linux, this is just to learn embedded operating systems, if it is really developed on moblin, should use the MIC2 tool provided by moblin.org.

I have a netbook, installed the moblin2 beta, on the above did not find mtd, I get ubutun-8.10-mid-lpia from the ubuntu website, it is said that there is moblin1, MID in moblin2 does not provide version, the open source code of moblin1 (supporting mid) cannot be found in the moblin community. I suspect that Intel no longer considers menlow and will not provide menlow versions, the target is locked on mooreston. I found mtd in ubutun8.10. I checked my netbook hard disk configuration, but I still don't know whether it is a solid hard disk. I said it was a previous use of solid hard disk, and then I used a general hard disk to reduce the cost.

It is relatively simple to create MTD On the host. You can simply refer to the document as shown in the following figure:

$ Git-clone git: // git.infradead.org/mtd-utils

$ Cd mtd-utils

$ Make // if a file appears during compilation, it may be because lzo is not installed, and libacl, lao, and zlib must be installed. If there are other problems, you may need to install the devel package, such as lzo-devel.

$ Make DESTDIR =$ {PREFIX} install


The following describes how to create an MTD tool on the host:


1. Compile zlib as a compression algorithm

Source code is obtained at http://www.gzip.org/zlib,

${PRJROOT}/build-tools/zlib-1.2.3

$ Cc = i586-linux-gcc ldshared = "i586-linux-ld-shared"./configure -- share

$ Make

$ Make prefix =$ {target_prefix} install

$ CP-d $ {target_prefix}/lib/libz. So * $ {prjroot}/rootfs/lib

I used to write ldshared errors during configuration. Only libzlib. A is generated and the *. So file is not generated.


2. Compiling lzo is also a compression algorithm.

Source code is obtained at http://www.oberhumer.com/opensource/lzo.

$ CD ${prjoot}/build-tools/lzo-2.03

$ Cc = i586-llinux-gcc./configure -- enable-shared

$ Make

$ Make prefix =$ {target_prefix} install

$ CP-d {target_prefix}/lib/liblzo2.so * $ {prjroot}/rootfs/lib

In this document, liblzo. So * needs to be corrected to liblzo2.so *


3. Obtain the header file ACL. h from the ACL.

In

After decompression, copy include/ACL. h to $ {target_prefix}/include/sys


4. Install e2fsprogs

This step does not exist. If e2fsprogs is not installed, an error will occur in mtd_utils compilation, as shown below:

I586-linux-gcc-I .. /include-I .. /ubi-utils/include-d_file_offset_bits = 64-O2-g-wall-wextra-wwrite-strings-wno-sign-compare-c-o/home/Wei/workspace/mywork /moblin/sysapps/MTD-utils/i586-linux/mkfs. ubifs/LPT. o lpt. c-g-WP,-MD,/home/Wei/workspace/mywork/moblin/sysapps/MTD-utils/i586-linux/mkfs. ubifs /. LPT. c. dep

In the file that contains from LPT. C: 23:

Mkfs. ubifs. h: 48: 23: Error: UUID/UUID. H: No file or directory

This is not just the copy header file, but also the library, so the entire compilation is required.

$ Git-clone git: // git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git

$./Configure -- Host = i586-linux -- enable-elf-shlibs -- With-CC = i586-linux-gcc-with-linker = i586-linux-ld -- prefix =$ {target_prefix}

$ Make

$ Make install


5. Install mtd_utils

Download the source code Git-clone git: // git.infradead.org/mtd-utils.git

To avoid LUBI missing during compilation, modify mkfs. ubifs/makefile, convert ldlibs_mkfs.ubifs =-LZ-llzo2-lm-luuid-l .. /ubi-utils/-LUBI revised to ldlibs_mkfs.ubifs =-LZ-llzo2-lm-luuid-l .. /$ (host)/ubi-utils/-LUBI

$ Make cross = i586-linux-host = i586-linux

$ Make cross = i586-linux-host = i586-linux destdir =$ {prjroot}/rootfs install

This will be loaded in/usr/sbin of the target directory system.




Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.