【问题标题】:Kernel compilation in Yocto, what to define?Yocto中的内核编译,定义什么?
【发布时间】:2016-10-12 08:41:35
【问题描述】:

我目前正在尝试使用 yocto (jethro) 编译内核。内核一可以从这里获取(commit 4561d2504e8ea562674070350d27c19357f0d7f0)

git clone --depth 1 --branch pine64-hacks-1.2 --single-branch https://github.com/longsleep/linux-pine64.git linux-pine64

我尝试编译它,它是成功的,但是将它集成到yocto系统中会产生编译错误。查看日志,可能会认为某些模块不起作用,但如果未集成到 Yocto 中,它们可以编译。当然,尚未设置参数,我只是不知道如何在 yocto 中继续进行类似的行为。 日志的某些部分可以帮助理解。

+ oe_runmake Image CC=aarch64-poky-linux-gcc   -fuse-ld=bfd  --sysroot=/home/dbensoussan/new_poky/poky/build/tmp/sysroots/pine64 LD=aarch64-poky-linux-ld.bfd    --sysroot=/home/dbensoussan/new_poky/poky/build/tmp/sysroots/pine64
+ bbnote make -j 8 Image CC=aarch64-poky-linux-gcc   -fuse-ld=bfd  --sysroot=/home/dbensoussan/new_poky/poky/build/tmp/sysroots/pine64 LD=aarch64-poky-linux-ld.bfd    --sysroot=/home/dbensoussan/new_poky/poky/build/tmp/sysroots/pine64
+ printf %b\0 bbnote make -j 8 Image CC=aarch64-poky-linux-gcc   -fuse-ld=bfd  --sysroot=/home/dbensoussan/new_poky/poky/build/tmp/sysroots/pine64 LD=aarch64-poky-linux-ld.bfd    --sysroot=/home/dbensoussan/new_poky/poky/build/tmp/sysroots/pine64
+ make -j 8 Image CC=aarch64-poky-linux-gcc   -fuse-ld=bfd  --sysroot=/home/dbensoussan/new_poky/poky/build/tmp/sysroots/pine64 LD=aarch64-poky-linux-ld.bfd    --sysroot=/home/dbensoussan/new_poky/poky/build/tmp/sysroots/pine64
  GEN     /home/dbensoussan/new_poky/poky/build/tmp/work/pine64-poky-linux/linux-pine64/3.10-r0/linux-pine64-standard-build/Makefile
scripts/kconfig/conf --silentoldconfig Kconfig

以下是警告:

drivers/net/wireless/bcmdhd/Kconfig:50:warning: defaults for choice values not supported
warning: (COMPAT) selects COMPAT_BINFMT_ELF which has unmet direct dependencies (COMPAT && BINFMT_ELF)
  GEN     /home/dbensoussan/new_poky/poky/build/tmp/work/pine64-poky-linux/linux-pine64/3.10-r0/linux-pine64-standard-build/Makefile
/home/dbensoussan/new_poky/poky/build/tmp/work-shared/pine64/kernel-source/scripts/dtc/updatetree.c: In function 'sunxi_dt_init_pinconf_prop':

/home/dbensoussan/new_poky/poky/build/tmp/work-shared/pine64/kernel-source/scripts/dtc/updatetree.c: In function 'sunxi_dt_init_pinconf_prop':
/home/dbensoussan/new_poky/poky/build/tmp/work-shared/pine64/kernel-source/scripts/dtc/updatetree.c:149:8: warning: variable 'propend' set but not used [-Wunused-but-set-variable]
  void *propend;

/home/dbensoussan/new_poky/poky/build/tmp/work-shared/pine64/kernel-source/scripts/dtc/updatetree.c:306:9: warning: variable 'ret' set but not used [-Wunused-but-set-variable]
  int i, ret, len, gpio_value[4], phandle, phandle_count;

  GEN     usr/initramfs_data.cpio
In file included from /home/dbensoussan/new_poky/poky/build/tmp/work-shared/pine64/kernel-source/include/linux/memcontrol.h:22:0,
                 from /home/dbensoussan/new_poky/poky/build/tmp/work-shared/pine64/kernel-source/include/linux/swap.h:8,
                 from /home/dbensoussan/new_poky/poky/build/tmp/work-shared/pine64/kernel-source/include/linux/suspend.h:4,
                 from /home/dbensoussan/new_poky/poky/build/tmp/work-shared/pine64/kernel-source/init/do_mounts.c:16:
/home/dbensoussan/new_poky/poky/build/tmp/work-shared/pine64/kernel-source/include/linux/cgroup.h:907:18: warning: 'struct cgroup_taskset' declared inside parameter list
           struct cgroup_taskset *tset)

很多cgroup警告紧随其后并以错误结束并结束编译:

/home/dbensoussan/new_poky/poky/build/tmp/work-shared/pine64/kernel-source/security/apparmor/lsm.c:1293:29: error: 'CONFIG_SECURITY_APPARMOR_UNCONFINED_INIT' undeclared here (not in a function)
 bool aa_g_unconfined_init = CONFIG_SECURITY_APPARMOR_UNCONFINED_INIT;

我的内核配方是:

require recipes-kernel/linux/linux-yocto.inc

DESCRIPTION = "Linux kernel for Allwinner a64 processors"

COMPATIBLE_MACHINE = "pine64"

LINUX_VERSION ?= "3.10"
PV = "${LINUX_VERSION}"

SRCREV_pn-${PN} = "6c0b852b9ab4688534c8e978d2d55cf8a26cbd05"
KERNEL_DEVICETREE ?= " \
  allwinner/sun50i-a64-pine64.dtb \
  allwinner/sun50i-a64-pine64-plus.dtb \
"

KERNEL_IMAGETYPE="Image"
KERNEL_DEFCONFIG_pine64 ?= "defconfig"

DEPENDS_aarch64 += "libgcc"

SRC_URI += "git://github.com/apritzel/linux.git;protocol=git;branch=a64-v4 \
            file://defconfig \
"
S = "${WORKDIR}/git"


do_kernel_configme_prepend() {
  echo "new custom config install"
  install -m 0644 ${S}/arch/${ARCH}/configs/${KERNEL_DEFCONFIG} ${WORKDIR}/defconfig || die "No default configuration for ${MACHINE}     / ${KERNEL_DEFCONFIG} available."
}

【问题讨论】:

    标签: linux-kernel yocto bitbake


    【解决方案1】:

    我不确定是否失败,但从错误来看,它不太可能与构建系统有关。不过,有很多东西在食谱中显得很奇怪:

    • 使用SRC_URI = 而不是SRC_URI += - 您似乎列出了您想要获取的所有项目,因此您应该设置不附加到它的值
    • SRCREV_pn-${PN} = 很丑 - 我们已经在配方的上下文中,所以不需要 pn- 覆盖。请改用SRCREV =
    • 您通常应该使用 = 而不是 ?=,除非您真的希望通过配置覆盖该值,否则如果存在默认值,您的配方所需的值可能永远不会使用。
    • DEPENDS_aarch64 += 行不会像您认为的那样做。它不会将libgcc 添加到DEPENDS,它会设置该值完全为DEPENDS,因为+= 立即发生而不是与覆盖同时发生,离开你和DEPENDS_aarch64 = " libgcc"。假设这条线甚至是必要的,你应该只使用DEPENDS +=,因为这是一个特定于机器的配方——你应该总是为aarch64构建,对吧?
    • SRC_URI 中提供一个defconfig 并且同时从内核复制defconfig 是可怕的。删除所有这些,改为设置KBUILD_DEFCONFIG = "defconfig"(如果这确实是arch/${ARCH}/configs 下源树中defconfig 文件的名称)。

    【讨论】:

    • 感谢您的建议,我更了解我现在在做什么。我明白发生了什么,但不明白为什么会发生。我的内核配置在“do_kernel_configme”步骤中被删除。我删除了该步骤并正常编译(因为保留了工作配置)。为什么要完成?我怎样才能以标准方式防止它,而不仅仅是删除它?
    • 这是在您遵循上述 KBUILD_DEFCONFIG 建议之后还是之前的某个时间?
    • 之后。仅使用您的建议并不能解决问题。我看到了一些 bsp 层,比如 RPI 在 do_kernel_configme_prepend 中制作了 defconfig 的副本。我会调查
    猜你喜欢
    • 2019-07-01
    • 1970-01-01
    • 2019-03-05
    • 2019-11-19
    • 2014-10-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多