Transplantation of Linux3.6.7 under OK6410

Source: Internet
Author: User

    • This was learned at the end of the semester, and I don't know if it will be useful later.
    • One day the whole js+css+html, suddenly get Linux C, learned really a lot.
    • Unfortunately, although the effort, the tutor still think I slow down this part of the cut off, alas.
Objective

For me as a novice, the first time to learn Linux, the face of huge code, complex program structure and its own knowledge of the serious lack of Linux, suddenly really do not know what to do. Consider the demo program provided by the Development Board manufacturer, the process is as follows: First run Bootloader,bootloade boot the Linux kernel boot, start and then run the UI program. The corresponding program also has three U-boot.bin zimage and ROOTFS.YAFFS2 respectively. The original idea is that the Linux kernel boot is the zimage, but what is this rootfs.yaffs the devil? What are you doing here? It was initially thought of as a UI (user interface), followed by an in-depth migration to understand that this is a root filesystem, and of course the application that contains the UI. Well, it's not a way to stay out of the Linux door anyway, just go inside and see. So I decided to first compile a bootable Linux kernel, the kernel for some external devices on the Development Board to drive the driver first, the main purpose is to be able to start. My understanding of "startup" was that I was able to run to a shell interface. After a little understanding of the file system, the root file system, and so on, then understand the "start" and shell interface or two parts. Boot includes Linux necessary for some initialization, system or external devices. Linux also needs to read some files to run the shell program after initialization is complete. These files are included in this ROOTFS.YAFFS2 (in fact, the shell program is included in this file). This involves several concepts, file systems, root file systems, YAFFS2 file systems, YAFFS2 root file Systems ..... After a bit of understanding on the Internet, there is a preliminary understanding of these concepts: the files that need to be read after the Linux kernel is booted need to be placed somewhere (SDRAM or Nandflash or the host's hard drive). In the SDRAM, for example, there is a ramdisk, it is a device, the equivalent of creating a "hard disk" in the SDRAM, which put the running files (initial impression, no further understanding); The NAND flash has CRAMFS or yaffs, etc. The CRAMFS is more suitable for nor flash, the yaffs is suitable for NAND flash, and the NFS root filesystem is placed on the host. So is the YAFFS2 file system and the YAFF2 root file system not the same thing? Think of the previous use of STM32 to do some experiments with a fatfs, like a file system, when using this system from the SD card to read pictures, documents, and the SD card must first be formatted as FAT32 (FAT) type. The YAFFS2 file system is a bit like this fatfs, and we've included it in the LiThe Nux program means that Linux can use this format to read some files. The YAFF2 root file system is to package the files that contain the scripts and directories that are necessary for Linux startup in the format YAFFS2, and then in NAND flash. A simple understanding is equivalent to "formatting" a region of the NAND into the YAFFS2 format, and then placing the files on the NAND.
The initial understanding is this, then the next thing we want to do is "start" and then run "shell".

Compile Configuration linux3.6.71. Modify the makefile in the home directory:
Arch = $ (subarch) Cross_compile? = $ (config_cross_compile: "%" =%) instead: Arch? = armcross_compile? =/USR/LOCAL/ARM/4.5.1/ bin/arm-linux-
Under the 2.arch/arm/mach-s3c64xx directory

2.1 Copy a mach-mini6410.c rename to mach-ok6410.c and modify its contents:
2.1.1 Replace all mini6410 words with ok6410, note the lowercase
2.1.2 Replace all MINI6410 words with OK6410, note that they are capitalized
2.1.3 Modifying the static struct mtd_partition Ok6410_nand_part

/*           [0] = {. Name = "Uboot",. Size = Sz_1m,.offset = 0,},[1] = {. Name = "Kernel",. Size = Sz_2m,.offset = Sz_1m,},[2] = { . Name = "Rootfs",. Size = Mtdpart_siz_full,.offset = sz_1m + sz_2m,},*/

Switch

{. Name = "Bootloader",. Offset = 0,.size = (2 * sz_1m),. mask_flags = Mtd_cap_nandflash,},{.name = "Kernel",. Offset = (2 * S z_1m),. Size = (5*sz_1m),. mask_flags = Mtd_cap_nandflash,},{.name = "File System",. Offset = (7 * sz_1m),. Size = (200*sz_1m ),},{.name = "User",. Offset = Mtdpart_ofs_append,.size = Mtdpart_siz_full,}

2.2 Modify the Kconfig file, refer to the Mini6410 configuration, add OK6410 as follows:

Config mach_ok6410    bool "OK6410" select Cpu_s3c6410select s3c_dev_hsmmcselect s3c_dev_hsmmc1select s3c64xx_setup_ Sdhciselect s3c_dev_usb_hostselect s3c_dev_nandselect s3c_dev_fbselect s3c64xx_setup_fb_24bppselect SAMSUNG_DEV_ Adcselect samsung_dev_tshelpmachine support for the Forlinx OK6410

2.3 Modify the Makefile file, refer to MINI6410, join OK6410 as follows:

obj-$ (config_mach_ok6410)        + = MACH-OK6410.O
3. Modify the Arch/arm/tools/mach-types file, add OK6410 Mach-type, this must and u-boot mach-type consistent, here choose smdk6410 mach-type:1626. As follows:
ok6410 mach_ok6410 OK6410 1626
4. Go back to the home directory to execute make Menuconfig
[Email protected]:/home/my# cd linux-3.6.7/[email protected]:/home/my/linux-3.6.7# make Menuconfig

The configuration is as follows:
4.1 Select Load an Alternate Configuration File first, enter Arch/arm/configs/s3c6400_defconfig
4.2 Select General Setup, open Cross_compiler tool Perfix, enter

/usr/local/arm/4.5.1/bin/arm-linux-   4.3 select System Type, Cancel SMDK6400, a&w6410,smdk6410 and other platforms, select only OK6410

4.4 Select Save an Alternate Configuration File, save As. config and exit.

5. Go back to the home directory to execute make zimage build zimage file6. Go back to the home directory to execute make uimage build uimage file

The Uimage file is the file format supported by U boot.

6.1 Copy the Mkimage file under the u-boot-2012.10/tools/directory to the host/usr/bin directory

6.2 Modify Entry_point question, refer to another article:

The same issue with the load address and Entry point of make uimage in Linux3.6.7

6.3 Go back to the home directory to execute make uimage build uimage file

7. Write the uimage into NAND, the NAND Flash placement Program is structured as follows:
0000 0000---0020 0000 size 2M Place uboot0020 0000---0070 0000 size 5M Place uImage0070 0000---0cf0 0000 size 200M Place rootfs

The results are as follows:

NAND read:device 0 Offset 0x200000, size 0x5000005242880 bytes read:ok## booting kernel from Legacy Image at 50008000. . Image name:linux-3.6.7image Type:arm Linux Kernel image (uncompressed) Data size:1476616 Bytes = 1.4 Mibload address:50 008000Entry point:50008040verifying Checksum ... Okxip Kernel Image ... Okokstarting kernel ... Uncompressing Linux ... done, booting the kernel. Booting Linux on physical CPU 0Linux version 3.6.7 ([email protected]) (GCC version 4.5.1 (CTNG-1.8.1-FA)) #1 Mon De C 3 15:54:25 CST 2012cpu:armv6-compatible Processor [410fb766] revision 6 (ARMV7), Cr=00c5387dcpu:pipt/vipt Nonaliasin G data cache, vipt nonaliasing instruction Cache machine:ok6410memory POLICY:ECC disabled, data cache writebackcpu S3 C6410 (id 0x36410101) s3c24xx clocks, Copyright 2004 Simtec electronicscamera:no parent Clock SPECIFIEDS3C64XX:PLL settin GS, a=533000000, m=533000000, e=24000000s3c64xx:hclk2=266500000, hclk=133250000, pclk=66625000 www.it165.netmout_ Apll:sOurce is FOUT_APLL (1), which is 533000000mout_epll:source was EPLL (1), rate is 24000000mout_mpll:source is MPLL (1), rat E is 533000000usb-bus-host:source are clk_48m (0), rate is 48000000audio-bus:source are MOUT_EPLL (0), rate is 24000000aud Io-bus:source is MOUT_EPLL (0), rate is 24000000audio-bus:source are MOUT_EPLL (0), rate is 24000000irda-bus:source is M  OUT_EPLL (0), rate was 24000000camera:no parent Clock specifiedcpu:found DTCM0 8k @ 00000000, not enabledcpu:moved DTCM0 8k to fffe8000, enabledcpu:found DTCM1 8k @ 00000000, not enabledcpu:moved DTCM1 8k to fffea000, Enabledcpu:found ITCM 0 8k @ 00000000, not enabledcpu:moved ITCM0 8k to fffe0000, enabledcpu:found ITCM1 8k @ 00000000, not enabledcpu:moved ITCM1 8k to fffe2000, enabledbuilt 1 zonelists in Zone order, mobility grouping on. Total pages:65024kernel command line:noinitrd root=/dev/mtdblock2 rootfstype=yaffs2 INIT=/LINUXRC console=ttySAC0, 115200PID Hash Table entries:1024 (order:0, 4096 bytes) Dentry CachE hash Table entries:32768 (order:5, 131072 bytes) inode-cache hash table entries:16384 (order:4, 65536 bytes) memory:2 56MB = 256MB totalmemory:256784k/256784k available, 5360k reserved, 0K highmemvirtual kernel memory layout:vector:0xfff f0000-0xffff1000 (4 KB) dtcm:0xfffe8000-0xfffec000 (KB) itcm:0xfffe0000-0xfffe4000 (KB) fixmap:0xfff0000 0-0xfffe0000 (896 KB) vmalloc:0xd0800000-0xff000000 (744 MB) lowmem:0xc0000000-0xd0000000 (+ MB) modules:0xb f000000-0xc0000000 (MB). TEXT:0XC0008000-0XC02818AC (2535 KB). init:0xc0282000-0xc029cb54 (107 kb). data:0xc 029e000-0xc02c7f20 (168 kb). bss:0xc02c8024-0xc02f9064 (197 KB) slub:genslabs=13, hwalign=32, Order=0-3, MinObjects =0, Cpus=1, Nodes=1nr_irqs:246vic @f6000000: ID 0x00041192, vendor 0x41vic @f6010000: ID 0x00041192, Vendor 0x41sched_cloc K:32 bits at-Hz, resolution 10000000NS, wraps every 4294967286msconsole:colour dummy device 80x30calibrating delay L Oop... 353.89 Bogomips (lpj=1769472) pid_max:default:32768 minimum:301mount-cache hash Table entries:512cpu:testing Write buffer Coherency:ok Setting up static identity map for 0x501dd240-0x501dd29cdma:preallocated-KiB pool for atomic coherent Allocationsok 6410:option string ok6410=0ok6410:selected LCD display is 480x272s3c64xx_dma_init:registering DMA CHANNELSPL080:IRQ 73 , at d0846000, channels 0..8pl080:irq, at d0848000, channels 8..16s3c6410:initialising architecturebio:create Slab & Lt;bio-0> at 0usbcore:registered new Interface driver usbfsusbcore:registered new interface driver Hubusbcore:regist Ered new device driver Usbromfs MTD (C) Red Hat, Inc.io Scheduler NoOp Registeredio Scheduler deadline Registeredio s Cheduler CFQ registered (default) Start plist testend plist tests3c-fb s3c-fb:window 0:fbserial:8250/16550 driver, 4 por TS, IRQ sharing disableds3c6400-uart.0:ttysac0 at MMIO 0x7f005000 (IRQ = in) is a s3c6400/10console [ttySAC0] Enableds3c6 400-uart.1:ttysac1 at MMIO 0x7f005400 (IRQ = All) is a s3c6400/10s3c6400-uart.2:ttysac2 at MMIO 0x7f005800 (IRQ = in) is a S3c6400/10s3c6400-uart .3:TTYSAC3 at MMIO 0x7f005c00 (IRQ = d) is a s3c6400/10brd:module loadedloop:module loadeds3c24xx NAND Driver, (c) 200 4 Simtec electronicss3c24xx-nand s3c6400-nand:tacls=4, 30ns twrph0=8 60ns, twrph1=6 45nss3c24xx-nand s3c6400-nand:syste M booted from Nands3c24xx-nand S3c6400-nand:nand soft Eccnand device:manufacturer id:0xec, Chip id:0xd5 (Samsung NAND 2GiB 3,3v 8-bit), page size:4096, OOB size:218no OOB scheme defined for oobsize 218------------[Cut here]------------K Ernel BUG at drivers/mtd/nand/nand_base.c:3278!  Internal error:oops-bug:0 [#1] armmodules linked in:cpu:0 not tainted (3.6.7 #1) PC are at NAND_SCAN_TAIL+0X580/0X67CLR is at NAND_SCAN_TAIL+0X580/0X67CPC: [<c017b410>] LR: [<c017b410>] Psr:60000013sp:cf82fe98 ip:00000001 fp:cf80a210r10:c0181530 r9:c0181524 r8:00000001r7:00000000 r6:cfa2fa80 r5:cf80a000 R4: cf80a210r3:c02ae464 r2:c02ae464 r1:20000093 R0:00000025FLAGS:NZCV IRQs on Fiqs on Mode svc_32 ISA ARM Segment ke  rnelcontrol:00c5387d table:50004008 dac:00000017process swapper (pid:1, stack limit = 0xcf82e268) stack: (0xcf82fe98 to 0xcf830000) fe80:cf80a000 cf854300fea0:cfa2fa80 C01816FC 00000000 cfa2f9c0 cf827fc0 00000000 c02f8900 c02f88f8fec0:c02f 8900 c02ad1ac c02ad178 c02c48e8 c029c8b8 C0295ce0 00000000 c01658a0fee0:c0165888 c0164634 00000000 c02ad178 c02c48e8 c02a  D1ac 00000000 00000049ff00:c0295ce0 c0164844 c02c48e8 cf82ff18 c01647b8 c0162f3c cf803878 cf8238e0ff20:c02c48e8 c02c48e8  c02c1288 Cfa2f9c0 00000000 C0163e60 c0250c40 c02c48e8ff40:c02c48e8 c02c8040 cf82e000 00000000 00000049 C0164d68 00000000 c0298b6cff60:c02c8040 cf82e000 00000000 00000049 c0295ce0 c0008704 c02af678 00000000ff80:c026fb28 c0295ce0 00000049 c00 35FAC c0253f3c c026f698 00000006 00000006ffa0:c02af678 c0298b6c 00000006 c0298b4c c02c8040 00000049 c029c8b8 c0282168ffc0 : 00000000 c0282840 00000006 00000006 c0282168 00000000 00000000 c0282758ffe0:c000f10c 00000013 00000000 00000000 00000000 c000f10c ffffffff FFFF Ffff[<c017b410>] (nand_scan_tail+0x580/0x67c) from [<c01816fc>] (s3c24xx_nand_probe+0x1c0/0x480) [< C01816fc>] (s3c24xx_nand_probe+0x1c0/0x480) from [<c01658a0>] (platform_drv_probe+0x18/0x1c) [<c01658a0 ] (platform_drv_probe+0x18/0x1c) from [<c0164634>] (driver_probe_device+0x7c/0x200) [<c0164634>] ( driver_probe_device+0x7c/0x200) from [<c0164844>] (__driver_attach+0x8c/0x90) [<c0164844>] (__driver_ attach+0x8c/0x90) from [<c0162f3c>] (bus_for_each_dev+0x54/0x80) [<c0162f3c>] (bus_for_each_dev+0x54/ 0x80) from [<c0163e60>] (bus_add_driver+0x170/0x240) [<c0163e60>] (bus_add_driver+0x170/0x240) from [< C0164d68>] (driver_register+0x78/0x144) [<c0164d68>] (driver_register+0x78/0x144) from [<c0008704>] ( do_one_initcall+0x34/0x180) [<c0008704>] (do_one_initcall+0x34/0x180) from [<c0282840>] (kernel_init+0xe8/0x1b0) [<c0282840>] (kernel_init+0xe8/0x1b0) from [<c000f10c>] (kernel_thread_exit+0x0/0x8) code:0a000003 e1a01003 e59f00e4 EB017DBE (E7F001F2)---[end trace 707c2cde67d9c275]---Kernel panic-not syncing:attempted to kill init! exitcode=0x0000000b

The kernel was booted, but the kernel initialization was not completed due to a NAND driver problem. The next step is to change the NAND driver.

Not finished

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.