This time, I will port the basic Linux source code to OK6410. At the same time, I will also write down the problems I encountered and their solutions during the porting process. However, some methods are borrowed from the Internet, and some are added by myself, so there will be some minor bugs.
1. Basic Work
1. Download the source code from https://www.kernel.org/ . It is best to download the stable version, otherwise there will be minor bugs. (I am currently debugging the stable version, linux-3.14.4)
2. Copy it to your own folder and unzip it. I downloaded it with the .xz suffix, so the file is smaller, but there is just one more step when unzipping.
$ xz –d linux-3.14.4.tar.xz
$ tar xvf linux-3.14.4.tar
3. After decompression, enter the decompressed directory
2. Source code modification
1. Modify the Makefile in the root directory to modify arch and cross_compile as follows:
ARCH ?= arm CROSS_COMPILE ?= arm-linux-
2. Add relevant model mach files
At present, the latest kernel has supported several development boards. We start with the most basic 6410 and choose mini6410. We modify the configuration based on mini6410. Therefore, enter the arch/arm/mach-s3c64xx directory, copy mach-mini6410.c, and rename it to mach-ok6410.c. The following file needs to be modified:
2.1 Replace the code with 6410, as follows: mini6410->ok6410; MINI6410->OK6410
2.2 Then modify the nand partition information, modify the static struct mtd_partition ok6410_nand_part[]. This modification needs to be combined with your previous Uboot transplantation and your own defined partition layout. Mine is like this.
2.3 Since we have added a file, according to the rules of adding files in Linux, we also modify the Makefile and Kconfig in the corresponding directory
Modify kconfig, refer to the configuration of MINI6410, and add OK6410 as follows:
Modify Makefile and add ok6410
3. Modify the arch/arm/tools/mach-types file and add the OK6410 mach-type. This must be consistent with the MACH-TYPE in U-BOOT. Here, select smdk6410 mach-type: 1626
4. Menuconfig configuration
Back to the main directory, we choose the default configuration for 6400 and configure it based on it. Copy s3c6400_defconfig under config to the main directory and rename it to .config file
$ cp arch/arm/configs/s3c6400_defconfig ./.config
$ make menuconfig
After entering, make the following configuration: (Here is a note: in this case, to delete your input, you need to press delete+shift, pressing backspace is useless)
4.1 Select General Setup, open Cross_compiler tool perfix, and enter arm-linux-
4.4 Select System Type, cancel other 6410 and select only OK6410
4.3 Select Kernel Features and select the following two options:
4.4 For debugging convenience, we also turn on the debug of nand flash and select hardware ECC.
Device Drivers—>Memory Technology Device(MTD) support—>NAND Device Support—>
After completing the above configuration, save and exit!
Execute in the main directory, make uImage (the premise is that you have copied the mkimage tool under Uboot tools/ to the /bin directory)
Finally, after the compilation is completed, the output information is as follows:
Download it to the board via tftp, and the interface after running is as follows:
From the above we can see that the kernel loading address and the entry address are the same: 50008000, which is unreasonable. The entry address should be 50008000. Because it is uImage, a file header needs to be added at the entry.
Therefore we make the following changes:
Modify the makefile.lib file under scripts/: Change UIMAGE_ENTRYADDR ?= $(UIMAGE_LOADADDR) to:
IMAGE_ENTRYADDR ?= $(shell echo $(UIMAGE_LOADADDR) | sed -e "s/..$$/40/")
# U-Boot mkimage
#------------------------------------------------ --------------------------
MKIMAGE := $(srctree)/scripts/mkuboot.sh
# SRCARCH just happens to match slightly more than ARCH (on sparc), so reduces
# the number of overrides in arch makefiles
UIMAGE_ARCH ?= $(SRCARCH)
UIMAGE_COMPRESSION ?= $(if $(2),$(2),none)
UIMAGE_OPTS-y ?=
UIMAGE_TYPE ?= kernel
UIMAGE_LOADADDR ?= arch_must_set_this
#UIMAGE_ENTRYADDR ?= $(UIMAGE_LOADADDR)
UIMAGE_ENTRYADDR ?= $(shell echo $(UIMAGE_LOADADDR) | sed -e "s/..$$/40/")
UIMAGE_NAME ?= 'Linux-$(KERNELRELEASE)'
UIMAGE_IN ?= $<
UIMAGE_OUT ?= $@
After modification, make uImage again, the output information after compilation is as follows:
From the above we can see that the entry address has changed to 50008040,
After downloading to the board, the kernel can be booted.
From the log, we can see that our nand flash is not recognized because the error is here:
[06/08-11:25:41:371]s3c24xx-nand s3c6400-nand: failed to get clock
[06/08-11:25:41:371]s3c24xx-nand: probe of s3c6400-nand failed with error –2
For the convenience of reading, I will write it in the next article. This problem needs to be solved at present.
The complete startup log is as follows:
[06/08-11:25:33:478]U-Boot 2010.03-svn3 (May 06 2014 - 22:13:20) for SMDK6410
[06/08-11:25:33:478]
[06/08-11:25:33:478]**************************************** ******************
[06/08-11:25:33:492] Welcome to Embedded System
[06/08-11:25:33:494] Base On S3C6410 Devopment
[06/08-11:25:33:494] Date: 2014/4/15 22:00 PM
[06/08-11:25:33:503]****************************************** ******************
[06/08-11:25:33:503]
[06/08-11:25:33:504]CPU: S3C6410@533MHz
[06/08-11:25:33:531] Fclk = 533MHz, Hclk = 133MHz, Pclk = 66MHz (ASYNC Mode)
[06/08-11:25:33:531]Board: SMDK6410
[06/08-11:25:33:533]DRAM: 256 MB
[06/08-11:25:33:549]Flash: 0 kB
[06/08-11:25:33:549]NAND Flash: 2048 MB
[06/08-11:25:34:671]**************************************** *********************
[06/08-11:25:34:671]Initial LCD controller
[06/08-11:25:34:684] clk_freq:9 MHz, div_freq:13,rea_freq:9 MHz
[06/08-11:25:34:684]
[06/08-11:25:34:685] HBP = 2 HFP = 2 HSW = 41,Hpixs:480
[06/08-11:25:34:685] VBP = 2 VFP = 2 VSW = 10,Vpixs:272
[06/08-11:25:34:703]FrameBuff:57e7a000
[06/08-11:25:34:703] LCD initialization Finished.
[06/08-11:25:34:704]**************************************** *********************
[06/08-11:25:34:724]In: serial
[06/08-11:25:34:724]
[06/08-11:25:34:724]Out: lcd
[06/08-11:25:34:726]
[06/08-11:25:34:726]Err: lcd
[06/08-11:25:34:728]
[06/08-11:25:35:082]Net: DM9000
[06/08-11:25:36:099]Hit any key to stop autoboot: 0
[06/08-11:25:36:099]
[06/08-11:25:36:099]NAND read:
[06/08-11:25:36:100]device 0 offset 0x100000, size 0x500000
[06/08-11:25:36:101]
[06/08-11:25:39:365] 5242880 bytes read: OK
[06/08-11:25:39:365]
[06/08-11:25:39:365]## Booting kernel from Legacy Image at 50008000 ...
[06/08-11:25:39:365]
[06/08-11:25:39:367] Image Name: Linux-3.14.4
[06/08-11:25:39:383]
[06/08-11:25:39:385] Image Type: ARM Linux Kernel Image (uncompressed)
[06/08-11:25:39:402]
[06/08-11:25:39:403] Data Size: 1638488 Bytes = 1.6 MB
[06/08-11:25:39:418]
[06/08-11:25:39:419] Load Address: 50008000
[06/08-11:25:39:443]
[06/08-11:25:39:443] Entry Point: 50008040
[06/08-11:25:39:456]
[06/08-11:25:39:780] Verifying Checksum ... OK
[06/08-11:25:39:798]
[06/08-11:25:39:799] XIP Kernel Image ... OK
[06/08-11:25:39:811]
[06/08-11:25:39:812]OK
[06/08-11:25:39:829]
[06/08-11:25:39:830]
[06/08-11:25:39:830]Starting kernel...
[06/08-11:25:39:830]
[06/08-11:25:39:842]
[06/08-11:25:39:860]
[06/08-11:25:39:874]
[06/08-11:25:40:162]Uncompressing Linux... done, booting the kernel.
[06/08-11:25:40:960]Booting Linux on physical CPU 0x0
[06/08-11:25:40:972]Linux version 3.14.4 (simiar@Embedded) (gcc version 4.4.3 (ctng-1.6.1) ) #1 Sun Jun 8 11:10:52 CST 2014
[06/08-11:25:40:976]CPU: ARMv6-compatible processor [410fb766] revision 6 (ARMv7), cr=00c5387d
[06/08-11:25:40:984]CPU: PIPT / VIPT nonaliasing data cache, VIPT nonaliasing instruction cache
[06/08-11:25:40:984]Machine: OK6410
[06/08-11:25:40:985]Ignoring unrecognized tag 0x54410008
[06/08-11:25:40:995]Memory policy: Data cache writeback
[06/08-11:25:40:995]CPU S3C6410 (id 0x36410101)
[06/08-11:25:40:995]CPU: found DTCM0 8k @ 00000000, not enabled
[06/08-11:25:40:996]CPU: moved DTCM0 8k to fffe8000, enabled
[06/08-11:25:41:006]CPU: found DTCM1 8k @ 00000000, not enabled
[06/08-11:25:41:006]CPU: moved DTCM1 8k to fffea000, enabled
[06/08-11:25:41:006]CPU: found ITCM0 8k @ 00000000, not enabled
[06/08-11:25:41:017]CPU: moved ITCM0 8k to fffe0000, enabled
[06/08-11:25:41:017]CPU: found ITCM1 8k @ 00000000, not enabled
[06/08-11:25:41:018]CPU: moved ITCM1 8k to fffe2000, enabled
[06/08-11:25:41:027]Built 1 zonelists in Zone order, mobility grouping on. Total pages: 65024
[06/08-11:25:41:038]Kernel command line: root=/dev/nfs nfsroot=192.168.1.100:/home/simiar/share/myproject/ok6410/filesystem/ok6410_fs ip=192.168.1.50:192.168 .1.100:192.168.1.1:255.255.255.0::eth0:off console=ttySAC0,115200
[06/08-11:25:41:050]PID hash table entries: 1024 (order: 0, 4096 bytes)
[06/08-11:25:41:061]Dentry cache hash table entries: 32768 (order: 5, 131072 bytes)
[06/08-11:25:41:061]Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)
[06/08-11:25:41:077]Memory: 256464K/262144K available (2173K kernel code, 175K rwdata, 664K rodata, 118K init, 198K bss, 5680K reserved)
[06/08-11:25:41:080]Virtual kernel memory layout:
[06/08-11:25:41:084] vector: 0xffff0000 - 0xffff1000 (4 kB)
[06/08-11:25:41:084] DTCM: 0xfffe8000 - 0xfffec000 (16 kB)
[06/08-11:25:41:085] ITCM: 0xfffe0000 - 0xfffe4000 (16 kB)
[06/08-11:25:41:094] fixmap: 0xfff00000 - 0xfffe0000 (896 kB)
[06/08-11:25:41:095] vmalloc: 0xd0800000 - 0xff000000 (744 MB)
Previous article:S3C6410 Embedded Application Platform Construction (V) - Linux-3.14.4 Ported to OK6410-(Nand Partition Problem)
Next article:S3C6410 Embedded Application Platform Construction (Part 3)
Recommended ReadingLatest update time:2024-11-23 08:31
- Popular Resources
- Popular amplifiers
- Microgrid Stability Analysis and Control Microgrid Modeling Stability Analysis and Control to Improve Power Distribution and Power Flow Control (
- MATLAB and FPGA implementation of wireless communication
- Introduction to Internet of Things Engineering 2nd Edition (Gongyi Wu)
- Siemens PLC Programming Technology and Application Cases (Edited by Liu Zhenquan, Wang Hanzhi, Yang Kun, etc.)
- Naxin Micro and Xinxian jointly launched the NS800RT series of real-time control MCUs
- How to learn embedded systems based on ARM platform
- Summary of jffs2_scan_eraseblock issues
- Application of SPCOMM Control in Serial Communication of Delphi7.0
- Using TComm component to realize serial communication in Delphi environment
- Bar chart code for embedded development practices
- Embedded Development Learning (10)
- Embedded Development Learning (8)
- Embedded Development Learning (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Intel promotes AI with multi-dimensional efforts in technology, application, and ecology
- ChinaJoy Qualcomm Snapdragon Theme Pavilion takes you to experience the new changes in digital entertainment in the 5G era
- Infineon's latest generation IGBT technology platform enables precise control of speed and position
- Two test methods for LED lighting life
- Don't Let Lightning Induced Surges Scare You
- Application of brushless motor controller ML4425/4426
- Easy identification of LED power supply quality
- World's first integrated photovoltaic solar system completed in Israel
- Sliding window mean filter for avr microcontroller AD conversion
- What does call mean in the detailed explanation of ABB robot programming instructions?
- STMicroelectronics discloses its 2027-2028 financial model and path to achieve its 2030 goals
- 2024 China Automotive Charging and Battery Swapping Ecosystem Conference held in Taiyuan
- State-owned enterprises team up to invest in solid-state battery giant
- The evolution of electronic and electrical architecture is accelerating
- The first! National Automotive Chip Quality Inspection Center established
- BYD releases self-developed automotive chip using 4nm process, with a running score of up to 1.15 million
- GEODNET launches GEO-PULSE, a car GPS navigation device
- Should Chinese car companies develop their own high-computing chips?
- Infineon and Siemens combine embedded automotive software platform with microcontrollers to provide the necessary functions for next-generation SDVs
- Continental launches invisible biometric sensor display to monitor passengers' vital signs
- Is it necessary to add a π-type filter circuit for serial communication? If the board is small and the space is limited, this must be considered.
- Application of Switching Power Supply ASIC in Synchronous Generator Excitation Control
- MSP430F5529 Power Management Module
- Hiring embedded software development engineers
- The conducted spurious signals of the RF with shielding cover are 5-6dB worse than those without shielding cover.
- What should we pay attention to when launching new products? In particular, is there any good advice on how to prevent plagiarism?
- China's mobile phone production accounts for half of the world's electronic product output in the first half of the year
- Design of Chinese Human-Machine Interface Based on MSP430 Microcontroller with Low Power Consumption
- Introduction to Driver Assistance System DAS
- Goodbye 2019, hello 2020. Some of the goals set in 2019 have not been achieved. It’s a pity. Let’s continue to work hard in 2020.