FAQ_MA35D1_Add a New Recipe in Yocto
Posted: 22 Nov 2022, 14:05
This sample show how to create a recipe which can compile a source and install to MA35D1 Image
1. Create a new folder named helloworld under meta-ma35d1/recipes-support
2. Create a new folder named files under helloworld folder
3. Create a C file named helloworld.c and the content is shown below
4. Create a bb file named helloworld.bb and the content is shown below
5. Add the recipe to ~/build/conf/local.conf
6. Rebuild the image and the helloworld will be in the /usr/bin
#MA35D1 #recipe #Yocto
1. Create a new folder named helloworld under meta-ma35d1/recipes-support
Code: Select all
~/shared/yocto/sources/meta-ma35d1/recipes-support$ mdkir helloworld
Code: Select all
~/shared/yocto/sources/meta-ma35d1/recipes-support/hello$ mkdir files
Code: Select all
#include <stdio.h>
int main()
{
printf("Hello, World!\n");
return 0;
}
Code: Select all
SUMMARY = "Demo how to compile a C code and add to root filesystem"
LICENSE = "CLOSED"
SRC_URI = "file://helloworld.c \
"
S = "${WORKDIR}"
do_compile() {
${CC} helloworld.c -o helloworld
}
do_install() {
install -d ${D}/${bindir}
install -m 0777 ${S}/helloworld ${D}${bindir}/helloworld
}
INSANE_SKIP_${PN} += "ldflags"
FILES_${PN} = "${bindir}"
Code: Select all
IMAGE_INSTALL_append += " helloworld "
#MA35D1 #recipe #Yocto