RK3399 buildroot编译、重新编译、增量编译

添加编译包

添加quectel-CM app

OK3399-linux-source$ ls app/quectel-CM
build.sh        ethtool-copy.h  main.c     MPQCTL.h  MPQMUX.h            QMIThread.c  quectel-CM            quectel-qmi-proxy    udhcpc.c          util.h
default.script  GobiNetCM.c     Makefile   MPQMI.h   NOTICE              QMIThread.h  quectel-mbim-proxy    quectel-qmi-proxy.c  udhcpc_netlink.c
device.c        libmnl          mbim-cm.c  MPQMUX.c  qmap_bridge_mode.c  QmiWwanCM.c  quectel-mbim-proxy.c  ReleaseNote.txt      util.c

在buildroot中添加配置文件

添加编译依赖
diff --git a/buildroot/package/forlinx/Config.in b/buildroot/package/forlinx/Config.in
index 59ad65d1d..0761d52e2 100644
--- a/buildroot/package/forlinx/Config.in
+++ b/buildroot/package/forlinx/Config.in
@@ -4,6 +4,7 @@ menuconfig BR2_PACKAGE_FORLINX

 if BR2_PACKAGE_FORLINX

+source "package/forlinx/quectel-CM/Config.in"
 source "package/forlinx/quectelCM/Config.in"
 source "package/forlinx/matrix-browser/Config.in"
 source "package/forlinx/forlinx-qt/Config.in"

添加配置文件和编译文件

buildroot/package/forlinx/quectel-CM/Config.in
config BR2_PACKAGE_QUECTEL_CM
        bool "QUECTEL-CM"
        help
          EC20 tool quectel-CM
buildroot/package/forlinx/quectel-CM/quectel-CM.mk
QUECTEL_CM_VERSION = 1.0
QUECTEL_CM_SITE = $(TOPDIR)/../app/quectel-CM
QUECTEL_CM_SITE_METHOD = local

QUECTEL_CM_LICENSE = Apache V2.0
QUECTEL_CM_LICENSE_FILES = NOTICE

define QUECTEL_CM_BUILD_CMDS
        $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) CC=$(TARGET_CC)
endef

define QUECTEL_CM_INSTALL_TARGET_CMDS
        $(INSTALL) -D -m 0755 $(@D)/quectel-CM  $(TARGET_DIR)/usr/bin/quectel-CM
endef

$(eval $(generic-package))

需要注意的是配置文件中的config BR2_PACKAGE_QUECTEL_CM要和编译文件里的配置字段要匹配:

(*_QUECTEL_CM	对应	QUECTEL_CM_*)

在buildroot配置文件中添加app的编译选项

diff --git a/buildroot/configs/rockchip_rk3399_defconfig b/buildroot/configs/rockchip_rk3399_defconfig
index aebc92727..19c23513b 100644
--- a/buildroot/configs/rockchip_rk3399_defconfig
+++ b/buildroot/configs/rockchip_rk3399_defconfig
@@ -539,6 +539,7 @@ BR2_PACKAGE_LIBV4L_RKMPP=y
 # BR2_PACKAGE_RK_WEBUI is not set
 BR2_PACKAGE_CHROMIUM=y
 BR2_PACKAGE_FORLINX=y
+BR2_PACKAGE_QUECTEL_CM=y
 BR2_PACKAGE_QUECTELCM=y
 BR2_PACKAGE_MATRIX_BROWSER=y
 BR2_PACKAGE_FORLINX_QT=y

编译后查看编译结果:

OK3399-linux-source$ find buildroot/ -name "quectel-CM"
buildroot/package/forlinx/quectel-CM
buildroot/output/rockchip_rk3399/build/quectel-CM-1.0/quectel-CM
buildroot/output/rockchip_rk3399/target/usr/bin/quectel-CM
OK3399-linux-source$ ls buildroot/output/rockchip_rk3399/build/quectel-CM-1.0/ -a
.               device.c        main.c     MPQMI.h   qmap_bridge_mode.c  quectel-CM            quectel-qmi-proxy    .stamp_configured        udhcpc_netlink.c
..              ethtool-copy.h  Makefile   MPQMUX.c  QMIThread.c         quectel-CM-1.0.tar    quectel-qmi-proxy.c  .stamp_rsynced           util.c
build.sh        GobiNetCM.c     mbim-cm.c  MPQMUX.h  QMIThread.h         quectel-mbim-proxy    ReleaseNote.txt      .stamp_target_installed  util.h
default.script  libmnl          MPQCTL.h   NOTICE    QmiWwanCM.c         quectel-mbim-proxy.c  .stamp_built         udhcpc.c
.stamp_built							表示该源码已经被编译过
.stamp_configured						表示该源码已经被配置过
.stamp_rsynced							目测表示该源码已经被同步
.stamp_target_installed					表示该源码编译结果已经被安装,安装目录一般是target目录

还有几个类似的文件

.stamp_downloaded						表示该源码已经被下载过,如果没有此文件会重新进行下载
.stamp_patched							表示此文件已经打过补丁
.stamp_extracted						表示此文件已经被压缩过,一般该目录下会有个压缩包

重新编译

修改了buildroot中的内容后需要重新编译,如果编译过的某个package目录下有上面的这几个文件,该包就不会进行重新编译。
如果需要重新编译这个package,可以删除这几个文件,或者某个文件,使得某几个编译步骤重新执行。

e.g.
rm buildroot/output/rockchip_rk3399/build/libnspr-4.17/.stamp_*

不过实际过程中可能会有编译不过的情况出现,这个时候可以从其他路径下面拷贝需要的.stamp文件,这样就可以编译通过了。

或者可以执行make clean命令,清除output路径下的全部内容,不过重新编译的耗时会很长。

你可能感兴趣的:(Linux,RK3399,编译,linux,交叉编译)