I tried build kernel(lsdk 1812) by gcc8 for ls1046a, and got error message as following. Is there any patch to fix this issue?
-------------------------------------------------
from drivers/staging/fsl_qbman/dpa_alloc.c:32:
./include/linux/fsl_qman.h:415:1: error: alignment 1 of ‘struct qm_eqcr_entry’ is less than 8 [-Werror=packed-not-aligned] } __packed; ^
./include/linux/fsl_qman.h:469:3: error: alignment 1 of ‘struct <anonymous>’ is less than 8 [-Werror=packed-not-aligned]
} __packed ern;
^
./include/linux/fsl_qman.h:468:17: error: ‘fd’ offset 15 in ‘struct <anonymous>’ isn’t aligned to 8 -Werror=packed-not-aligned]
struct qm_fd fd;
^~
./include/linux/fsl_qman.h:486:3: error: alignment 1 of ‘struct <anonymous>’ is less than 8 [-Werror=packed-not-aligned]
} __packed dcern;
^
./include/linux/fsl_qman.h:485:17: error: ‘fd’ offset 15 in ‘struct <anonymous>’ isn’t aligned to 8 -Werror=packed-not-aligned]
struct qm_fd fd;
^~
./include/linux/fsl_qman.h:1679:1: error: alignment 1 of ‘struct qm_mcr_ceetm_cq_peek_pop_xsfdrread’ is less than 8 [-Werror=packed-not-aligned] } __packed; ^
./include/linux/fsl_qman.h:1677:15: error: ‘fd’ offset 14 in ‘struct qm_mcr_ceetm_cq_peek_pop_xsfdrread’ isn’t aligned to 8 [-Werror=packed-not-aligned]
drivers/staging/fsl_qbman/qman_config.c:815:29: error: bitwise comparison always evaluates to false [-Werror=tautological-compare]
if ((qman_ip_rev & 0xFF00) == QMAN_REV31) {
^~
Refreence to http://patchwork.dpdk.org/patch/39666/ , I made a patch 0001-To-fix-build-error-for-gcc8.patch. Although build error is gone, but board can't start.
I noticed meta-freescale has submit a patch named 0001-fix-gcc8-build-error.patch has fixed thid build error by disable align check. Yes, it does work.
diff --git a/Makefile b/Makefile
index d6db01a..85d9d6c 100644
--- a/Makefile
+++ b/Makefile
@@ -422,6 +422,8 @@ LINUXINCLUDE := \
KBUILD_AFLAGS := -D__ASSEMBLY__
KBUILD_CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
-fno-strict-aliasing -fno-common -fshort-wchar \
+ -Wno-packed-not-aligned \
+ -Wno-tautological-compare \
-Werror-implicit-function-declaration \
-Wno-format-security \
-std=gnu89
--
1.8.3.1
Use the following commands sequence for installing and building this LSDK under Ubuntu 18.04 64bit:
$ tar xvzf flexbuild_lsdk1812.tgz
$ cd flexbuild_lsdk1812.tgz
$ source setup.env
wget http://www.nxp.com/lgfiles/sdk/lsdk1812/app_components_LS_arm64.tgz
wget http://www.nxp.com/lgfiles/sdk/lsdk1812/app_components_LS_arm32.tgz
wget http://www.nxp.com/lgfiles/sdk/lsdk1812/bootpartition_LS_arm64_lts_4.14.tgz
wget http://www.nxp.com/lgfiles/sdk/lsdk1812/bootpartition_LS_arm32_lts_4.14.tgz
wget http://www.nxp.com/lgfiles/sdk/lsdk1812/bootpartition_LS_arm64_lts_4.9.tgz
wget http://www.nxp.com/lgfiles/sdk/lsdk1812/bootpartition_LS_arm32_lts_4.9.tgz
wget http://www.nxp.com/lgfiles/sdk/lsdk1812/lib_modules_LS_arm64_4.14.83.tgz
wget http://www.nxp.com/lgfiles/sdk/lsdk1812/lib_modules_LS_arm32_4.14.83.tgz
wget http://www.nxp.com/lgfiles/sdk/lsdk1812/lib_modules_LS_arm64_4.9.140.tgz
wget http://www.nxp.com/lgfiles/sdk/lsdk1812/lib_modules_LS_arm32_4.9.140.tgz
flex-builder -i mkrfs -a arm64
tar xvzf app_components_LS_arm64.tgz -C build/apps
sudo tar xvzf lib_modules_LS_arm64_4.14.83.tgz -C build/rfs/rootfs_ubuntu_bionic_LS_arm64/lib/modules
sudo tar xvzf lib_modules_LS_arm64_4.9.140.tgz -C build/rfs/rootfs_ubuntu_bionic_LS_arm64/lib/modules
flex-builder -c linux -a arm64
flex-builder -i merge-component -a arm64
flex-builder -i compressrfs -a arm64
flex-builder -c linux:custom -a arm64 -m ls1046ardb // kernel menu
flex-builder -c linux -a arm64
flex-builder -i mklinux -a arm64 // .itb file
flex-builder -i mkfw -m ls1046ardb -b sd // .img file is result of this command
Have a great day,
Pavel Chubakov
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Thank you for your reply. But as I know, the gcc of Ubuntu 18.04 is gcc7. I have confirmed that there is no problem by gcc7 build from Poky 2.5. I met this issue by gcc8 that build from Poky 2.6.
编译到最后一步了,无法make成功。源码是不是不完整
LD [M] drivers/net/wireless/intel/iwlwifi/mvm/iwlmvm.o
AR drivers/net/wireless/built-in.o
AR drivers/net/built-in.o
make[3]: *** [/media/OK10xx-linux-fs/flexbuild/packages/linux/OK10xx-linux-kernel/Makefile:1040: drivers] Error 2
make[3]: Leaving directory '/media/OK10xx-linux-fs/flexbuild/build/linux/linux/arm64/output'
make[2]: *** [Makefile:146: sub-make] Error 2
make[2]: Leaving directory '/media/OK10xx-linux-fs/flexbuild/packages/linux/OK10xx-linux-kernel'
make[1]: *** [Makefile:25: build-linux] Error 2
make[1]: Leaving directory '/media/OK10xx-linux-fs/flexbuild/packages/linux'
make: *** [Makefile:24: linux] Error 2
make: Leaving directory '/media/OK10xx-linux-fs/flexbuild'
往上查找有下面错误
/media/OK10xx-linux-fs/flexbuild/packages/linux/OK10xx-linux-kernel/include/linux/fsl_qman.h:415:1: error: alignment 1 of ‘struct qm_eqcr_entry’ is less than 8 [-Werror=packed-not-aligned]
415 | } __packed;
| ^
/media/OK10xx-linux-fs/flexbuild/packages/linux/OK10xx-linux-kernel/include/linux/fsl_qman.h:469:3: error: alignment 1 of ‘struct <anonymous>’ is less than 8 [-Werror=packed-not-aligned]
469 | } __packed ern;
| ^
/media/OK10xx-linux-fs/flexbuild/packages/linux/OK10xx-linux-kernel/include/linux/fsl_qman.h:468:17: error: ‘fd’ offset 15 in ‘struct <anonymous>’ isn’t aligned to 8 [-Werror=packed-not-aligned]
468 | struct qm_fd fd;
| ^~
/media/OK10xx-linux-fs/flexbuild/packages/linux/OK10xx-linux-kernel/include/linux/fsl_qman.h:486:3: error: alignment 1 of ‘struct <anonymous>’ is less than 8 [-Werror=packed-not-aligned]
486 | } __packed dcern;
| ^
/media/OK10xx-linux-fs/flexbuild/packages/linux/OK10xx-linux-kernel/include/linux/fsl_qman.h:485:17: error: ‘fd’ offset 15 in ‘struct <anonymous>’ isn’t aligned to 8 [-Werror=packed-not-aligned]
485 | struct qm_fd fd;
| ^~
/media/OK10xx-linux-fs/flexbuild/packages/linux/OK10xx-linux-kernel/include/linux/fsl_qman.h:1679:1: error: alignment 1 of ‘struct qm_mcr_ceetm_cq_peek_pop_xsfdrread’ is less than 8 [-Werror=packed-not-aligne
]
1679 | } __packed;
| ^
/media/OK10xx-linux-fs/flexbuild/packages/linux/OK10xx-linux-kernel/include/linux/fsl_qman.h:1677:15: error: ‘fd’ offset 14 in ‘struct qm_mcr_ceetm_cq_peek_pop_xsfdrread’ isn’t aligned to 8 [-Werror=packed-not-aligned]
1677 | struct qm_fd fd;
打完0001-To-fix-build-error-for-gcc8.patch补丁后,重新编译还是报错gned pointer value [-Werror=address-of-packed-member]
965 | &mcr->querycongestion.state, &p->cgrs[0]);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
CC drivers/usb/core/message.o
In file included from /media/OK10xx-linux-fs/flexbuild/packages/linux/OK10xx-linux-kernel/include/linux/byteorder/little_endian.h:5,
from /media/OK10xx-linux-fs/flexbuild/packages/linux/OK10xx-linux-kernel/arch/arm64/include/uapi/asm/byteorder.h:23,
from /media/OK10xx-linux-fs/flexbuild/packages/linux/OK10xx-linux-kernel/include/asm-generic/bitops/le.h:6,
from /media/OK10xx-linux-fs/flexbuild/packages/linux/OK10xx-linux-kernel/arch/arm64/include/asm/bitops.h:50,
from /media/OK10xx-linux-fs/flexbuild/packages/linux/OK10xx-linux-kernel/include/linux/bitops.h:38,
from /media/OK10xx-linux-fs/flexbuild/packages/linux/OK10xx-linux-kernel/include/linux/kernel.h:11,
from /media/OK10xx-linux-fs/flexbuild/packages/linux/OK10xx-linux-kernel/drivers/staging/fsl_qbman/dpa_sys.h:35,
from /media/OK10xx-linux-fs/flexbuild/packages/linux/OK10xx-linux-kernel/drivers/staging/fsl_qbman/qman_private.h:32,
from /media/OK10xx-linux-fs/flexbuild/packages/linux/OK10xx-linux-kernel/drivers/staging/fsl_qbman/qman_low.h:32,
from /media/OK10xx-linux-fs/flexbuild/packages/linux/OK10xx-linux-kernel/drivers/staging/fsl_qbman/qman_high.c:32:
/media/OK10xx-linux-fs/flexbuild/packages/linux/OK10xx-linux-kernel/drivers/staging/fsl_qbman/qman_high.c: In function ‘qman_query_cgr’:
/media/OK10xx-linux-fs/flexbuild/packages/linux/OK10xx-linux-kernel/drivers/staging/fsl_qbman/qman_high.c:2255:17: error: taking address of packed member of ‘struct qm_mcr_querycgr’ may result in an unaligned pointer value [-Werror=address-of-packed-member]
2255 | be32_to_cpus(&cgrd->cscn_targ_swp);
/media/OK10xx-linux-fs/flexbuild/packages/linux/OK10xx-linux-kernel/include/uapi/linux/byteorder/little_endian.h:101:38: note: in definition of macro ‘__be32_to_cpus’
101 | #define __be32_to_cpus(x) __swab32s((x))
| ^
/media/OK10xx-linux-fs/flexbuild/packages/linux/OK10xx-linux-kernel/drivers/staging/fsl_qbman/qman_high.c:2255:4: note: in expansion of macro ‘be32_to_cpus’
2255 | be32_to_cpus(&cgrd->cscn_targ_swp);
| ^~~~~~~~~~~~
/media/OK10xx-linux-fs/flexbuild/packages/linux/OK10xx-linux-kernel/drivers/staging/fsl_qbman/qman_high.c: In function ‘qman_query_congestion’:
/media/OK10xx-linux-fs/flexbuild/packages/linux/OK10xx-linux-kernel/drivers/staging/fsl_qbman/qman_high.c:2287:17: error: taking address of packed member of ‘struct qm_mcr_querycongestion’ may result in an unaligned pointer value [-Werror=address-of-packed-member]
2287 | be32_to_cpus(&congestion->state.__state);
编译脚本:
#!/bin/bash
current_path=$PWD
work_path=$PWD/flexbuild
cd $work_path && \
. setup.env && \
#flex-builder -i clean-apps && \
flex-builder clean && \
#flex-builder -c linux -a arm6
#flex-builder -c linux:custom
flex-builder -a arm64 -m ls1046ardb -S 1133
#cp -fr $work_path/build/images/* $current_path/Image_output
cd $current_path
操作系统:UBUNTU20.4 in windows10 subsystem
原始文件包OK10xx-linux-fs.tar.bz2
时间比较着急,没时间慢慢debug