Porting u-boot-2010.03 --- Burning the kernel to NandFlash

Publisher:Tianran2021Latest update time:2024-10-17 Source: cnblogs Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

After successfully compiling u-boot, you can burn u-boot to NandFlash, so that u-boot will run automatically every time you start the computer. The next step is to complete its main mission---start the Linux kernel. You can use the tftp service to download the kernel and run it directly in the memory, but the most important process is to burn it to NandFlash to avoid loss after power failure.


There is a bug in the u-boot I transplanted here, that is, the command nand erase 100000 500000 always prompts 90% completed, which causes me to be unable to boot the kernel from NandFlash when writing the kernel. I will make a mark here and add it after finding a solution in the future. First use the sd card uboot that comes with ok6410 to burn the uboot and uImage I compiled.


1. Start u-boot through SD card boot method (mmc provided by Feiling Company)

2. Download our own u-boot.bin through dnw (the uboot network card driver provided by Feiling is incorrect and tftp cannot be used)

Board operation: SMDK6410 # dnw 50008000

Host operation: sudo dnw u-boot.bin

3. Burn u-boot.bin to NandFlash

SMDK6410 # nand erase 0 100000

SMDK6410 # nand write.uboot 50008000 0 100000

4. Download our own u-boot.bin through dnw

Board operation: SMDK6410 # dnw 50008000

Host operation: sudo dnw uImage

5. Burn the kernel into NandFlash

SMDK6410 # nand erase 100000 500000

SMDK6410 # nand write.e 50008000 100000 500000

6. After changing the board to boot from NandFlash, the following problems were found


U-Boot 2010.03 (Jan 22 2014 - 15:18:07) for SMDK6410



CPU: S3C6410@533MHz

Fclk = 533MHz, Hclk = 133MHz, Pclk = 66MHz (ASYNC Mode)

Board: SMDK6410

DRAM: 256 MB

Flash: 0 kB

NAND: 2048 MiB

*** Warning - bad CRC, using default environment


In: serial

Out: serial

Err: serial

Net: dm9000

Hit any key to stop autoboot: 0


NAND read: device 0 offset 0x100000, size 0x500000

5242880 bytes read: OK

## Booting kernel from Legacy Image at 50008000 ...

Image Name: Linux-3.12.7

Image Type: ARM Linux Kernel Image (uncompressed)

Data Size: 1575408 Bytes = 1.5 MB

Load Address: 50008000

Entry Point: 50008000

Verifying Checksum ... OK

XIP Kernel Image ... OK

OK


Starting kernel ...


undefined instruction

pc : [<5000800c>] lr : [<57e249a0>]

sp: 57cffdf4 ip: 00000002 fp: 50000100

r10: 0000065a r9: 57d04a24 r8: 57cfffe0

r7: 50008000 r6: 57e37c3c r5: 00000000 r4: 57cfffc4

r3 : 00000000 r2 : 50000100 r1 : 0000065a r0 : 50000144

Flags: nzCv IRQs off FIQs off Mode SVC_32

Resetting CPU ...


resetting ...


The problem is that an undefined exception occurs, undefined instruction, resulting in infinite restart.


So I started to shoot wrongly, because the kernel can be downloaded and run through tftp in the previous article, so the kernel should be fine. Later I found that I was missing a part. Since uboot only supports uImage, I first made the kernel image generated by uImage directly under Linux, but it can't be recognized by uboot. Here you need to use mkimage under uboot/tools to make uImage.


wu@wu-VirtualBox:/opt/u-boot-2010.03-3/tools$ mkimage -A arm -O linux -T kernel -C none -a 50008000 -e 50008040 -n "linux-3.12.7" -d / opt/linux-3.12.7-2/arch/arm/boot/zImage uImage

The generated uImage is under /opt/u-boot-2010.03-3/tools.


After searching for information from many sources, I found that the problem occurred at the interface between uboot and kernel:


Look carefully at the information printed above Load Address: 50008000 Entry Point: 50008000, and the command we just used is -a 50008000 -e 50008040, Load Address is the kernel load address, Entry Point is the kernel entry address, 50008040 needs to be added with x40 (converted to 64 bytes) because: uImage is a dedicated image file for uboot, it adds a 64-byte "header" before zImage, indicating the kernel version, loading location, generation time, size and other information;


For details, please refer to this article: http://kmoving.blog.163.com/blog/static/20504919720123151533819/


Repeat steps 1-5 to successfully start


U-Boot 2010.03 (Jan 22 2014 - 15:18:07) for SMDK6410



CPU: S3C6410@533MHz

Fclk = 533MHz, Hclk = 133MHz, Pclk = 66MHz (ASYNC Mode)

Board: SMDK6410

DRAM: 256 MB

Flash: 0 kB

NAND: 2048 MiB

*** Warning - bad CRC, using default environment


In: serial

Out: serial

Err: serial

Net: dm9000

Hit any key to stop autoboot: 0


NAND read: device 0 offset 0x100000, size 0x500000

5242880 bytes read: OK

## Booting kernel from Legacy Image at 50008000 ...

Image Name: linux-3.12.7

Image Type: ARM Linux Kernel Image (uncompressed)

Data Size: 1575408 Bytes = 1.5 MB

Load Address: 50008000

Entry Point: 50008040

Verifying Checksum ... OK

XIP Kernel Image ... OK

OK


Starting kernel ...


Uncompressing Linux... done, booting the kernel.

Booting Linux on physical CPU 0x0

Linux version 3.12.7 (wu@wu-VirtualBox) (gcc version 4.4.3 (ctng-1.6.1) ) #1 Tue Jan 21 17:10:55 CST 2014

CPU: ARMv6-compatible processor [410fb766] revision 6 (ARMv7), cr=00c5387d

CPU: PIPT / VIPT nonaliasing data cache, VIPT nonaliasing instruction cache

Machine: OK6410

Memory policy: ECC disabled, Data cache writeback

CPU S3C6410 (id 0x36410101)

........Omitted.......


Reference address:Porting u-boot-2010.03 --- Burning the kernel to NandFlash

Previous article:Porting u-boot-2010.03 --- Use tftp to download and run the kernel
Next article:Porting the kernel to the OK6410 development board under Ubuntu

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号