Platform introduction
Development board: tiny4412ADK + S700 + 4GB Flash
Kernel version to be transplanted: Linux-4.4.0 (supports device tree)
u-boot version: U-Boot 2010.12 that comes with Friendly Arm (some changes have been made to support uImage startup)
busybox version: busybox 1.25
Cross-compilation tool chain: arm-none-linux-gnueabi-gcc
(gcc version 4.8.3 20140320 (prerelease) (Sourcery CodeBench Lite 2014.05-29))
step
Continue above.
Since Linux-4.4.0 already has good support for tiny4412, there is very little work left for us.
1. Modify arch/arm/boot/dts/exynos4412-tiny4412.dts
diff --git a/arch/arm/boot/dts/exynos4412-tiny4412.dts b/arch/arm/boot/dts/exynos4412-tiny4412.dts
index 4840bbd..aeca42a 100644
--- a/arch/arm/boot/dts/exynos4412-tiny4412.dts
+++ b/arch/arm/boot/dts/exynos4412-tiny4412.dts
@@ -21,6 +21,7 @@
chosen {
stdout-path = &;serial_0;
+ bootargs = "root=/dev/ram0 rw rootfstype=ext4 console=ttySAC0,115200 init=/linuxrc earlyprintk";
};
memory {
@@ -78,7 +79,7 @@
bus-width = <;4>;
pinctrl-0 = <;&sd2_clk &sd2_cmd &sd2_cd &sd2_bus4>;
pinctrl-names = "default";
- status = "okay";
+ status = "disabled";
};
&;serial_0 {
The key point here is to add the bootargs setting in chosen. The above setting of bootargs means: the root file system is ramdisk, readable and writable, the file system type is ext4 format, the serial terminal uses ttySAC0, and the baud rate is 115200. earlyprintk is used to print some logs in the early stages of kernel startup. It will print the printk information to a terminal called bootconsole. After the real console is registered, the bootconsole will be disabled. If you want to use earlyprintk, you need to make relevant changes in the kernel. configuration, which will be discussed below. The setting of bootargs is very flexible. It can be set in the kernel device tree or in u-boot. It should be noted that if bootargs is set in u-boot, u-boot will use it during bootm. Use your own bootargs to overwrite the bootargs in the device tree (do_bootm_linux -> bootm_linux_fdt -> fdt_chosen). Another point is to disable the SD card controller 2. There are still some problems with the initialization of the SD controller, which will cause the kernel to hang. This will be solved later, because we will first use ramdisk as the root file system in the future, and use eMMC and SD card doesn't matter.
2. Create ramdisk root file system
1. To make a ramdisk, you first need to download the busybox code, which can be downloaded from https://busybox.net/downloads/, and then compile the root file system. I will not write about the specific process here. There is a lot of information on this on the Internet. I have made a working file system, which can be downloaded from the following address:
https://files.cnblogs.com/files/pengdonglin137/rootfs.tar.gz
After the download is completed, decompress it and start making ramdisk. During the production process, I wrote a script mk_ramdisk.sh
#!/bin/bash
rm -rf ramdisk*
sudo dd if=/dev/zero of=ramdisk bs=1k count=8192
sudo mkfs.ext4 -F ramdisk
sudo mkdir -p ./initrd
sudo mount -t ext4 ramdisk ./initrd
sudo cp rootfs/* ./initrd -raf
sudo mknod initrd/dev/console c 5 1
sudo mknod initrd/dev/null c 1 3
sudo umount ./initrd
sudo gzip --best -c ramdisk >; ramdisk.gz
sudo mkimage -n "ramdisk" -A arm -O linux -T ramdisk -C gzip -d ramdisk.gz ramdisk.img
The finally generated ramdisk.img is what we need. The ramdisk image generated in the above script can also be used as a ramdisk. The usage will be discussed below.
The link below is a ramdisk image that has been made and can be used after decompression:
https://files.cnblogs.com/files/pengdonglin137/ramdisk.zip
2. Configure the kernel to support ramdisk
make menuconfig
File systems --->;
<*> Second extended fs support
Device Drivers
SCSI device support --->;
<*> SCSI disk support
Block devices --->;
<*>RAM block device support
(16)Default number of RAM disks
(8192) Default RAM disk size (kbytes) (modified to 8M)
General setup --->;
[*] Initial RAM filesystem and RAM disk (initramfs/initrd) support
The default configuration of exynos already supports this.
3. Configure the kernel to support tmpfs
$ make menuconfig
File systems --->;
Pseudo filesystems --->
[*] Virtual memory file system support (former shm fs)
[*] Tmpfs POSIX Access Control Lists
The default configuration of exynos is also supported.
3. Compile the kernel
1. First, set up the cross-compilation tool chain used.
diff --git a/Makefile b/Makefile
index 70dea02..5d96411 100644
--- a/Makefile
+++ b/Makefile
@@ -248,8 +248,8 @@ SUBARCH := $(shell uname -m | sed -e s/i.86/x86/ -e s/x86_64/x86/
# "make" in the configured kernel build directory always uses that.
# Default value for CROSS_COMPILE is not to prefix executables
# Note: Some architectures assign CROSS_COMPILE in their arch/*/Makefile
-ARCH ?= $(SUBARCH)
-CROSS_COMPILE ?= $(CONFIG_CROSS_COMPILE:"%"=%)
+ARCH ?= arm
+CROSS_COMPILE ?= /root/tiny4412_android5/SysPort/cross_compile/arm-2014.05/bin/arm-none-linux-gnueabi-
2. Compile
make exynos_defconfig
make uImage LOADADDR=0x40008000 -j2
The generated uImage is under arch/arm/boot.
4. Compile device tree
make dtbs
Then the device tree image file exynos4412-tiny4412.dtb used on tiny4412 will be generated in arch/arm/boot/dts/.
5. Test
Since tiny4412's u-boot currently does not support USB network cards, it can only be downloaded using dnw, and tiny4412's u-boot already comes with the dnw command. The code of dnw running on the development machine can be downloaded from the link below:
https://files.cnblogs.com/files/pengdonglin137/dnw.tar.gz
After downloading, unzip it. There is already a compiled dnw executable program in the compressed package. You can also execute make, which will automatically compile and generate a dnw executable program. To compile, USB-related libraries must be installed on the machine. The installation command is as follows:
sudo apt-get install libusb-dev
With dnw, let’s start testing.
Start the development board and enter u-boot command mode;
DownloaduImage
Execute the command to download uImage in u-boot: dnw 0x40600000 (this address is not unique)
Execute in the development machine: dnw arch/arm/boot/uImage
Download ramdisk
Execute the command to download uImage in u-boot: dnw 0x41000000 (this address is not unique)
Execute in the development machine: dnw ramdisk.img
Download device tree image
Execute the command to download uImage in u-boot: dnw 0x42000000 (this address is not unique)
Execute in the development machine: dnw arch/arm/boot/dts/exynos4412-tiny4412.dtb
Start kernel
Use bootm to start the kernel: bootm 0x40600000 0x41000000 0x42000000
The following is the complete startup log:
U-Boot 2010.12-00000-gb391276-dirty (Jan 17 2016 - 06:03:22) for TINY4412
CPU: S5PC220 [Samsung SOC on SMP Platform Base on ARM CortexA9]
APLL = 1400MHz, MPLL = 800MHz
Board: TINY4412
DRAM: 1023 MiB
vdd_arm: 1.2
vdd_int: 1.0
vdd_mif: 1.1
BL1 version: N/A (TrustZone Enabled BSP)
Checking Boot Mode ... SDMMC
REVISION: 1.1
MMC Device 0: 3803 MB
MMC Device 1: 3728 MB
MMC Device 2: N/A
*** Warning - using default environment
Net: No ethernet found.
Hit any key to stop autoboot: 0
TINY4412 # dnw 0x41000000
OTG cable Connected!
Now, Waiting for DNW to transmit data
Download Done!! Download Address: 0x41000000, Download Filesize:0x27752e
Checksum is being calculated...
Checksum O.K.
TINY4412 # dnw 0x42000000
OTG cable Connected!
Now, Waiting for DNW to transmit data
Download Done!! Download Address: 0x42000000, Download Filesize:0xa53a
Checksum is being calculated.
Checksum O.K.
TINY4412 # dnw 0x40600000
OTG cable Connected!
Now, Waiting for DNW to transmit data
Download Done!! Download Address: 0x40600000, Download Filesize:0x43b5d0
Checksum is being calculated.....
Checksum O.K.
TINY4412 # bootm 0x40600000 0x41000000 0x42000000
## Booting kernel from Legacy Image at 40600000 ...
Image Name: Linux-4.4.0-gbd49c0f-dirty
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 4437392 Bytes = 4333 KiB
Load Address: 40008000
Entry Point: 40008000
Verifying Checksum ... OK
## Loading init Ramdisk from Legacy Image at 41000000 ...
Image Name: ramdisk
Image Type: ARM Linux RAMDisk Image (gzip compressed)
Data Size: 2585838 Bytes = 2525 KiB
Load Address: 00000000
Entry Point: 00000000
Verifying Checksum ... OK
## Flattened Device Tree blob at 42000000
Booting using the fdt blob at 0x42000000
Loading Kernel Image ... OK
OK
## Loading init Ramdisk from Legacy Image at 41000000 ...
Image Name: ramdisk
Image Type: ARM Linux RAMDisk Image (gzip compressed)
Data Size: 2585838 Bytes = 2525 KiB
Load Address: 00000000
Entry Point: 00000000
Verifying Checksum ... OK
Loading Ramdisk to 43a84000, end 43cfb4ee ... OK
Loading Device Tree to 413f2000, end 413ff539 ... OK
Starting kernel ...
Uncompressing Linux... done, booting the kernel.
[ 0.000000] Booting Linux on physical CPU 0xa00
[ 0.000000] Linux version 4.4.0-gbd49c0f-dirty (root@ubuntu) (gcc version 4.8.3 20140320 (prerelease) (Sourcery CodeBench Lite 2014.05-29) ) #24 SMP PREEMPT Tue Jan 19 05:39:48 PST 2016
[ 0.000000] CPU: ARMv7 Processor [413fc090] revision 0 (ARMv7), cr=10c5387d
[ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[ 0.000000] Machine model: FriendlyARM TINY4412 board based on Exynos4412
[ 0.000000] bootconsole [earlycon0] enabled
[ 0.000000] cma: Reserved 64 MiB at 0x7bc00000
[ 0.000000] Memory policy: Data cache writealloc
[ 0.000000] Samsung CPU ID: 0xe4412011
[ 0.000000] PERCPU: Embedded 12 pages/cpu @ef79b000 s18816 r8192 d22144 u49152
[ 0.000000] Built 1 zonelists in Zone order, mobility grouping on. Total pages: 260352
[ 0.000000] Kernel command line: root=/dev/ram0 rw rootfstype=ext4 console=ttySAC0,115200 init=/linuxrc earlyprintk
Previous article:Linux kernel transplantation based on tiny4412 (supports device tree) (1)
Next article:Linux kernel transplantation based on tiny4412 (supports device tree) (3)
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- Cadence, the new CIS schematic is overwritten by the old schematic with the same name. Can it be restored?
- [SAMR21 new gameplay] 27. UART
- In late summer and early autumn, play with EE core points, earn and spend + gift exchange spoilers
- What is the difference between SOP package and DIP package!
- Which is more effective in eliminating the back EMF of inductive loads, TVS or varistor?
- The chip cannot be removed
- A must-read summary of drone principles (IV) Professional terminology for drones
- MicroPython Hands-on (36) - MixPY Hello world
- 【i.MX6ULL】Driver Development 12——Capacitive Touch Driver Practice (Part 1)
- MicroPython now supports STM32F413 controller