tiny4412 Learning (a) from the Zero Build Linux system (Burn write uboot, kernel into emmc+uboot boot kernel) "Turn"

Source: Internet
Author: User
Tags bz2

This article was reproduced from: http://blog.csdn.net/fengyuwuzu0519/article/details/74080109

Copyright NOTICE: This article for Bo Master original article, reprint please specify http://blog.csdn.net/fengyuwuzu0519.

Directory (?) [+]

    • Hardware platform: tiny4412
    • System: linux-3.5-20151029
    • File system: BUSYBOX-1.22.1.TAR.BZ2
    • Compiler: arm-linux-gcc-4.5.1

Objective:

Use Uboot to boot the Linux system and mount the root file system to build the Linux development environment.

Since the minitools provided by the friendly arm is not open source, it is uncomfortable to use. This article will record the Linux system build from zero using Uboot on tiny4412. As a result of just learning 2440, complete this process also encountered various, now summarized as follows. It is a reference to a number of blog to be implemented, specifically related to the time will give a link.

First, prepare the System file 1, install the cross-compilation tool chain

(1) Unzip the compiler source code

[CPP]View PlainCopyprint?
    1. Tar arm-linux-gcc-4.5.1-v6-vfp-20120301.tgz–c/

(2) The ARM-LINUX-GCC will be installed to the/opt/friendlyarm/toolschain/4.5.1 directory after execution.

(3) vi/etc/environment Modify path to:

[CPP]View PlainCopyprint?
    1. Path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/opt/friendlyarm/toolschain/ 4.5.1/bin "

(4) Reboot the kernel and execute arm-linux-gcc-v view version.

2. Compile the kernel

(1) Decompression

Extracting Linux Kernel source code

Tar xvzf linux-3.5-20151029.tgz

CD linux-3.5

(2) configuration

CP tiny4412_linux_defconfig. config

(3) Compiling

Make

Finally generate zimage in the Arch/arm/boot directory

3, the production of the root file system itself intends to use the CD-ROM file system, the results fastboot download, the file system always problems, so the use of home-made file system. Hooking up over the network, followed by specific instructions.

Reference: http://blog.csdn.NET/morixinguan/article/details/50677105

Compiling the configuration installation BusyBox

Download Source: https://busybox.net/

TAR-XVF busybox-1.22.1.tar.bz2

CD busybox-1.22.1

Makedefconfig//default configuration

Make Menuconfig

Busyboxsettings--->

[*] Build Busyboxas a static binary (no shared libs)

[] Build Sharedlibbusybox (NEW)
[*] Build with Large File support (for accessingfiles > 2 GB)
(arm-linux-) Cross Compilerprefix

Make-j4

Makeinstall Build: _install

Making a file system

mkdir filesystem
CD filesystem
Cp.. /busybox-1.22.1/_install/*. R
mkdir etc Dev opt sys tmp mnt LIB proc
mkdir ETC/INIT.D
Vim Etc/init.d/rcs
Add to
[CPP]View PlainCopyprint?
    1. Mount-t Ramfs None/dev
    2. Mount-t Sysfsnone/sys
    3. MOUNT-T proc None/proc
    4. Mount-t Tmpfs none/tmp
    5. /sbin/mdev-s
Save exit
Vim Etc/inittab
Add to
[CPP]View PlainCopy print?
    1. :: Sysinit:/etc/init.d/rcs
    2. Ttysac0::askfirst:-/bin/sh
Save exit
Vim Etc/profile
Add to
[CPP]View PlainCopyprint?
    1. Export ps1="[root @ cjy \w] #"
Save exit
Mknod dev/console C 5 1
cp/opt/friendlyarm/toolschain/4.5.1/arm-none-linux-gnueabi/lib/*./lib-r
Cd..
Permissions: chmod 777 Filesystem-r
Publish File System
Vim/etc/exports
Add to
/work/nfs/filesystem * (Rw,sync,no_root_squash)

Save exit
Check if the file system has been published
SHOWMOUNT-E 192.168.1.123
Now the network file system and can be shared, the next will be connected to the single Board network cable, and then set Uboot parameters, single board IP, and NFS parameters.

4. Compiling uboot

The CD-ROM comes with a uboot that cannot be used directly and will only print OK when power is on. However, the official forum can be downloaded to 1506 uboot that can be used, links are as follows: Http://www.arm9home.net/read.php?tid-80810.html. You can also use the uboot:http://blog.csdn.net/lizuobin2/article/details/52825033 provided by this blog body

After downloading the configuration, compiling can produce uboot.

I use the uboot download link: http://download.csdn.net/detail/fengyuwuzu0519/9886366

[CPP]View PlainCopyprint?
    1. Tar xzf uboot_tiny4412-20130729.tgz
    2. CD uboot_tiny4412
    3. Make Tiny4412_config
    4. Make

Compiling the tools for generating BL2

[CPP]View PlainCopyprint?
    1. CD sd_fuse;
    2. Make

Assuming that the SD card has been recognized as/DEV/SDC by PC Linux, run the following command with the root user:

[CPP]View PlainCopyprint?
    1. CD sd_fuse/tiny4412
    2. ./SD_FUSING.SH/DEV/SDC

We're ready for this.

(1) kernel

(2) file system

(3) Uboot

The next step is how to download and start the kernel, hooking up the file system.

Second, download the system files, and start the kernel. 2.1. Download Uboot to eMMC

Reference:

Http://www.cnblogs.com/pengdonglin137/articles/4161084.html

Http://www.arm9home.net/read.php?tid-83474.html

(1) We have downloaded Uboot to SD card and now start Uboot from SD card, we can see the following information:

(2) View the partition table information for the device

Fdisk-p 0

Fdisk-p 1

Device MMC1 partition information, that is, EMMC analysis, note that this is the Superboot partition information, we use this partition.

Partition 1 is the FAE partition, partition 2 is for system, Partition 3 is User-data, Partition 4 is cache.

(3) Formatting eMMC

Enter the following instruction in U-boot mode to format the EMMC device.
#uboot: Fdisk-c 1 320 2057 520
The partition information is returned after execution, and the format session partition is resumed 1,2,3,4
#uboot: Fatformat MMC 1:1
This means that the first partition format for MMC 1 devices is formatted as FAT.
#uboot: Ext3format MMC 1:2
#uboot: Ext3format MMC 1:3
#uboot: Ext3format MMC 1:4
The above three instructions are EMMC partition 2,3,4 for the ext3 format respectively.
Here we have completed the formatting of the EMMC device.

(4) If you are prompted with the following error:

Error:no MBR is found at Sd/mmc.
Hint:use fdisk command to make partitions.
The instruction "Fdisk-c 0" is executed first, and the following procedure is performed:
#fdisk-C 0
FDISK is completed

After initializing the EMMC, we started using DNW to download Uboot to eMMC. Now we need to install the Linux DNW tool, note that DNW is downloaded to memory, the firmware data is cached, and then burned into the eMMC.

(5) Linux under DNW tool installation:

The main references are:

Http://blog.sina.com.cn/s/blog_69dd1a09010196bf.html

http://blog.csdn.net/u011452544/article/details/39393857

http://blog.csdn.net/morixinguan/article/details/70478650

1. Unzip the file first:
# tar XVF dnw_for_linux.tar.gz
Another: In Ubuntu right-click Decompression is also very convenient

The directory is as follows:
dnw_linux/
dnw_linux/secbulk/
Dnw_linux/secbulk/makefile
Dnw_linux/secbulk/secbulk.c
dnw_linux/dnw/
Dnw_linux/dnw/dnw.c
Where SECBULK.C is the PC-side USB driver, DNW.C is the Write tool

2 Compiling and loading the SECBULK.C kernel module

$CD Secbulk
$make-C/lib/modules/' uname-r '/build m= ' pwd ' modules
After the compilation is successful, you can see the Secbulk.ko in the current directory

3. After the compilation is complete, the Secbulk.ko file is generated:
# ls
Makefile module.symvers Secbulk.ko SECBULK.MOD.O
Modules.order secbulk.c SECBULK.MOD.C SECBULK.O

4. Load the module to the Linux kernel:
# sudo insmod./secbulk.ko (note to root)
# DMESG (see if loading succeeded)
Secbulk:secbulk Loaded

Usbcore:registered New Interface Driversecbulk (see these two lines to illustrate success)

The. ko file is not loaded automatically when booting, so it is loaded before it can be used, and then added to the boot script.
Make it automatically loaded, edit/etc/init.d/rc.local at the end plus Insmod/location/secbulk.ko.

5. Start compiling the DNW tool below
# CD: /dnw
# Gcc-o DNW dnw.c

(You will see the DNW executable when the compilation is complete.)

6. Copy the file to the/usr/local/bin directory
# sudo CP dnw/usr/local/bin
This allows you to use the DNW command directly under the shell.

But the problem arises, and when I use this dnw to download Bl2.bin, a checksum error occurs. But download other files are no problem, so all kinds of online search DNW tools, see installation, finally through and another version of the DNW combination, solve the problem, Uboot also complete download to the EMMC. Download Link: http://download.csdn.net/detail/fengyuwuzu0519/9886362.

(6) Dnw Download OK, we can download Uboot to eMMC.

#uboot: eMMC Open 1
Tip: EMMC OPEN success.!!

The above hint eMMC open success, note that, eMMC once open, need to burn continuously, burn can close after completion eMMC

#uboot: DNW
Tip: OTG Cable connected!

Now, waiting FORDNW to transmit data (waiting for DNW download)

Open the virtual machine and go to the directory where uboot

cd/work/uboot_tiny4412

DNW Sd_fuse/tiny4412/e4412_n.bl1.bin

At this time the U-boot interrupt will prompt the delivery of the verification completed, at this time, the Bl1.bin via USB to the Memeory 0xc0000000 start address, size 8KB.

Next we burn bl1.bin to eMMC, U-boot continue to enter:
#uboot: MMC write 1 0xc0000000 0 0x10
Will be prompted to write a message stating that the write was successful. This is to download the Bl1.bin firmware downloaded from the PC side via DNW to eMMC, starting with 0, 16 blocks, a block is 512B, 16*512=8*1024=8kb. This is the storage location of the Bl1.bin.
And so on, burn bl2.bin. U-boot.bin, Tzsw.bin

#uboot: DNW

#虚拟机: DNW Sd_fuse/tiny4412/bl2.bin

#uboot: MMC write 1 0xc0000000 0x10 0x1C

#uboot: DNW

#虚拟机: DNW U-boot.bin

#uboot: MMC write 1 0xc0000000 0x30 0x21d

#uboot: DNW

#虚拟机: DNW Sd_fuse/tiny4412/e4412_tzsw.bin

#uboot: MMC write 1 0xc0000000 0x2c0 0xb8

Boot partition to this all write complete, note Be sure to close eMMC
Continue typing under U-boot:
#uboot: eMMC Close 1
Tip: EMMC CLOSE success.!!

Now that the uboot has been fully burnt into the EMMC, we can move the switch to the NAND side, starting from the eMMC and discovering that the uboot output has become:

2.2. Download Kernel to eMMC

Reference: http://blog.csdn.net/lizuobin2/article/details/52825033

Kernel download We use FastBoot download, Uboot has supported the fastboot.

Installing the Windows FastBoot Tool

If you already have Android Studio installed, then you already have the FastBoot tool in the directory

There are Fastboot.exe AdbWinApi.dll under the F:\AndroidSDK\platform-tools.

I also provide fastboot download link: http://download.csdn.net/detail/fengyuwuzu0519/9886552

Download us into Uboot, perform fastboot, and connect the single board USB to the PC. Tips are as follows:


Windows cmd enters the directory where Fastboot.exe is located

FastBoot flashkernel zimage (normal download)

FastBoot flashramdisk ramdisk-u.img (normal download)

FastBoot flash fatrootfs_qtopia_qt4.img (download always error, so discard the disc file system, using the home-made file system)

FastBoot reboot

At this point, we have downloaded the uboot and kernel to a single board.

Reference: http://blog.csdn.net/lizuobin2/article/details/52825033

2.3, set the Uboot startup parameters, start the kernel, and hook up the network file system

Uboot Startup parameters:
Set Gatewayip 192.168.1.1
Set IPADDR 192.168.1.125//Board IP
Set ServerIP 192.168.1.123//pc machine IP

Set Bootargs "Root=/dev/nfsnfsroot=192.168.1.123:/work/nfs/filesystem ip=192.168.1.125console=ttysac0,115200 lcd= S70 ctp=2 "

Save

Set Bootcmd moviread kernel 0 40008000;movi read Rootfs 0 41000000 100000;bootm 4000800041000000

Reset

Kernel Boot information:

tiny4412 Learning (a) from the Zero Build Linux system (Burn write uboot, kernel into emmc+uboot boot kernel) "Turn"

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.