yocto - 如何在 yocto 中将源文件添加到 PN-src 包中
问题描述
我为 Simple C 应用程序编写了一个基本配方
DESCRIPTION = "Simple helloworld C application"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
SRC_URI = "file://userprog.c \
file://function.c \
file://ReadMe.txt"
S = "${WORKDIR}"
do_compile() {
${CC} userprog.c function.c ${LDFLAGS} -o userprog
}
do_install() {
install -d ${D}${bindir}
install -m 0755 userprog ${D}${bindir}
install -d ${D}${docdir}
install -m 0644 ReadMe.txt ${D}${docdir}
}
包拆分文件夹上的树命令
tree packages-split/
packages-split/
├── myhello
│ └── usr
│ └── bin
│ └── userprog
├── myhello-dbg
│ └── usr
│ └── bin
├── myhello-dev
├── myhello-doc
│ └── usr
│ └── share
│ └── doc
│ └── ReadMe.txt
├── myhello-locale
├── myhello.shlibdeps
├── myhello-src
└── myhello-staticdev
因此,ReadMe.txt 会自动复制到“myhello-doc”包中。我应该对源文件进行哪些更改才能将其复制到“myhello-src”包中
当我将配方更改为使用 Makefile 时,它会自动添加到 src 包中
DESCRIPTION = "Simple helloworld C application"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
SRC_URI = "file://userprog.c \
file://Makefile"
S = "${WORKDIR}"
EXTRA_OEMAKE = "'DESTDIR=${D}/usr/bin' V=1"
do_install() {
oe_runmake install
}
生成文件:
# compiler flags:
# -g adds debugging information to the executable file
# -Wall turns on most, but not all, compiler warnings
CFLAGS = -g -Wall -DUSE_SYSCALL
# the name to use for both the target source file, and the output file:
TARGET = userprog
all: $(TARGET)
$(TARGET): $(TARGET).c
${CC} $(CFLAGS) -o $(TARGET) $(TARGET).c $(LDFLAGS)
install:
install -d $(DESTDIR)
install -m 0755 $(TARGET) $(DESTDIR)
clean:
rm -f $(TARGET)
uninstall:
rm $(DESTDIR)$(TARGET)
包拆分:
packages-split/
├── myhello4
│ └── usr
│ └── bin
│ └── userprog
├── myhello4-dbg
│ └── usr
│ └── bin
├── myhello4-dev
├── myhello4-doc
├── myhello4-locale
├── myhello4.shlibdeps
├── myhello4-src
│ └── usr
│ └── src
│ └── debug
│ └── myhello4
│ └── 0.1-r0
│ └── userprog.c
└── myhello4-staticdev
第一种方法和第二种方法有什么区别,以及如何将 userprog.c 文件添加到第二种方法中
解决方案
DESCRIPTION = "Simple helloworld C application"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
SRC_URI = "file://userprog.c \
file://function.c \
file://ReadMe.txt"
S = "${WORKDIR}"
do_compile() {
${CC} userprog.c function.c ${LDFLAGS} -o userprog
}
do_install() {
install -d ${D}${bindir}
install -m 0755 userprog ${D}${bindir}
install -d ${D}${docdir}
install -m 0644 ReadMe.txt ${D}${docdir}
install -d ${D}/src
cp -rf ${S}/*.c ${D}/src/
}
PACKAGES = "${PN} ${PN}-src ${PN}-doc"
FILES_${PN} = "
${bindir}/*
"
FILES_${PN}-src = "
/src/*
"
FILES_${PN}-doc = "
${docdir}/*
"
推荐阅读
- bluetooth - 是否有在 ble 中获取连接的远程设备名称的选项?
- javascript - 如何防止竖线中的图例在 Chart.js 中重叠?
- graphql - 使用 graphql union 返回一个包含一些空对象的数组
- php - 返回数据为空,但从模型设置时它工作
- list - 列表视图和详细视图的同步
- android - 如何在 MVVM 模式中从小部件与 db 交互
- php - 计算PHP中两个日期之间的差异?
- angular - 打字稿错误:“T”类型的参数不能分配给“数字”类型的参数?
- python - 使用 Bokeh 对数据框列进行交互式切片
- java - 无法在 Maven 项目中解析符号“TestUnit”