下面是一个简单的Bitbake/Yocto脚本任务的解决方案:
$ cd /path/to/yocto/recipes-example
$ mkdir hello
$ cd hello
$ touch hello.bb
SUMMARY = "Hello World"
LICENSE = "MIT"
SRC_URI = "file://hello.sh"
do_install() {
install -d ${D}${bindir}
install -m 0755 ${WORKDIR}/hello.sh ${D}${bindir}
}
FILES_${PN} += "${bindir}/hello.sh"
$ touch hello.sh
#!/bin/sh
echo "Hello, World!"
$ cd /path/to/yocto/build-dir
$ source poky/oe-init-build-env
$ bitbake hello
构建完成后,可以在构建目录下的tmp/deploy目录中找到生成的hello包(例如,hello_1.0-r0_corei7-64.rpm)。
将hello包安装到目标设备上:
$ scp @:/hello_1.0-r0_corei7-64.rpm .
$ ssh @
$ sudo rpm -i hello_1.0-r0_corei7-64.rpm
$ hello
Hello, World!
这是一个简单的Bitbake/Yocto脚本任务的示例,可以根据实际需求进行修改和扩展。