创建bb file:
poky/meta/recipes-devtools/nativesdk-custom-ps1-setting/nativesdk-custom-ps1-setting.bb
$ vi ../../poky/meta/recipes-devtools/nativesdk-custom-ps1-setting/nativesdk-custom-ps1-setting.bb LICENSE = "CLOSED" inherit nativesdk do_generate(){ echo "export PS1=\"(yocto-sdk) \${PS1}\"" > ${B}/custom-ps1-setting.sh } do_install(){ install -d ${D}/environment-setup.d/ cp ${B}/custom-ps1-setting.sh ${D}/environment-setup.d/ } addtask generate PACKAGES = "${PN}" FILES_${PN} = "/"
do_generate() 创建文件:build/tmp/work/x86_64-nativesdk-pokysdk-linux/nativesdk-custom-ps1-setting/1.0-r0/custom-ps1-setting-1.0/custom-ps1-setting.sh
生成的rpm在:build/tmp/deploy/rpm/x86_64_nativesdk/nativesdk-custom-ps1-setting-1.0-r0.x86_64_nativesdk.rpm
生成SDK:
将nativesdk-custom-ps1-setting添加到build/conf/local.conf的TOOLCHAIN_HOST_TASK中:
TOOLCHAIN_HOST_TASK += "nativesdk-custom-ps1-setting"
编译修改后的SDK:
$ bitbake meta-toolchain WARNING: Host distribution "RedHatEnterpriseLinuxServer-7.5" has not been validated with this version of the build system; you may possibly experience unexpected failures. It is recommended that you use a tested distribution. Parsing recipes: 100% |##########################################################################################################################################################################| Time: 00:00:02 Parsing of 873 .bb files complete (0 cached, 873 parsed). 1303 targets, 49 skipped, 0 masked, 0 errors. NOTE: Resolving any missing task queue dependencies Build Configuration: BB_VERSION = "1.30.0" BUILD_SYS = "x86_64-linux" NATIVELSBSTRING = "universal" TARGET_SYS = "i586-poky-linux" MACHINE = "qemux86" DISTRO = "poky" DISTRO_VERSION = "2.1.3" TUNE_FEATURES = "m32 i586" TARGET_FPU = "" meta meta-poky meta-yocto-bsp = "krogoth:73cc31c11a9d75a2f4204a9a8c6832c6e505a86a" NOTE: Preparing RunQueue NOTE: Executing SetScene Tasks NOTE: Executing RunQueue Tasks NOTE: Tasks Summary: Attempted 733 tasks of which 731 didn't need to be rerun and all succeeded. Summary: There was 1 WARNING message shown. $ ls tmp/deploy/sdk/poky-glibc-x86_64-meta-toolchain-i586-toolchain-2.1.3.* -al -rw-r--r-- 1 ca root 49 May 23 14:39 tmp/deploy/sdk/poky-glibc-x86_64-meta-toolchain-i586-toolchain-2.1.3.host.manifest -rwxr-xr-x 1 ca root 14879818 May 23 14:39 tmp/deploy/sdk/poky-glibc-x86_64-meta-toolchain-i586-toolchain-2.1.3.sh -rw-r--r-- 1 ca root 1220 May 23 14:39 tmp/deploy/sdk/poky-glibc-x86_64-meta-toolchain-i586-toolchain-2.1.3.target.manifest
安装SDK:
$ ./tmp/deploy/sdk/poky-glibc-x86_64-meta-toolchain-i586-toolchain-2.1.3.sh Poky (Yocto Project Reference Distro) SDK installer version 2.1.3 ================================================================= Enter target directory for SDK (default: /opt/poky/2.1.3): /var/fpwork/alice/poky/build/poky_install You are about to install the SDK to "/var/fpwork/alice/poky/build/poky_install". Proceed[Y/n]? y Extracting SDK.................done Setting it up...done SDK has been successfully set up and is ready to be used. Each time you wish to use the SDK in a new shell session, you need to source the environment setup script e.g. $ . /var/fpwork/alice/poky/build/poky_install/environment-setup-i586-poky-linux
指定安装目录 -d:
$ ./tmp/deploy/sdk/poky-glibc-x86_64-meta-toolchain-i586-toolchain-2.1.3.sh -d /var/fpwork/alice/poky/build/poky_install -y
执行SDK环境变量设置脚本:
$ echo $CC [@hz-build-cloud-cbts02-okqvd build]$ source /var/fpwork/alice/poky/build/poky_install/environment-setup-i586-poky-linux [@hz-build-cloud-cbts02-okqvd build]$ echo $CC i586-poky-linux-gcc -m32 -march=i586 --sysroot=/var/fpwork/alice/poky/build/poky_install/sysroots/i586-poky-linux
tmp/
tmp/deploy/sdk/*.sh
tmp/deploy/ipk/
tmp/sysroots/*
tmp/environment-setup*
文章来源: https://blog.csdn.net/neu_xiaolu/article/details/90480614