Uboot Third Day Study

Source: Internet
Author: User
Tags network function

Make Jcpu_num compile at the same time as the number of Cpu_num
Cpu_num = number of processors in the current PC * Processor Core number


Start with power on
1, the system power, the implementation of the code in the Irom, the purpose of initializing the basic system functions, has been loaded BL1 code
2. BL1 code continues to initialize, initialize DRAM controller (400000000-80000000 available)
3. Uboot.bin begins execution at 0x43e00000 address location


Common (Uboot command)
556 U_boot_cmd () This macro function sets the current command execution as well as the need to execute functions do_movi-Simple_strtoul (argv[3], NULL, 16), complete command line fetching, and command execution


Query function or label order
1. In the current file

2. Not in the current file
Ctags tool Use
Generate the Ctags index under the source directory Ctags-r
CTRL + "to query
Enter a number to complete the file jump
CTRL + T returns to the previous layer file
Two times ESC enters the digital input interface
You must open the file in the directory that generated the tags index file

Uboot Start (focus on the process, not on the specific code)
First stage:
From Arch/arm/cpu/armv7/start. S start
Creation of an exception interrupt vector table
b Reset
Save Startup parameters (enter location), SVC mode settings, coprocessor instructions
156 MRC P15, 0, R0, C1, C0, 0 save content from CP15 coprocessor to R0
The coprocessor device is designed to shut down all interrupts
167 bl Cpu_init_cp15 Initialize CP15 coprocessor CP15 coprocessor settings (Mmu,cache, interrupts)
Closed the MMU and the cache.
325 mov pc, LR return
168 BL Cpu_init_crit Initialization board-level structure Setup
344 b lowlevel_init
Enter the Board/samsung/fs4412/lowlevel_init. S
Check the reset mode to detect the current power options, voltage reduction energy, will be reset mode detection
Add close watchdog code (no time to feed the dog)
Determine if Uboot is already running in physical memory current this 0x43e00000
R1 is the PC median value R2 is 0x43e00000
111 BL Uart_asm_init completes the serial port initialization (completes the stack pointer setting as well as the clock, baud rate setting)
113 BL Tzpc_init (Note the security mode)

The current label for the push {LR} is just beginning
==> mov PC,LR end
Back to Arch/arm/cpu/armv7/start. S medium
171 BL _main
Into the arch/arm/lib/crt0. S (Initialize c locale and Board_init_r)
108 Ldr SP, = (CONFIG_SYS_INIT_SP_ADDR)
CONFIG_SYS_INIT_SP_ADDR (config_sys_load_addr-generated_gbl_data_size (gd struct size)) 0x43e000000-128
#define CONFIG_SYS_LOAD_ADDR (config_sys_sdram_base + 0x3e00000)
#define Config_sys_sdram_base 0x40000000
is to use the assignment tool for the GD struct (include/configs/fs4412.h) and Ctags
Board_init_f BL
Enter ARCH/ARM/LIB/BOARD.C
Completed the assignment of GD struct (ARCH/ARM/INCLUDE/ASM/GLOBAL_DATA.H) The GD structure is primarily stored in the environment variables that are executed, including the execution address

303 for (init_fnc_ptr = init_sequence; *init_fnc_ptr; ++init_fnc_ptr) {
304 if ((*INIT_FNC_PTR) ()! = 0) {
305 Hang ();
306}
243 init_fnc_t *init_sequence[] function pointer array
The function pointer is traversed, the board level structure is initialized, and the DRAM initialization is done (the BL1 phase completes the DRAM controller initialization) (40000000-80000000 available)
Completed the first phase of the start, mainly the assembly completed CP15 coprocessor Setup, completed the interrupt Mmucache shutdown board-level structure initialization (serial, clock, etc.) finally completed the GD structure assignment, DRAM initialization
Phase II
Back to Arch/arm/lib/crt0. S (Create staging environment)
R8 represents the starting position of the current GD structure body
LR = here
R0 = r8 + 68
R0 = gd->start_addr_sp
r2 = gd->relocaddr
R1 = R8
Back to Arch/arm/cpu/armv7/start. S
R4 = R0
R5 = R1
R6 = R2 (destination address to be moved)

R0 = _start (start address location)
189 CMP R0, R6 for Uboot start and destination content determine if there are any currently moved
R1 = R2 Target location address

196 Copy_loop: (move mode code)
197 Ldmia r0!, {r9-r10}/* Copy from source address [r0] * * Copy the contents of the R0 address at 8 bytes to the R9-R10 register
198 Stmia r1!, {r9-r10}/* Copy to target address [R1] */Copy the value from the R9-R10 register to the R1 address
199 CMP r0, r2/* until source end address [R2] */
Blo Copy_loop
R0 is now our uboot initial address, storing our uboot from our original address uboot cycle to the high destination address uboot
Detects if the move was successful
243 bx LR (lr = here)
Enter the arch/arm/lib/crt0. S
Bss_start Bss_end has completed the 0 operation of BSS section in System.map.
Light red light, the GD structure is moved
167 Ldr pc, =board_init_r
ARCH/ARM/LIB/BOARD.C further initialization of the system
702 for (;;) {
703 Main_loop ();
704}
Enter the COMMON/MAIN.C, complete the environment variable acquisition, enter the self-starting mode
Bootcmd gets the SET environment variable value compared to the preset env value to perform the comparison successfully
Started the Uboot boot system.


Linux Kernel (assembly language, C (main), Shell script, Makefile)
Kernel: Refers to a system software that provides hardware abstraction layer, disk and file system control, multitasking and other functions.

The Linux kernel includes: process management, memory management, user management, and many other subsystems including such a core

Linux Features:
1, the supporting hardware platform is extensive (documentation Linux kernel source directory directory of important documents)
2, high scalability through the lite version of the kernel for feature expansion (Hardware support, driver add)
3, high stability, high reliability
4. Rich function
5, the operation of less resources
6. Modular Design (Installation and unloading of the drive)
7. Follow the GPL open source agreement
8. Simpler programming (with more function encapsulation)


Linux kernel design features: Cohesion Poly, low coupling
"Operating System Revolution"

Currently using the Linux kernel version: 3.14

linux2.6 the PARAM structure when the device is used in the pre-kernel
linux3.0 kernel pre-device parameters using tags structure
linux3.0 Device Tree Transfer parameter (industrial use)

Selection of Linux versions:
1, the needle for the current hardware architecture
2, the current design purpose (server (network, data processing requirements) OPENWRT (emphasis on network function))
3. Information


Linux directory structure
Arch (architecture) block (block device support) crypto (encryption algorithm) documentation (important document) driver (driver) Fireware (firmware platform) FS (file System)
init (boot mounted File system) IPC (interprocess communication) kernel (kernel execution related code) mm (memory management) NET (network support) script (script tool)
Security (same secure boot code) sound (audio card support) tools (compilation related tools) Virt (Physical address virtualization)

Make-p > Text generate global variable assignment in current source code

MAKE-J4/2 compiled with several threads

Linux kernel configuration
Steps:
Make Exynos_defconfig Import default configuration
Make Menuconfig (recommended) personal add configuration
Your display is too small to run menuconfig! (because the screen is too small)
It must is at least lines by columns.
Make Xconfig (QT library)
Make Config one article

Process:
Y contains the check make uimage to compile the selection into the kernel
M Modular make module compiled as a module (commonly used in drivers)
N not selected
You can use the space bar to switch
* Indicates that M is selected for modular compilation

<> indicates three options
[] indicates that there are two types of
() represents the input string
? To view Help information
About Menuconfig Writing

Top level Catalogs
MainMenu need to label header information

Source adds kconfig of other directories to the current location

Config devkmem------Specify the device (in the device tree file)
one bool "/DEV/KMEM virtual device Support" shows the name bool (two options)
Default y defaults to selected
Help information added by

int char, etc. ()
TriState of three options <>
Boot two options []

Menuconfig setup make uimage every time you complete
M is generated based on make Moudle

Make clean deletes some of the generated. o File intermediate files as well as target Save our configuration information (. config)

Make clean < make Mrproper < make Distclean
Deleted configuration file Delete all other files except source

Modifying kernel configuration Menuconfig need to recompile kernel
Modify the device tree file Exynos4412-fs4412.dts the device

Homework: Experiment 4-8

Uboot Third Day Study

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.