
Environment setting for cross-compiling
This following settings are applicable when you are configuring and building kernel on a different architecture from the target. For
example, compiling an ARMv8 kernel on an X86 computer. If you are compiling the kernel natively on a machine of the same
architecture as the target, you should skip this chapter.
• Install the cross compiler of your distribution
• Specify the target architecture in ARCH environment variable
• Specify the prefix (and path) of a cross compiler in
CROSS_COMPILE
environment variable
$ export CROSS_COMPILE=/path/to/dir/tool-chain-prefix-
Or just the prefix if the cross-compiler commands are already in the execution
PATH
.
$ export CROSS_COMPILE=tool-chain-prefix-
For example, the commands needed on Ubuntu Linux will be like:
• 64-bit ARM:
$ sudo apt-get install gcc-aarch64-linux-gnu
$ export CROSS_COMPILE=aarch64-linux-gnu-
$ export ARCH=arm64
• 32-bit ARM (ARMv7 / 32-bit mode of ARMv8):
$ sudo apt-get install gcc-arm-linux-gnueabihf
$ export CROSS_COMPILE=arm-linux-gnueabihf-
$ export ARCH=arm
For the shell environment variables exported above, you can also include them directly in each make command you use. E.g.
$
ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- make {targets}
. Exporting them will save effort if you are using make in
kernel frequently.
Configuring kernel
The current kernel configuration for a kernel source tree will be kept in a hidden file named .config at the top level of the kernel
source code after you changed the configuration with any of the make config command variants. You can copy it directly from one
kernel source tree to another with the same kernel version to duplicate the configuration exactly. Also, you can edit it with a text
editor, in which you can see a list of
CONFIG_*
symbols corresponding to each of the kernel configure option.
The following targets from the Linux kernel Kbuild framework are used to load the default kernel configuration for LS1028A BSP:
•
defconfig/${PLATFORM}_defconfig
Create the
.config
file by using the default config options of the architecture or platform defined in the
arch/$ARCH/configs/
directory. This normally includes all the device drivers needed for the architecture or platform.
•
${FRAGMENT}.config
Merge a configuration fragment that enables certain features into the .config file.
Specific command to load the default configuration of different platforms for LS1028A BSP will be:
• For Layerscape ARMv8 platforms in 64bit mode:
$ make defconfig lsdk.config
• For Layerscape ARMv7 platforms:
$ make multi_v7_defconfig multi_v7_lpae.config lsdk.config
Configuring and building
Layerscape LS1028A BSP User Guide, Rev. 0.3, 04/2019
NXP Semiconductors
39
Содержание Layerscape LS1028A BSP
Страница 135: ......