Add some support for device tree kernels
v4 cover Add some support for device tree kernels
Hi everyone,
This is a refactoring of the previous basic device tree options available for microblaze.
The previous option only made it possible for microblaze targets to give a path to an external device tree, and build a simpleImage with it. This involved using a custom target name as simpleImages are built with the simpleImage.dt_name.
This is also the case on powerpc with cuImages.
This patchset replaces the existing mechanism with a more generic one. First, it allows to build device tree sources to blobs, both taking dts present in the kernel sources and external ones, using a path.
Then, it adds support for kernel images with appended device tree blobs. This option is only for ARM because it is the only architecture I can think of that has such feature.
Finally, it adds the simpleImage and cuImage as regular image variants, with the necessary logic to append the device tree name to use, while doing a bit of code factorisation for u-boot images along the way.
Thanks,
Maxime
Changes since v3:
* Removed the ugly calls to sed and mkimage, that were relying on an undefined variable (MKIMAGE) and now use the kernel build system instead
* Changed the location of the DTS options in the configuration edition tools
* Moved the declaration of BR2_LINUX_KERNEL_DTB_IS_SELF_BUILT from patch 2 to patch 4, where it belongs.
Maxime Ripard (6):
Revert "Microblaze: build kernel with device tree" Rework support for the device tree
Factorize the u-boot images code
Add support for appended device tree blobs for arm Add cuImage(powerpc) and simpleImage(microblaze) as Linux kernel
images variants
Update s6lx9 microblaze default configuration
configs/s6lx9_microboard_defconfig | 12 +---- linux/Config.in | 101 +++++++++++++++++++++++++++++++++--- linux/linux.mk | 79 ++++++++++++++++++++++------ 3 files changed, 158 insertions(+), 34 deletions(-)
Signature · 1 line
1.7.9.5
PATCH v4 1/6 Revert "Microblaze: build kernel with device tree"
This is way too specific to microblaze-only. Remove this support to introduce a more generic way to do support device tree kernels.
This reverts commit aaed42d15643e0cb64c96fa400a6097a19d19ef4.
--- linux/Config.in | 8 -------- linux/linux.mk | 14 -------------- 2 files changed, 22 deletions(-)
linux/Config.in +0 -8
@@ -124,14 +124,6 @@ config BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE help Path to the kernel configuration file -config BR2_LINUX_KERNEL_DTS_FILE - string "Device Tree dts file location" - depends on BR2_microblaze - help - Path from where the dts file has to be copied - The final "custom target" name depends on the - dts file name: - <name>.dts --> simpleImage.<name> # # Binary format #
linux/linux.mk +0 -14
@@ -117,18 +117,6 @@ endef LINUX_POST_PATCH_HOOKS += LINUX_APPLY_PATCHES -ifeq ($(KERNEL_ARCH),microblaze) -# on microblaze, we always want mkimage -LINUX_DEPENDENCIES+=host-uboot-tools - -define LINUX_COPY_DTS - if test -f "$(BR2_LINUX_KERNEL_DTS_FILE)" ; then \ - cp $(BR2_LINUX_KERNEL_DTS_FILE) $(@D)/arch/microblaze/boot/dts ; \ - else \ - echo "Cannot copy dts file!" ; \ - fi -endef -endif ifeq ($(BR2_LINUX_KERNEL_USE_DEFCONFIG),y) KERNEL_SOURCE_CONFIG = $(KERNEL_ARCH_PATH)/configs/$(call qstrip,$(BR2_LINUX_KERNEL_DEFCONFIG))_defconfig
@@ -143,8 +131,6 @@ define LINUX_CONFIGURE_CMDS $(if $(BR2_ARM_EABI), $(call KCONFIG_ENABLE_OPT,CONFIG_AEABI,$(@D)/.config), $(call KCONFIG_DISABLE_OPT,CONFIG_AEABI,$(@D)/.config)) - $(if $(BR2_microblaze), - $(call LINUX_COPY_DTS)) # As the kernel gets compiled before root filesystems are # built, we create a fake cpio file. It'll be # replaced later by the real cpio archive, and the kernel will be
Signature · 1 line
1.7.9.5
PATCH v4 2/6 Rework support for the device tree
In reply to Maxime RipardThis patch introduces some support for device tree-enabled kernels.
It replaces the former BR2_LINUX_KERNEL_DTS_FILE option that was microblaze-only, that was quite limited. This option was quite limited, first obviously because it was restricted to microblaze, but also because it targetted only external device tree source files, and allowed only to build simpleImages using the custom image name mechanism.
This patch adds a much more generic one, that can work on basically every architecture that supports device tree. It allows to build both device tree source file that comes with the kernel source or to set the path to the device tree file to use so that one can use a custom device tree.
--- linux/Config.in | 42 ++++++++++++++++++++++++++++++++++++++++++ linux/linux.mk | 19 +++++++++++++++++++ 2 files changed, 61 insertions(+)
linux/Config.in +42 -0
@@ -174,6 +174,48 @@ config BR2_LINUX_KERNEL_IMAGE_TARGET_NAME Specify the kernel make target to build the kernel that you need. +config BR2_LINUX_KERNEL_DTS_SUPPORT + bool "Device tree support" + help + Compile a device tree source into a device tree blob. + Select the dts file to compile in the options below. + +if BR2_LINUX_KERNEL_DTS_SUPPORT + +choice + prompt "Device tree source" + default BR2_LINUX_KERNEL_USE_INTREE_DTS + +config BR2_LINUX_KERNEL_USE_INTREE_DTS + bool "Use a device tree present in the kernel." + help + Use a device tree source distributed with + the kernel sources. The dts files are located + in the arch/<arch>/boot/dts folder. + +config BR2_LINUX_KERNEL_USE_CUSTOM_DTS + bool "Use a custom device tree file" + help + Use a custom device tree file, i.e, a device + tree file that does not belong to the kernel + source tree. +endchoice + +config BR2_LINUX_KERNEL_INTREE_DTS_NAME + string "Device Tree Source file name" + depends on BR2_LINUX_KERNEL_USE_INTREE_DTS + help + Name of the device tree source file, without + the trailing .dts + +config BR2_LINUX_KERNEL_CUSTOM_DTS_PATH + string "Device Tree Source file path" + depends on BR2_LINUX_KERNEL_USE_CUSTOM_DTS + help + Path to the device tree source file + +endif + config BR2_LINUX_KERNEL_INSTALL_TARGET bool "Install kernel image to /boot in target" depends on !BR2_TARGET_ROOTFS_INITRAMFS
linux/linux.mk +19 -0
@@ -46,6 +46,12 @@ LINUX_MAKE_FLAGS = \ # going to be installed in the target filesystem. LINUX_VERSION_PROBED = $(shell $(MAKE) $(LINUX_MAKE_FLAGS) -C $(LINUX_DIR) --no-print-directory -s kernelrelease) +ifeq ($(BR2_LINUX_KERNEL_USE_INTREE_DTS),y) +KERNEL_DTS_NAME = $(BR2_LINUX_KERNEL_INTREE_DTS_NAME) +else ifeq ($(BR2_LINUX_KERNEL_USE_CUSTOM_DTS),y) +KERNEL_DTS_NAME = $(basename $(notdir $(BR2_LINUX_KERNEL_CUSTOM_DTS_PATH))) +endif + ifeq ($(BR2_LINUX_KERNEL_IMAGE_TARGET_CUSTOM),y) LINUX_IMAGE_NAME=$(call qstrip,$(BR2_LINUX_KERNEL_IMAGE_TARGET_NAME)) else
@@ -153,13 +159,25 @@ define LINUX_CONFIGURE_CMDS yes '' | $(TARGET_MAKE_ENV) $(MAKE1) $(LINUX_MAKE_FLAGS) -C $(@D) oldconfig endef +ifeq ($(BR2_LINUX_KERNEL_DTS_SUPPORT),y) +define LINUX_BUILD_DTB + $(TARGET_MAKE_ENV) $(MAKE) $(LINUX_MAKE_FLAGS) -C $(@D) $(KERNEL_DTS_NAME).dtb +endef +define LINUX_INSTALL_DTB + cp $(KERNEL_ARCH_PATH)/boot/$(KERNEL_DTS_NAME).dtb $(BINARIES_DIR)/ +endef +endif + # Compilation. We make sure the kernel gets rebuilt when the # configuration has changed. define LINUX_BUILD_CMDS + $(if $(BR2_LINUX_KERNEL_USE_CUSTOM_DTS), + cp $(BR2_LINUX_KERNEL_CUSTOM_DTS_PATH) $(KERNEL_ARCH_PATH)/boot/dts/) $(TARGET_MAKE_ENV) $(MAKE) $(LINUX_MAKE_FLAGS) -C $(@D) $(LINUX_IMAGE_NAME) @if grep -q "CONFIG_MODULES=y" $(@D)/.config; then \ $(TARGET_MAKE_ENV) $(MAKE) $(LINUX_MAKE_FLAGS) -C $(@D) modules ; \ fi + $(LINUX_BUILD_DTB) endef
@@ -175,6 +193,7 @@ endef define LINUX_INSTALL_TARGET_CMDS $(LINUX_INSTALL_KERNEL_IMAGE_TO_TARGET) + $(LINUX_INSTALL_DTB) # Install modules and remove symbolic links pointing to build # directories, not relevant on the target @if grep -q "CONFIG_MODULES=y" $(@D)/.config; then \
Signature · 1 line
1.7.9.5
PATCH v4 3/6 Factorize the u-boot images code
In reply to Maxime RipardThis patch introduces the BR2_LINUX_KERNEL_UBOOT_IMAGE boolean to factorize more code that will be shared in the next patches that introduces other uImage-like targets.
--- linux/Config.in | 4 ++++ linux/linux.mk | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-)
linux/Config.in +4 -0
@@ -128,12 +128,16 @@ config BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE # Binary format # +config BR2_LINUX_KERNEL_UBOOT_IMAGE + bool + choice prompt "Kernel binary format" config BR2_LINUX_KERNEL_UIMAGE bool "uImage" depends on BR2_arm || BR2_armeb || BR2_bfin || BR2_powerpc || BR2_avr32 || BR2_sh || BR2_sh64 + select BR2_LINUX_KERNEL_UBOOT_IMAGE config BR2_LINUX_KERNEL_BZIMAGE bool "bzImage"
linux/linux.mk +4 -1
@@ -34,6 +34,10 @@ LINUX_PATCHES = $(call qstrip,$(BR2_LINUX_KERNEL_PATCH)) LINUX_INSTALL_IMAGES = YES LINUX_DEPENDENCIES += host-module-init-tools +ifeq ($(BR2_LINUX_KERNEL_UBOOT_IMAGE),y) + LINUX_DEPENDENCIES += host-uboot-tools +endif + LINUX_MAKE_FLAGS = \ HOSTCC="$(HOSTCC)" \ HOSTCFLAGS="$(HOSTCFLAGS)" \
@@ -62,7 +66,6 @@ LINUX_IMAGE_NAME=vmImage else LINUX_IMAGE_NAME=uImage endif -LINUX_DEPENDENCIES+=host-uboot-tools else ifeq ($(BR2_LINUX_KERNEL_BZIMAGE),y) LINUX_IMAGE_NAME=bzImage else ifeq ($(BR2_LINUX_KERNEL_ZIMAGE),y)
Signature · 1 line
1.7.9.5
PATCH v4 4/6 Add support for appended device tree blobs for arm
In reply to Maxime RipardThis patch adds support for the ARM-only appended device tree mechanism present in the kernel.
This option allows to add at the end of the kernel image the device tree blob so that we can still boot device tree enabled kernels with old bootloaders.
This patch also adds the needed logic to genereate such an image when building zImages or uImages, also adding the necessary parts to rebuild the uImage.
--- linux/Config.in | 33 +++++++++++++++++++++++++++++++++ linux/linux.mk | 37 ++++++++++++++++++++++++++++++++++++- 2 files changed, 69 insertions(+), 1 deletion(-)
linux/Config.in +33 -0
@@ -139,6 +139,13 @@ config BR2_LINUX_KERNEL_UIMAGE depends on BR2_arm || BR2_armeb || BR2_bfin || BR2_powerpc || BR2_avr32 || BR2_sh || BR2_sh64 select BR2_LINUX_KERNEL_UBOOT_IMAGE +config BR2_LINUX_KERNEL_APPENDED_UIMAGE + bool "uImage with appended DT" + depends on BR2_arm || BR2_armeb + select BR2_LINUX_KERNEL_DTS_SUPPORT + select BR2_LINUX_KERNEL_APPENDED_DTB + select BR2_LINUX_KERNEL_UBOOT_IMAGE + config BR2_LINUX_KERNEL_BZIMAGE bool "bzImage" depends on BR2_i386 || BR2_x86_64
@@ -147,6 +154,12 @@ config BR2_LINUX_KERNEL_ZIMAGE bool "zImage" depends on BR2_arm || BR2_armeb || BR2_powerpc || BR2_sparc || BR2_sh || BR2_sh64 || BR2_xtensa +config BR2_LINUX_KERNEL_APPENDED_ZIMAGE + bool "zImage with appended DT" + depends on BR2_arm || BR2_armeb + select BR2_LINUX_KERNEL_DTS_SUPPORT + select BR2_LINUX_KERNEL_APPENDED_DTB + config BR2_LINUX_KERNEL_VMLINUX_BIN bool "vmlinux.bin" depends on BR2_mips || BR2_mipsel || BR2_sh || BR2_sh64
@@ -186,6 +199,26 @@ config BR2_LINUX_KERNEL_DTS_SUPPORT if BR2_LINUX_KERNEL_DTS_SUPPORT +# We have mainly three cases when it comes to device tree support: +# 1) We don't want any support at all. Then the ..DTS_SUPPORT +# variable won't be set +# 2) We want device tree support, so we need the user to enter +# the device tree name or the the path to the custom device +# he uses, but the kernel abstracts this from us and only +# build an image that looks like a regular kernel image. In +# this case, we only need to derive the kernel image name from +# the given device tree name, and all the rest is as usual +# 3) We want device tree support, but the kernel requires us to +# build the device tree blob separately. In this case, some +# more logic will be needed. +# The variable below address the second case, were you only want +# limited actions from buildroot. +config BR2_LINUX_KERNEL_DTB_IS_SELF_BUILT + bool + +config BR2_LINUX_KERNEL_APPENDED_DTB + bool + choice prompt "Device tree source" default BR2_LINUX_KERNEL_USE_INTREE_DTS
linux/linux.mk +36 -1
@@ -56,6 +56,13 @@ else ifeq ($(BR2_LINUX_KERNEL_USE_CUSTOM_DTS),y) KERNEL_DTS_NAME = $(basename $(notdir $(BR2_LINUX_KERNEL_CUSTOM_DTS_PATH))) endif +ifeq ($(BR2_LINUX_KERNEL_APPENDED_DTB),y) +ifneq ($(words $(KERNEL_DTS_NAME)),1) +$(error Kernel with appended device tree needs exactly one DTS source.\ + Check BR2_LINUX_KERNEL_INTREE_DTS_NAME or BR2_LINUX_KERNEL_CUSTOM_DTS_PATH.) +endif +endif + ifeq ($(BR2_LINUX_KERNEL_IMAGE_TARGET_CUSTOM),y) LINUX_IMAGE_NAME=$(call qstrip,$(BR2_LINUX_KERNEL_IMAGE_TARGET_NAME)) else
@@ -66,10 +73,14 @@ LINUX_IMAGE_NAME=vmImage else LINUX_IMAGE_NAME=uImage endif +else ifeq ($(BR2_LINUX_KERNEL_APPENDED_UIMAGE),y) +LINUX_IMAGE_NAME=uImage else ifeq ($(BR2_LINUX_KERNEL_BZIMAGE),y) LINUX_IMAGE_NAME=bzImage else ifeq ($(BR2_LINUX_KERNEL_ZIMAGE),y) LINUX_IMAGE_NAME=zImage +else ifeq ($(BR2_LINUX_KERNEL_APPENDED_ZIMAGE),y) +LINUX_IMAGE_NAME=zImage else ifeq ($(BR2_LINUX_KERNEL_VMLINUX_BIN),y) LINUX_IMAGE_NAME=vmlinux.bin else ifeq ($(BR2_LINUX_KERNEL_VMLINUX),y)
@@ -79,6 +90,12 @@ LINUX_IMAGE_NAME=vmlinuz endif endif +ifeq ($(BR2_LINUX_KERNEL_APPENDED_DTB),y) +LINUX_IMAGE_TARGET=zImage +else +LINUX_IMAGE_TARGET=$(LINUX_IMAGE_NAME) +endif + # Compute the arch path, since i386 and x86_64 are in arch/x86 and not # in arch/$(KERNEL_ARCH). Even if the kernel creates symbolic links # for bzImage, arch/i386 and arch/x86_64 do not exist when copying the
@@ -159,10 +176,13 @@ define LINUX_CONFIGURE_CMDS $(call KCONFIG_SET_OPT,CONFIG_UEVENT_HELPER_PATH,\"/sbin/mdev\",$(@D)/.config)) $(if $(BR2_PACKAGE_SYSTEMD), $(call KCONFIG_ENABLE_OPT,CONFIG_CGROUPS,$(@D)/.config)) + $(if $(BR2_LINUX_KERNEL_APPENDED_DTB), + $(call KCONFIG_ENABLE_OPT,CONFIG_ARM_APPENDED_DTB,$(@D)/.config)) yes '' | $(TARGET_MAKE_ENV) $(MAKE1) $(LINUX_MAKE_FLAGS) -C $(@D) oldconfig endef ifeq ($(BR2_LINUX_KERNEL_DTS_SUPPORT),y) +ifeq ($(BR2_LINUX_KERNEL_DTB_IS_SELF_BUILT),) define LINUX_BUILD_DTB $(TARGET_MAKE_ENV) $(MAKE) $(LINUX_MAKE_FLAGS) -C $(@D) $(KERNEL_DTS_NAME).dtb endef
@@ -170,17 +190,32 @@ define LINUX_INSTALL_DTB cp $(KERNEL_ARCH_PATH)/boot/$(KERNEL_DTS_NAME).dtb $(BINARIES_DIR)/ endef endif +endif + +ifeq ($(BR2_LINUX_KERNEL_APPENDED_UIMAGE),y) +define LINUX_APPEND_DTB + cat $(KERNEL_ARCH_PATH)/boot/$(KERNEL_DTS_NAME).dtb >> $(KERNEL_ARCH_PATH)/boot/zImage + # We need to generate the uImage here after that so that the uImage is + # generated with the right image size. + $(TARGET_MAKE_ENV) $(MAKE) $(LINUX_MAKE_FLAGS) -C $(@D) uImage +endef +else ifeq ($(BR2_LINUX_KERNEL_APPENDED_ZIMAGE),y) +define LINUX_APPEND_DTB + cat $(KERNEL_ARCH_PATH)/boot/$(KERNEL_DTS_NAME).dtb >> $(KERNEL_ARCH_PATH)/boot/zImage +endef +endif # Compilation. We make sure the kernel gets rebuilt when the # configuration has changed. define LINUX_BUILD_CMDS $(if $(BR2_LINUX_KERNEL_USE_CUSTOM_DTS), cp $(BR2_LINUX_KERNEL_CUSTOM_DTS_PATH) $(KERNEL_ARCH_PATH)/boot/dts/) - $(TARGET_MAKE_ENV) $(MAKE) $(LINUX_MAKE_FLAGS) -C $(@D) $(LINUX_IMAGE_NAME) + $(TARGET_MAKE_ENV) $(MAKE) $(LINUX_MAKE_FLAGS) -C $(@D) $(LINUX_IMAGE_TARGET) @if grep -q "CONFIG_MODULES=y" $(@D)/.config; then \ $(TARGET_MAKE_ENV) $(MAKE) $(LINUX_MAKE_FLAGS) -C $(@D) modules ; \ fi $(LINUX_BUILD_DTB) + $(LINUX_APPEND_DTB) endef
Signature · 1 line
1.7.9.5
PATCH v4 5/6 Add cuImage(powerpc) and simpleImage(microblaze) as Linux kernel images variants
In reply to Maxime Ripard--- linux/Config.in | 14 ++++++++++++++ linux/linux.mk | 4 ++++ 2 files changed, 18 insertions(+)
linux/Config.in +14 -0
@@ -160,6 +160,20 @@ config BR2_LINUX_KERNEL_APPENDED_ZIMAGE select BR2_LINUX_KERNEL_DTS_SUPPORT select BR2_LINUX_KERNEL_APPENDED_DTB +config BR2_LINUX_KERNEL_CUIMAGE + bool "cuImage" + depends on BR2_powerpc + select BR2_LINUX_KERNEL_UBOOT_IMAGE + select BR2_LINUX_KERNEL_DTS_SUPPORT + select BR2_LINUX_KERNEL_DTB_IS_SELF_BUILT + +config BR2_LINUX_KERNEL_SIMPLEIMAGE + bool "simpleImage" + depends on BR2_microblaze + select BR2_LINUX_KERNEL_UBOOT_IMAGE + select BR2_LINUX_KERNEL_DTS_SUPPORT + select BR2_LINUX_KERNEL_DTB_IS_SELF_BUILT + config BR2_LINUX_KERNEL_VMLINUX_BIN bool "vmlinux.bin" depends on BR2_mips || BR2_mipsel || BR2_sh || BR2_sh64
linux/linux.mk +4 -0
@@ -81,6 +81,10 @@ else ifeq ($(BR2_LINUX_KERNEL_ZIMAGE),y) LINUX_IMAGE_NAME=zImage else ifeq ($(BR2_LINUX_KERNEL_APPENDED_ZIMAGE),y) LINUX_IMAGE_NAME=zImage +else ifeq ($(BR2_LINUX_KERNEL_CUIMAGE),y) +LINUX_IMAGE_NAME=cuImage.$(KERNEL_DTS_NAME) +else ifeq ($(BR2_LINUX_KERNEL_SIMPLEIMAGE),y) +LINUX_IMAGE_NAME=simpleImage.$(KERNEL_DTS_NAME) else ifeq ($(BR2_LINUX_KERNEL_VMLINUX_BIN),y) LINUX_IMAGE_NAME=vmlinux.bin else ifeq ($(BR2_LINUX_KERNEL_VMLINUX),y)
Signature · 1 line
1.7.9.5
PATCH v4 6/6 Update s6lx9 microblaze default configuration
In reply to Maxime Ripard--- configs/s6lx9_microboard_defconfig | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-)
configs/s6lx9_microboard_defconfig +2 -10
@@ -1,17 +1,9 @@ -BR2_microblaze=y BR2_microblazeel=y -BR2_TOOLCHAIN_EXTERNAL=y -BR2_TOOLCHAIN_EXTERNAL_XILINX_MICROBLAZEEL_V2=y -BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD=y -BR2_TOOLCHAIN_EXTERNAL_CUSTOM_PREFIX="microblazeel-unknown-linux-gnu" -BR2_TOOLCHAIN_EXTERNAL_CUSTOM_GLIBC=y -BR2_TOOLCHAIN_EXTERNAL_CXX=y BR2_TARGET_GENERIC_GETTY_PORT="ttyUL0" # BR2_TARGET_ROOTFS_TAR is not set BR2_TARGET_ROOTFS_INITRAMFS=y BR2_LINUX_KERNEL=y BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/avnet/s6lx9_microboard/lx9_mmu_defconfig" -BR2_LINUX_KERNEL_DTS_FILE="board/avnet/s6lx9_microboard/lx9_mmu.dts" -BR2_LINUX_KERNEL_IMAGE_TARGET_CUSTOM=y -BR2_LINUX_KERNEL_IMAGE_TARGET_NAME="simpleImage.lx9_mmu" +BR2_LINUX_KERNEL_USE_CUSTOM_DTS=y +BR2_LINUX_KERNEL_CUSTOM_DTS_PATH="board/avnet/s6lx9_microboard/lx9_mmu.dts"
Signature · 1 line
1.7.9.5
PATCH 1/2 Update qemu microblazeel default configuration
In reply to Maxime Ripard--- configs/qemu_microblazeel_mmu_defconfig | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-)
configs/qemu_microblazeel_mmu_defconfig +3 -16
@@ -1,27 +1,14 @@ -# Architecture -BR2_microblaze=y BR2_microblazeel=y - -# Toolchain -BR2_TOOLCHAIN_EXTERNAL=y -BR2_TOOLCHAIN_EXTERNAL_XILINX_MICROBLAZEEL_V2=y -BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD=y -BR2_TOOLCHAIN_EXTERNAL_CUSTOM_GLIBC=y -BR2_TOOLCHAIN_EXTERNAL_CXX=y - -# System BR2_TARGET_GENERIC_GETTY_PORT="ttyUL0" - -# Filesystem # BR2_TARGET_ROOTFS_TAR is not set BR2_TARGET_ROOTFS_INITRAMFS=y - -# Kernel BR2_LINUX_KERNEL=y BR2_LINUX_KERNEL_CUSTOM_VERSION=y BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="3.3.7" BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/qemu/microblazeel-mmu/kernel-3.3.config" -BR2_LINUX_KERNEL_DTS_FILE="board/qemu/microblazeel-mmu/system.dts" BR2_LINUX_KERNEL_IMAGE_TARGET_CUSTOM=y BR2_LINUX_KERNEL_IMAGE_TARGET_NAME="linux.bin" +BR2_LINUX_KERNEL_DTS_SUPPORT=y +BR2_LINUX_KERNEL_USE_CUSTOM_DTS=y +BR2_LINUX_KERNEL_CUSTOM_DTS_PATH="board/qemu/microblazeel-mmu/system.dts"
Signature · 1 line
1.7.9.5
PATCH 2/2 Update qemu microblazebe default configuration
--- configs/qemu_microblazebe_mmu_defconfig | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-)
configs/qemu_microblazebe_mmu_defconfig +3 -16
@@ -1,27 +1,14 @@ -# Architecture -BR2_microblaze=y BR2_microblazebe=y - -# Special toolchain -BR2_TOOLCHAIN_EXTERNAL=y -BR2_TOOLCHAIN_EXTERNAL_XILINX_MICROBLAZEBE_V2=y -BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD=y -BR2_TOOLCHAIN_EXTERNAL_CUSTOM_GLIBC=y -BR2_TOOLCHAIN_EXTERNAL_CXX=y - -# System BR2_TARGET_GENERIC_GETTY_PORT="ttyUL0" - -# Filesystem # BR2_TARGET_ROOTFS_TAR is not set BR2_TARGET_ROOTFS_INITRAMFS=y - -# Kernel BR2_LINUX_KERNEL=y BR2_LINUX_KERNEL_CUSTOM_VERSION=y BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="3.3.7" BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/qemu/microblazebe-mmu/kernel-3.3.config" -BR2_LINUX_KERNEL_DTS_FILE="board/qemu/microblazebe-mmu/system.dts" BR2_LINUX_KERNEL_IMAGE_TARGET_CUSTOM=y BR2_LINUX_KERNEL_IMAGE_TARGET_NAME="linux.bin" +BR2_LINUX_KERNEL_DTS_SUPPORT=y +BR2_LINUX_KERNEL_USE_CUSTOM_DTS=y +BR2_LINUX_KERNEL_CUSTOM_DTS_PATH="board/qemu/microblazebe-mmu/system.dts"
Signature · 1 line
1.7.9.5
v4 cover Add some support for device tree kernels
In reply to Maxime RipardHello,
Le Mon, 30 Jul 2012 14:32:43 +0200,
Maxime Ripard <[email protected]> a ?crit :
Quoted 2 lines
This is a refactoring of the previous basic device tree options available for microblaze.
I am fine with the general design, but it doesn't work: the qemu_microblazeel_defconfig doesn't build.
I had to make some changes:
*) Change the defconfig to limit the number of modifications compared
to the previous versions (keep architecture, toolchain, etc.) properties.
*) Create a special kconfig entry for the linux.bin image format
(Microblaze specific). This format requires mkimage to generate linux.bin, so we need to select BR2_LINUX_KERNEL_UBOOT_IMAGE. It probably worked on your system because you have mkimage installed system-wide, but since it isn't part of our required dependencies, you shouldn't rely on it.
However, even with those fixes, building the DTB doesn't work. Apparently, system.dts/system.dtb are kind of "reserved" names for Microblaze (from a quick reading of arch/microblaze/boot/Makefile). I have the following build error:
Kernel: arch/microblaze/boot/linux.bin is ready (#1)
CHK include/linux/version.h CHK include/generated/utsrelease.h CALL scripts/checksyscalls.sh
Building modules, stage 2.
MODPOST 0 modules
PATH="/home/test/outputs/t/host/bin:/home/test/outputs/t/host/usr/bin:/home/test/outputs/t/host/usr/sbin/:/usr/local/bin:/usr/bin:/bin:/usr/games" PERLLIB="/home/test/outputs/t/host/usr/lib/perl" /usr/bin/make -j2 HOSTCC="/usr/bin/gcc" HOSTCFLAGS="" ARCH=microblaze INSTALL_MOD_PATH=/home/test/outputs/t/target CROSS_COMPILE=" /home/test/outputs/t/host/usr/bin/microblazeel-unknown-linux-gnu-" DEPMOD=/home/test/outputs/t/host/usr/sbin/depmod -C /home/test/outputs/t/build/linux-3.3.7 system.dtb make[2]: *** No rule to make target `system.dtb'. Stop.
make[1]: *** [/home/test/outputs/t/build/linux-3.3.7/.stamp_built] Error 2
make: *** [all] Error 2
It would be good if you could fix this problem and resubmit. Please base your new work using the following branch, which includes the two changes I've mentioned above:
http://git.free-electrons.com/users/thomas-petazzoni/buildroot/log/?h=device-tree-support
Thanks!
Thomas
Signature · 4 lines
Thomas Petazzoni, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com
v4 cover Add some support for device tree kernels
Hi Thomas,
Le 30/07/2012 21:16, Thomas Petazzoni a ?crit :
Quoted 38 lines
Le Mon, 30 Jul 2012 14:32:43 +0200,
Maxime Ripard <[email protected]> a ?crit :Quoted 2 lines
This is a refactoring of the previous basic device tree options available for microblaze.
I am fine with the general design, but it doesn't work: the
qemu_microblazeel_defconfigdoesn't build.I had to make some changes:
*) Change the defconfig to limit the number of modifications compared
to the previous versions (keep architecture, toolchain, etc.) properties.*) Create a special kconfig entry for the linux.bin image format
(Microblaze specific). This format requires mkimage to generate linux.bin, so we need to selectBR2_LINUX_KERNEL_UBOOT_IMAGE. It probably worked on your system because you have mkimage installed system-wide, but since it isn't part of our required dependencies, you shouldn't rely on it.However, even with those fixes, building the DTB doesn't work. Apparently, system.dts/system.dtb are kind of "reserved" names for Microblaze (from a quick reading of
arch/microblaze/boot/Makefile). I have the following build error:Kernel:
arch/microblaze/boot/linux.binis ready (#1)CHK include/linux/version.h CHK include/generated/utsrelease.h CALL scripts/checksyscalls.shBuilding modules, stage 2.
MODPOST 0 modules
PATH="/home/test/outputs/t/host/bin:/home/test/outputs/t/host/usr/bin:/home/test/outputs/t/host/usr/sbin/:/usr/local/bin:/usr/bin:/bin:/usr/games" PERLLIB="/home/test/outputs/t/host/usr/lib/perl"/usr/bin/make-j2 HOSTCC="/usr/bin/gcc" HOSTCFLAGS="" ARCH=microblaze INSTALL_MOD_PATH=/home/test/outputs/t/target CROSS_COMPILE="/home/test/outputs/t/host/usr/bin/microblazeel-unknown-linux-gnu-" DEPMOD=/home/test/outputs/t/host/usr/sbin/depmod -C/home/test/outputs/t/build/linux-3.3.7system.dtb make[2]: *** No rule to make target `system.dtb'. Stop.
make[1]: *** [/home/test/outputs/t/build/linux-3.3.7/.stamp_built] Error 2
make: *** [all] Error 2
Quoted 3 lines
It would be good if you could fix this problem and resubmit. Please base your new work using the following branch, which includes the two changes I've mentioned above:
It looks like in the previous patchset, the custom system.dts file was copied (and as such, overwriting the original system.dts file), and never built.
From a quick test here, adding a
select BR2_LINUX_KERNEL_DTB_IS_SELF_BUILT
to the linux.bin image is putting back the same behaviour as before, and do not fail to build anymore.
Do you want me to send an updated version?
Maxime
Signature · 4 lines
Maxime Ripard, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com
v4 cover Add some support for device tree kernels
In reply to Maxime RipardLe Mon, 30 Jul 2012 14:32:43 +0200,
Maxime Ripard <[email protected]> a ?crit :
Quoted 4 lines
configs/s6lx9_microboard_defconfig | 12 +---- linux/Config.in | 101 +++++++++++++++++++++++++++++++++--- linux/linux.mk | 79 ++++++++++++++++++++++------ 3 files changed, 158 insertions(+), 34 deletions(-)
I have now applied this patch set, including the small fix you suggested for the linux.bin image problem I reported yesterday.
Thanks a lot for your persistence, I think it's great to have proper support in Buildroot to generate DT-related kernel images.
Best regards,
Thomas
Signature · 4 lines
Thomas Petazzoni, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com