Zuletzt aktualisiert am 4. November 2025
Wie man einen Upstream-Kernel für das phyBoard-Mira i.MX6 Quad mit Hilfe eines SDKs erstellt
Zielsetzungen
Dieser Beitrag zeigt Ihnen: "Wie man einen Upstream-Kernel für das phyBoard-Mira i.MX6 Quad mit Hilfe eines SDKs erstellt".
Voraussetzungen
Ich nehme an, Sie haben git und ein geeignetes Yocto Project® Standard- oder erweiterbares Software Development Kit (SDK) installiert haben. Falls Sie kein solches SDK haben und eines bauen wollen, können Sie mein Build-Framework wie hier beschrieben einrichten:
Mission
In einem Entwicklungs-Workflow wollen Kernel-Entwickler normalerweise den Upstream-Linux-Kernel kompilieren, ohne bitbake. Sie könnten ein vom Yocto Project® erstelltes SDK oder ein beliebiges, einigermaßen aktuelles Linux-SDK verwenden wollen.
Holen Sie sich den Code und patchen Sie ihn, falls nötig.
Was nun?
Zuerst müssen wir die Kernel-Quellen besorgen. Das machen wir mit git.
# in case it does not exist, create it
mkdir -p ${HOME}/imx6q-phytec-mira-rdk-nand
# get into the dir
cd ${HOME}/imx6q-phytec-mira-rdk-nand
# clone from kernel.org
git clone git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git linux-stable-custom
Lassen Sie uns eine sehr spezifische Version erstellen
# in case you are not already there, get into the dir
cd ${HOME}/imx6q-phytec-mira-rdk-nand/linux-stable-custom
# check branches
git branch
# checkout the master branch
git checkout master
# check tags on master
git tag -l
# in case the branch already exits you could remove it like this:
(optional) git branch -D v5.10.17_LOCAL
# checking out version v5.10.17
git checkout v5.10.17
# create local branch, which is a copy of it
git checkout -b v5.10.17_LOCAL
Für den Fall, dass wir mit einem Root-Dateisystem über nfs booten wollen, benötigen wir einen Patch
So etwas in der Art:
From 1e56c6abb1901aa482936d8d809ebd489d2a48dd Mon Sep 17 00:00:00 2001
From: Robert Berger <git@ReliableEmbeddedSystems.com>
Date: Wed, 30 May 2018 20:04:18 +0200
Subject: [PATCH] revert patch e7e73b10d690c5352cb11b1941a09e4f3dc4c8ce because
I can not use imx6q-phytec-mira-rdk-nand with it - no network
Signed-off-by: Robert Berger <git@ReliableEmbeddedSystems.com>
---
drivers/net/ethernet/freescale/fec_main.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index eb2ea23..aca7e10 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -3458,10 +3458,12 @@ fec_probe(struct platform_device *pdev)
goto failed_regulator;
}
} else {
+ #if 0
if (PTR_ERR(fep->reg_phy) == -EPROBE_DEFER) {
ret = -EPROBE_DEFER;
goto failed_regulator;
}
+ #endif
fep->reg_phy = NULL;
}
--
2.7.4
Bauen Sie
Den statisch gelinkten Kernel erstellen
# in case you are not already there, get into the dir
cd ${HOME}/imx6q-phytec-mira-rdk-nand/linux-stable-custom
# set up the cross-compile environment (this assumes you installed an SDK before) e.g.
source /opt/resy/3.2+snapshot/environment-setup-armv7at2hf-vfp-resy-linux-gnueabi
# build the default configuration
make multi_v7_defconfig
# build the kernel
time make -j $(getconf _NPROCESSORS_ONLN) LOADADDR=0x00 uImage UIMAGE_TYPE=kernel_noload EXTRAVERSION=-custom-${USER}
Wie erstellt man den abgeflachten Gerätebaum (fdt)?
# in case you are not already there, get into the dir
cd ${HOME}/imx6q-phytec-mira-rdk-nand/linux-stable-custom
# build the fdt
make imx6q-phytec-mira-rdk-nand.dtb EXTRAVERSION=-custom-${USER}
Erstellen der Kernel-Module
# in case you are not already there, get into the dir
cd ${HOME}/imx6q-phytec-mira-rdk-nand/linux-stable-custom
# build the kernel modules
time make -j $(getconf _NPROCESSORS_ONLN) modules EXTRAVERSION=-custom-${USER}
Installation von verschiedenen Dingen
Kernel-Module installieren
# in case you are not already there, get into the dir
cd ${HOME}/imx6q-phytec-mira-rdk-nand/linux-stable-custom
# install kernel modules on some nfs export
sudo make modules_install ARCH=${ARCH} INSTALL_MOD_PATH=/opt/resy/3.2+snapshot/multi-v7-ml/imx6q-phytec-mira-rdk-nand/core-image-sato-sdk-multi-v7-ml
Kopieren Sie den statisch gelinkten kernel/fdt auf den tftp
Hinweis: Mein Bootloader ist so konfiguriert, dass er den Kernel/fdt über tftp holt.
# assumption:
# the tftp export is: /tftpboot/imx6q-phytec-mira-rdk-nand
# the bootloader wants to load over tftp:
# kernel: uImage
# fdt: uImage-imx6q-phytec-mira-rdk-nand.dtb
#
# in case you are not already there, get into the dir
cd ${HOME}/imx6q-phytec-mira-rdk-nand/linux-stable-custom
# statically linked kernel
cp ${HOME}/imx6q-phytec-mira-rdk-nand/linux-stable-custom/arch/arm/boot/uImage /tftpboot/imx6q-phytec-mira-rdk-nand/uImage-linux-stable-custom-v5.10.17
pushd /tftpboot/imx6q-phytec-mira-rdk-nand
ln -sf uImage-linux-stable-custom-v5.10.17 uImage
ls -la /tftpboot/imx6q-phytec-mira-rdk-nand
popd
# fdt
cp ${HOME}/imx6q-phytec-mira-rdk-nand/linux-stable-custom/arch/arm/boot/dts/imx6q-phytec-mira-rdk-nand.dtb /tftpboot/imx6q-phytec-mira-rdk-nand/imx6q-phytec-mira-rdk-nand.dtb-linux-stable-custom-v5.10.17
pushd /tftpboot/imx6q-phytec-mira-rdk-nand
ln -sf imx6q-phytec-mira-rdk-nand.dtb-linux-stable-custom-v5.10.17 uImage-imx6q-phytec-mira-rdk-nand.dtb
ls -la /tftpboot/imx6q-phytec-mira-rdk-nand
Schlussfolgerung
Jetzt sollten Sie in der Lage sein, Ihren eigenen Upstream-Kernel zu erstellen. Einen Blog-Beitrag über das Yocto Project® Kernel-Tooling finden Sie hier. Wenn Sie mehr darüber erfahren wollen, wie Embedded Linux funktioniert, schauen Sie hier. Um mehr über das Yocto Project® zu erfahren, schauen Sie hier.