Tagadac
Tagadac

Reputation: 423

Permission denied Hello world Yocto/Openembedded

I want to cross compile with Yocto a simple C Hello World for my Colibri iMX7 from Toradex. The tree of my meta-hellow is as follow :

 meta-hellow
 ├── conf
 │   └── layer.conf
 └── recipes-myhello
     └── files
         └── helloworld.c
         └── README.TXT
     └── myhello_0.0.bb

helloworld.c :

#include <stdio.h>

int main(int argc, char** argv)
{
        printf("Hello World!\n");
        return 0;
}

myhello_0.0.bb inspired from this one :

DESCRIPTION = "Hello world program"
#To prevent the LICENSE field not set error
LICENSE = "CLOSED" 
PR = "r0"

SRC_URI = "file://helloworld.c \
           file://README.txt"

do_compile() {
        ${CC} ${CFLAGS} ${LDFLAGS} ${WORKDIR}/helloworld.c -o helloworld
}

do_install() {
        install -m 0755 -d ${D}${bindir} ${D}${docdir}/helloworld
        install -m 0644 ${S}/helloworld ${D}${bindir}
        install -m 0644 ${WORKDIR}/README.txt ${D}${docdir}/helloworld
}

I have added my layer in my my bblayers.conf like so ${TOPDIR}/../layers/meta-hellow \ and added the package in the local.conf like so IMAGE_INSTALL_append = "myhello".

But the problem I have, after installing it on my board with opkg install, is as follow :

root@colibri-imx7:~# myhello
-sh: /usr/bin/myhello: Permission denied

Why is there a Permission denied since I'm root ?

Thank you for your help !

Upvotes: 2

Views: 2430

Answers (1)

Jussi Kukkonen
Jussi Kukkonen

Reputation: 14607

install -m 0644 ${S}/helloworld ${D}${bindir}

You are telling install to set no execute permission for anyone: try "0755" instead.

Upvotes: 1

Related Questions