Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

The document shows the steps to create Linux kernel headers of SP7021.

1. Download source files

Source files of SP7021 can be downloaded from GitHub or Yocto server of SP7021. Refer to https://github.com/sunplus-plus1/SP7021 or 2. HOW TO GET SOURCE FILE AND PACKAGE. Refer to report of ll command for the contents of top folder of sources of SP7021:

wellslu@scdiu3:~/q628/sdc$ ll
total 56
drwxr-xr-x 13 wellslu sp 4096 Jan 20 11:36 ./
drwxr-xr-x 21 wellslu sp 4096 Jan 17 16:36 ../
drwxr-xr-x  9 wellslu sp 4096 Oct  3 15:10 boot/
drwxr-xr-x  4 wellslu sp 4096 Jan 18 12:38 build/
drwxr-xr-x 11 wellslu sp 4096 Aug  2 17:44 crossgcc/
drwxr-xr-x  6 wellslu sp 4096 Feb  9  2021 dwc/
drwxr-xr-x  6 wellslu sp 4096 Sep  9  2019 eCos/
drwxr-xr-x  5 wellslu sp 4096 Jan 18 12:38 freertos/
drwxr-xr-x  8 wellslu sp 4096 Jan 18 12:38 ipack/
drwxr-xr-x  7 wellslu sp 4096 Sep  9  2019 linux/
-r--r--r--  1 wellslu sp   23 Sep  9  2019 Makefile
drwxr-xr-x  4 wellslu sp 4096 Sep  9  2019 nonos/
drwxr-xr-x  7 wellslu sp 4096 Sep  9  2019 .repo/
drwxr-xr-x  3 wellslu sp 4096 Jun 29  2020 yocto/
wellslu@scdiu3:~/q628/sdc$ 

2. Config build environment (create linux/kernel/.config)

For example, config build environment for boot from SD card and use BusyBox for BPI-F2S board. Please go to project top folder and run make config. Select 5 for BPI-F2S board, select 2 for boot from SD card, and select 1 for using BusyBox. Refer screenshot below:

make config is starting to configure building environment. It takes 1~2 minutes to complete.

3. Build all images (create linux/kernel/Module.symvers)

Run make all command to start to create image for SD card. It might take several minutes to complete. After make all completes, you will see screen like:

4. Create kernel headers

Please run make headers to create Linux kernel headers. After make headers completes, use ll command to list content of project top folder: Refer to screenshot of ll command below:

wellslu@scdiu3:~/q628/sdc$ ll
total 68
drwxr-xr-x 15 wellslu sp 4096 Jan 20 11:40 ./
drwxr-xr-x 21 wellslu sp 4096 Jan 17 16:36 ../
drwxr-xr-x  9 wellslu sp 4096 Oct  3 15:10 boot/
drwxr-xr-x  4 wellslu sp 4096 Jan 18 12:38 build/
-rw-r--r--  1 wellslu sp  341 Jan 20 11:37 .config
drwxr-xr-x 11 wellslu sp 4096 Aug  2 17:44 crossgcc/
drwxr-xr-x  6 wellslu sp 4096 Feb  9  2021 dwc/
drwxr-xr-x  6 wellslu sp 4096 Sep  9  2019 eCos/
drwxr-xr-x  5 wellslu sp 4096 Jan 18 12:38 freertos/
drwxr-xr-x  8 wellslu sp 4096 Jan 18 12:38 ipack/
drwxr-xr-x  7 wellslu sp 4096 Sep  9  2019 linux/
drwxr-xr-x  6 wellslu sp 4096 Jan 20 11:40 linux-headers-5.10.59-SUNPLUS-v7+/
-r--r--r--  1 wellslu sp   23 Sep  9  2019 Makefile
drwxr-xr-x  4 wellslu sp 4096 Sep  9  2019 nonos/
drwxr-xr-x  3 wellslu sp 4096 Jan 20 11:39 out/
drwxr-xr-x  7 wellslu sp 4096 Sep  9  2019 .repo/
drwxr-xr-x  3 wellslu sp 4096 Jun 29  2020 yocto/
wellslu@scdiu3:~/q628/sdc$

Linux kernel headers is stored at folder: linux-headers-5.10.59-SUNPLUS-v7+

Refer to content of folder: linux-headers-5.10.59-SUNPLUS-v7+

wellslu@scdiu3:~/q628/sdc$ ll linux-headers-5.10.59-SUNPLUS-v7+/
total 608
drwxr-xr-x  6 wellslu sp   4096 Jan 20 11:40 ./
drwxr-xr-x 15 wellslu sp   4096 Jan 20 11:40 ../
drwxr-xr-x  3 wellslu sp   4096 Jan 20 11:40 arch/
-rw-r--r--  1 wellslu sp  97224 Jan 20 11:40 .config
-rw-r--r--  1 wellslu sp     39 Jan 20 11:40 .gitignore
drwxr-xr-x  4 wellslu sp   4096 Jan 20 11:40 include/
drwxr-xr-x  2 wellslu sp   4096 Jan 20 11:40 kernel/
-rw-r--r--  1 wellslu sp    149 Jan 20 11:40 Makefile
-rw-r--r--  1 wellslu sp   1028 Jan 20 11:40 .missing-syscalls.d
-rw-r--r--  1 wellslu sp 484422 Jan 20 11:40 Module.symvers
drwxr-xr-x  8 wellslu sp   4096 Jan 20 11:40 scripts/
lrwxrwxrwx  1 wellslu sp     35 Jan 20 11:40 source -> /home/wellslu/q628/sdc/linux/kernel/
wellslu@scdiu3:~/q628/sdc$

Copy whole folder of linux-headers-5.10.59-SUNPLUS-v7+ to /usr/src of root file-system of your target.

Create a symbol link /lib/modules/5.10.59-SUNPLUS-V7+/build to /usr/src/linux-headers-5.10.59-SUNPLUS-v7+. For example:

pi@raspberrypi:~$ sudo ln -s /usr/src/linux-headers-5.10.59-SUNPLUS-v7+ /lib/modules/5.10.59-SUNPLUS-V7+/build
pi@raspberrypi:~$ ll /lib/modules/5.10.59-SUNPLUS-v7

Appendix: List of target headers in Makefile

headers:
	@KERNELRELEASE=$(shell cat $(LINUX_PATH)/include/config/kernel.release 2>/dev/null)
	@if ! [ -f $(LINUX_PATH)/.config ]; then \
		echo File \'$(LINUX_PATH)/.config\' does not exist!; \
		exit 1; \
	fi
	@if ! [ -f $(LINUX_PATH)/Module.symvers ]; then \
		echo File \'$(LINUX_PATH)/Module.symvers\' does not exist!; \
		exit 1; \
	fi
	rm -rf linux-headers-$(KERNELRELEASE)
	mkdir -p linux-headers-$(KERNELRELEASE)
	cp -f $(LINUX_PATH)/.config linux-headers-$(KERNELRELEASE)
	cp -f $(LINUX_PATH)/Module.symvers linux-headers-$(KERNELRELEASE)
	$(MAKE_ARCH) $(MAKE_JOBS) -C $(LINUX_PATH) CROSS_COMPILE=$(CROSS_COMPILE_FOR_LINUX) mrproper
	$(MAKE_ARCH) $(MAKE_JOBS) -C $(LINUX_PATH) O=../../linux-headers-$(KERNELRELEASE) CROSS_COMPILE=$(CROSS_COMPILE_FOR_LINUX) modules_prepare

  • No labels