How to Use bootm to boot kernel in U-BOOT

Source: Internet
Author: User

Note: U-boot is marked:
Http://www.hhcn.com/cgi-bin/topic.cgi? Forum = 3 & topic = 651 & show = 0
U-boot-generated by patch provided by keety- 1.1.3


You can use the go solution in the U-boot source code to start the kernel. However, U-boot has a better solution: bootm.

1. Describe bootm-related items before you start.

1. First of all, bootm In the S3C2410 architecture only operates the kernel image file in the SDRAM (as if the at91 architecture provides a piece of code to copy the kernel image from flash, however, this code is not available for the S3C2410 architecture. Although you can add this code under U-boot, it seems that this code is of little use), please ensure that your kernel image is downloaded to the SDRAM, or copy the kernel image in flash to SDRAM under bootcmd.

2. The-a parameter is the kernel running address, and the-e parameter is the entry address.

3,
1) if we do not use mkimage to process the kernel, we can directly download the kernel to 0x30008000 and run it again. The kernel will be decompressed and run automatically (however, a tag is required for Kernel running to pass parameters, this tag is recommended to be provided by bootloader. In U-boot, it is created by the bootm command by default ).
 
2) If mkimage is used to generate the kernel image file, 64byte information is added before the kernel for tag creation. The bootm command first checks whether the specified address XXXX of bootm XXXX is the same as the load address specified by-.
(1) if they are different, the 64-byte header will be extracted from this address, analyzed, and then the kernel with the removed header will be copied to the load address specified by-a to run it.
(2) if they are the same, place them separately. However, the entry address specified by-E will be pushed back to 64 bytes to skip the 64 bytes header.

Ii. Good. Next we will introduce how to use mkimage to generate an image file and download and run it.

Method 1,
1. First, use the U-boot/tools/mkimage tool to add the file header required for U-boot to your kernel. The specific procedure is as follows:
[Root @ localhost tftpboot] # mkimage-N 'linux-2.6.14'-A arm-O Linux-T kernel-C none-A 0x30008000-E 0x30008000-D zimage zimage. IMG
Image name: linux-2.6.14
Created: Fri Jan 12 17:14:50 2007
Image Type: ARM Linux kernel image (uncompressed)
Data size: 1262504 bytes = 1232.91 kb = 1.20 MB
Load address: 0x30008000
Entry Point: 0x30008000

Here we will explain the meaning of the parameters:
-A ==> set architecture to 'arch'
-O => Set Operating System to 'OS'
-T => set image type to 'type'
-C ==> set compression type 'comp'
-A ==> Set Load address to 'addr '(HEX)
-E => set entry point to 'EP' (HEX)
-N => set image name to 'name'
-D => Use Image Data from 'datafile'
-X ==> set xip (execute in place)

2. Download the kernel
U-boot 1.1.3 (Jan 12 2007-16:16:36)

U-Boot Code: 33f80000-> 33f9bac0 BSS:-> 33f9fbac
Ram Configuration:
Bank #0: 30000000 64 MB
Nor FLASH: 512 KB
Nand flash: 64 MB
In: Serial
Out: Serial
Err: Serial
Hit any key to stop autoboot: 0
Sbc2410 => TFTP 0x31000000 zimage. img
TFTP from server 192.168.1.115; our IP address is 192.168.1.128
Filename 'zimage. IMG '.
Load address: 0x31000000
Loading: ######################################## #########################
######################################## #########################
######################################## #########################
######################################## ############
Done
Bytes transferred= 1263324 (1346dc HEX)

3. Run

Sbc2410 => bootm 0x31000000
# Booting image at 31000000...
Image name: linun-2.6.14
Image Type: ARM Linux kernel image (uncompressed)
Data size: 1263260 bytes = 1.2 MB
Load address: 30008000
Entry Point: 30008000
Verifying checksum... OK
OK

Starting kernel...

Uncompressing Linux ...................................... ....................... linux version 2.6.14 (root @ luofuchong) (GCC version 3.4.1) #21 Fri Oct 20 17: 206cpu: arm920tid (WB) [41129200] Revision 0 (armv4t)
MACHINE: smdk2410
Memory Policy: ECC disabled, data cache writeback
CPU S3C2410A (ID 0x32410002)
S3C2410: Core 202.800 MHz, memory 101.400 MHz, peripheral 50.700 MHz
S3C2410 clocks, (c) 2004 simtec Electronics
Clock: slow mode (1.500 MHz), fast, mpll on, upll on
USB control, (c) 2006 sbc2410
Cpu0: D vivt write-back Cache
Cpu0: I cache: 16384 bytes, associativity 64, 32 byte lines, 8 sets
Cpu0: D cache: 16384 bytes, associativity 64, 32 byte lines, 8 sets
Built 1 zonelists
Kernel command line: Console = ttysac0 root =/dev/nfs nfsroot = 192.168.1.115:/Fren "IRQ: Clearing subpending status 00000002
PID hash table entries: 512 (Order: 9, 8192 bytes)
Timer tcon = 00500000, tcnt a509, tcfg 00000200,00000000, USEC 20171e4c
Console: Color dummy device 80x30
Dentry cache hash table entries: 16384 (Order: 4, 65536 bytes)
Inode-Cache hash table entries: 8192 (Order: 3, 32768 bytes)
Memory: 64 MB = 64 MB total
Memory: 62208kb available (1924 K code, 529 K data, 108 K init)
Mount-Cache hash table entries: 512
CPU: Testing write buffer coherency: OK
Softlockup Thread 0 started up.
Net: Registered protocol family 16
S3C2410: initialising Architecture
SCSI subsystem initialized
Usbcore: registered new driver usbfs
Usbcore: registered new driver Hub
S3C2410 DMA driver, (c) 2003-2004 simtec Electronics
DMA channel 0 at c4800000, IRQ 33
DMA Channel 1 at c4800040, IRQ 34
DMA Channel 2 at c4800080, IRQ 35
DMA Channel 3 at c48000c0, IRQ 36
Netwinder floating point emulator v0.97 (Double Precision)
Devfs: Richard Gooch (rgooch@atnf.csiro.au)
Devfs: devfs_debug: 0x0
Devfs: boot_options: 0x1
Yaffs Oct 18 2006 12:39:51 installing.
Console: switching to color frame buffer device 30x40
Fb0: s3c2410fb Frame Buffer Device
Fb1: Virtual Frame Buffer Device, using 1024 K of video memory
LED driver initialized
S3C2410 buttons successfully loaded
S3c2410_serial0 at mmio 0x50000000 (IRQ = 70) is a S3C2410
S3c2410_serial1 at mmio 0x50004000 (IRQ = 73) is a S3C2410
S3c2410_serial at mmio 0x50008000 (IRQ = 76) is a S3C2410
Io scheduler Noop registered
Io scheduler anticipatory registered
Io scheduler deadline registered
Io scheduler CFQ registered
Ramdisk driver initialized: 16 RAM disks of 4096 K size 1024 blocksize
Usbcore: registered new driver UB
Cirrus Logic cs8900a driver for Linux (modified for smdk2410)
Eth0: cs8900a rev E at 0xe0000300 IRQ = 53, no EEPROM, ADDR: 08: 0: 3E: 26: 0a: 5b
S3c24xx NAND driver, (c) 2004 simtec Electronics
S3c2410-nand: mapped registers at c4980000
S3c2410-nand: Timing: tacls 10ns, twrph0 30ns, twrph1 10ns
Nand device: Manufacturer ID: 0xec, chip ID: 0x76 (Samsung NAND 64mib, 3 V 8-bi) scanning device for Bad blocks
Bad eraseblock 1884 at 0x01d70000
Creating 4 MTD partitions on "NAND 64mib, 3 V 8-bit ":
0x00000000-0x00020000: "Vivi"
0x00020000-0x00030000: "Param"
0x00030000-0x00200000: "kernel"
0x00200000-0x04000000: "root"
Usbmon: debugfs is not available
S3c2410-ohci s3c2410-ohci: s3c24xx OHCI
S3c2410-ohci s3c2410-ohci: new USB bus registered, assigned bus number 1
S3c2410-ohci s3c2410-ohci: IRQ 42, Io mem 0x49000000
Hub 1-. 0: USB hub found
Hub 1-0: 1. 0: 2 ports Detected
Initializing USB Mass Storage driver...
Usbcore: registered new driver USB-storage
USB Mass Storage support registered.
Usbcore: registered new driver usbmouse
Drivers/USB/input/usbmouse. C: v1.6: USB hid Boot Protocol mouse driver
Mice: PS/2 mouse device common for all mice
S3C2410 touchscreen successfully loaded
Uda1341 audio driver initialized
Net: Registered protocol family 2
IP Route cache hash table entries: 1024 (Order: 0, 4096 bytes)
TCP established hash table entries: 4096 (Order: 2, 16384 bytes)
TCP bind hash table entries: 4096 (Order: 2, 16384 bytes)
TCP: Hash Tables configured (established 4096 bind 4096)
TCP Reno registered
TCP Bic registered
Net: Registered protocol family 1
IP-config: complete:
Device = eth0, ADDR = 192.168.1.128, mask = 255.255.255.0, GW = 192.168.1.1,
Host = luofuchong, domain =, Nis-domain = (none ),
Bootserver = 192.168.1.1, rootserver = 192.168.1.115, rootpath =
Looking up port of RPC 100003/2 on 192.168.1.115
Looking up port of RPC 100005/1 on 192.168.1.115
VFS: mounted root (NFS filesystem ).
Mounted devfs on/dev
Freeing init memory: 108 K
Init started: busybox v1.1.3 (2006.09.20-+ 0000) Multi-call binary
Starting PID 696, console/dev/TTS/0: '/etc/init. d/ss'

Please press enter to activate this console.

Method 2,
1. First, use the U-boot/tools/mkimage tool to add the file header required for U-boot to your kernel. The specific procedure is as follows:
[Root @ localhost tftpboot] # mkimage-N 'linux-2.6.14'-A arm-O Linux-T kernel-C none-A 0x30008000-E 0x30008040-D zimage zimage. IMG
Image name: linux-2.6.14
Created: Fri Jan 12 17:14:50 2007
Image Type: ARM Linux kernel image (uncompressed)
Data size: 1262504 bytes = 1232.91 kb = 1.20 MB
Load address: 0x30008000
Entry Point: 0x30008040
 

2. Download the kernel
U-boot 1.1.3 (Jan 12 2007-16:16:36)

U-Boot Code: 33f80000-> 33f9bac0 BSS:-> 33f9fbac
Ram Configuration:
Bank #0: 30000000 64 MB
Nor FLASH: 512 KB
Nand flash: 64 MB
In: Serial
Out: Serial
Err: Serial
Hit any key to stop autoboot: 0
Sbc2410 => TFTP 0x30008000 zimage. img
TFTP from server 192.168.1.115; our IP address is 192.168.1.128
Filename 'zimage. IMG '.
Load address: 0x30008000
Loading: ######################################## #########################
######################################## #########################
######################################## #########################
######################################## ############
Done
Bytes transferred= 1263324 (1346dc HEX)

3. Run

Sbc2410 => bootm 0x30008000
# Booting image at 30008000...
Image name: linux-2.6.14
Image Type: ARM Linux kernel image (uncompressed)
Data size: 1261056 bytes = 1.2 MB
Load address: 30008000
Entry Point: 30008040
Verifying checksum... OK
Xip kernel image... OK

Saving kernel startup information ....

Iii. Curing

If you want to write the image file to flash, you can copy the U-boot file to the SDRAM after each boot, and then use the bootm command to guide the file, follow these steps:
Sbc2410 => TFTP 0x30008000 zimage. img
TFTP from server 192.168.1.115; our IP address is 192.168.1.128
Filename 'zimage. IMG '.
Load address: 0x30008000
Loading: ######################################## #########################
######################################## #########################
######################################## #########################
######################################## ############
Done
Bytes transferred= 1263324 (1346dc HEX)
Sbc2410 => NAND erase 0x30000 0x1d0000

Nand erase: device 0 offset 196608, size 1900544... OK
Sbc2410 => NAND write 0x30008000 0x30000 0x1d0000

Nand write: device 0 offset 196608, size 1900544... 1900544 bytes written: OK

Set the U-boot startup command:
1. Method 1:
Sbc2410 => setenv bootcmd NAND read 0x31000000 0x30000 0x1d0000/; bootm 0x31000000
Sbc2410 => saveenv
Saving environment to Nand...
Erasing Nand... writing to Nand... Done
2. Method 2:
Sbc2410 => setenv bootcmd NAND read 0x30008000 0x30000 0x1d0000/; bootm 0x30008000
Sbc2410 => saveenv
Saving environment to Nand...
Erasing Nand... writing to Nand... Done

Sbc2410 => Reset
Startup information ....

 

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.