Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to write upstream linux kernel code running on PopMetal and PX2

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article is to share with you about how to write upstream linux kernel code running on PopMetal and PX2. The editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article.

Rockchip platform, with its powerful performance and rich features, is very popular in the open source community, and the Linux kernel provides more and more support for it.

The latest stable version of the Linux kernel is Linux 4.2. The merge window of Linux 4.3 has been opened, and the rc1 version, the final stable version, will probably be released next week.

It will be released in a month or two. In every version of the Linux kernel, a large number of code submitted by Linux kernel hacker at home and abroad for the Rockchip platform will be merged to make

Upstream's support for the Rockchip platform is becoming more and more perfect.

The two development boards PX2 and PopMetal created by Chipspark have been widely favored by creators at home and abroad because of their rich interfaces and strong performance. In Linux version 4.1,

Daniel FUKAUMI Naoki of Japan has submitted the support code for PX2. At the same time, PopMetal is also supported in Linux 4.2 as a development board supported by upstream by default.

For Linux enthusiasts, it is a cool thing to be able to keep up with the latest code of follow upstream. You can not only experience the fun of your hack, but also experience the latest Linux all the time.

Features, whether for their own learning or the development of new products, will provide great help.

The following is mainly about how to compile the latest code for upstream and make it run on PopMetal and PX2 development boards.

(1) first of all, now the code, here we download the code of linux-stable.

Git clone git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git

After the download is complete, we cut to the latest stable branch, linux-4.2.y, and of course other branches are also available.

Git checkout-b linux-4.2.y origin/linux-4.2.y

(2) configuration, Linux upstream currently uses multi platform to configure ARM, that is, all ARM platforms (whether Rockchip or Samsung exynos, TI omap)

They share the same configuration file, which is multi_v7_defconfig for ARM Cortex series 32-bit chips.

Export ARCH=arm

Export CROSS_COMPILE=arm-linux-gnueabi-

Make multi_v7_defconfig

In order to apply the function of debug serial port normally, we also make the following modifications in make menuconfig:

Make menuconfig

This configuration mainly specifies the console of debug as ttyS2 in cmdline, and enables the earlyprintk function: console=ttyS2,115200 earlyprintk

In addition, in order to enter the command line smoothly, we use the simplest initramfs file system here. The production method of initramfs file system is very simple.

Practical students can go to the Internet to find relevant materials, here you can download my initramfs directly from github:

Git clone https://github.com/andyshrk/AndyHack.git

The cloned rootfs directory is the simple initramfs I made, and then configure it in make menuconfig as follows:

What you need to fill in here is the local relative path of the initramfs directory. Please fill in according to your actual situation.

The PMU used on PopMetal is the configuration in which RK808,multi_v7_defconfig does not turn on RK808 by default. Here, we need to configure it ourselves, otherwise emmc will

Abnormal work:

First of all, Rockchip RK3xxx I2C adapter should be selected.

Select the MFD configuration of RK808

Select the RK808 regulator configuration:

In addition, the Android system should be written in the development board on hand by default, so that when Uboo starts, it will automatically boot.img the root file system of Android.

Load into memory to prevent the kernel from automatically loading the root file system of Android (because many of upstream's kernel default configurations do not match Android, loading will fail

Causing the kernel to crash), the kernel code needs to be modified as follows:

(3) compile the code. There are some differences between this PopMetal and PX2, mainly because PopMetal's uboot supports the standard dtb function, while PX2's uboot does not support this function.

So for PX2, you need to compile the dtb file with the kernel, and PopMetal does compile to generate separate kernel.img and resource.img

Make zImage-J8

Make dtbs

For PopMetal, execute the following command:

. / resource_tool arch/arm/boot/dts/rk3288-popmetal.dtb

. / mkkrnlimg arch/arm/boot/zImage kernel.img

For PX2, execute the following command:

Cat arch/arm/boot/zImage arch/arm/boot/dts/rk3066a-rayeager.dtb > dkernel

. / mkkrnlimg dkernel kernel.img

Resource_tool and mkkrnling are tools for generating resource.img and kernel.img on the Rockchip platform, which can be copied directly from the kernel code provided by chipspark.

Burn the generated kernel.img and resource.img (for PX2, only need to burn kernel.img), the system can boot to the command line state.

In addition, if you make minor changes to the init.xxx.rc script in Android's boot.img, you can also use upstream's kernel to run Android's basic system, which will be written later.

This is how to write the upstream linux kernel code running on PopMetal and PX2. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report