Last active
August 22, 2020 22:49
-
-
Save mariotpc/d215021b508c60e2c1db7ad39d4102c5 to your computer and use it in GitHub Desktop.
Compile Kernel 4.9.13 to use with QEmu and ARM target
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
First One, Download the kernel | |
************************************************************ | |
wget https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.9.13.tar.gz | |
uncompress it | |
************************************************************ | |
tar -zxvf linux-4.9.13.tar.gz | |
going inside | |
************************************************************ | |
cd linux-4.9.13/ | |
Clean all the previous configuration that maybe in the Kernel | |
************************************************************ | |
make ARCH=arm CROSS_COMPILE=~/x-tools/armv6-rpi-linux-gnueabi/bin/armv6-rpi-linux-gnueabi- mrproper | |
In my case, I got the configuration to Multi Arch ARM v7. | |
************************************************************ | |
make ARCH=arm CROSS_COMPILE=~/x-tools/armv6-rpi-linux-gnueabi/bin/armv6-rpi-linux-gnueabi- multi_v7_defconfig | |
Use the menuconfig to set your LOCALVERSION if you want | |
************************************************************ | |
make ARCH=arm CROSS_COMPILE=~/x-tools/armv6-rpi-linux-gnueabi/bin/armv6-rpi-linux-gnueabi- menuconfig | |
(-MarioTPC) in my particular case. | |
[mariotpc@fedora31 linux-4.9.13]$ make ARCH=arm CROSS_COMPILE=~/x-tools/armv6-rpi-linux-gnueabi/bin/armv6-rpi-linux-gnueabi- kernelrelease | |
4.9.13-MarioTPC | |
Just Remember | |
************************************************************ | |
uImage is used with U-Boot | |
bzImage is commonly used un x86 | |
zImage is used in other platforms like ARM | |
Image is the ELF format bin | |
compile it | |
************************************************************ | |
make ARCH=arm CROSS_COMPILE=~/x-tools/armv6-rpi-linux-gnueabi/bin/armv6-rpi-linux-gnueabi- zImage | |
The result is: | |
LD init/built-in.o | |
KSYM .tmp_kallsyms1.o | |
KSYM .tmp_kallsyms2.o | |
LD vmlinux | |
SORTEX vmlinux | |
SYSMAP System.map | |
OBJCOPY arch/arm/boot/Image | |
Kernel: arch/arm/boot/Image is ready | |
.. | |
.. | |
.. | |
SHIPPED arch/arm/boot/compressed/ashldi3.S | |
AS arch/arm/boot/compressed/ashldi3.o | |
SHIPPED arch/arm/boot/compressed/bswapsdi2.S | |
AS arch/arm/boot/compressed/bswapsdi2.o | |
LD arch/arm/boot/compressed/vmlinux | |
OBJCOPY arch/arm/boot/zImage | |
Kernel: arch/arm/boot/zImage is ready | |
[mariotpc@fedora31 linux-4.9.13]$ ls arch/arm/boot/ | |
bootp compressed dts Image install.sh Makefile zImage | |
As Second Stage | |
************************************************************ | |
You must compile the Modules | |
This is done as follows. | |
make ARCH=arm CROSS_COMPILE=~/x-tools/armv6-rpi-linux-gnueabi/bin/armv6-rpi-linux-gnueabi- modules | |
As the Third Stage | |
************************************************************ | |
Compile the Flat Device Tree Blob | |
make ARCH=arm CROSS_COMPILE=~/x-tools/armv6-rpi-linux-gnueabi/bin/armv6-rpi-linux-gnueabi- dtbs | |
CHK include/config/kernel.release | |
CHK include/generated/uapi/linux/version.h | |
CHK include/generated/utsrelease.h | |
CHK include/generated/bounds.h | |
CHK include/generated/timeconst.h | |
CHK include/generated/asm-offsets.h | |
CALL scripts/checksyscalls.sh | |
DTC arch/arm/boot/dts/alpine-db.dtb | |
.. | |
.. | |
.. | |
DTC arch/arm/boot/dts/mt7623-evb.dtb | |
DTC arch/arm/boot/dts/mt8127-moose.dtb | |
DTC arch/arm/boot/dts/mt8135-evbp1.dtb | |
************************************************************ | |
All get Ready !-My next Gist - Run the newly Kernel on QEmu | |
************************************************************ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment