title: How to add my own software to a Buildroot Linux package?
body: <p>I am trying to add my own program to a small linux, created with Buildroot.
  What I've done so far:</p>
  <ul>
  <li><p>I've created a new directory inside my 'buildroot/package/'  called 'HelloWorld'.
  Inside 'buildroot/package/HelloWorld' I have : a Config.in, HelloWorld.mk and HelloWorld directory.
  <em>Config.in</em> holds this:</p>
  <pre><code>     config BR2_PACKAGE_HELLOWORLD
       bool &quot;helloworld&quot;
       default y
       help
               Hello world component.
  </code></pre>
  </li>
  </ul>
  <p>HelloWorld.mk holds this:</p>
  <pre><code>HELLOWORLD_VERSION:= 1.0.0
  HELLOWORLD_SITE:= /home/userpc/Downloads/helloworld/
  HELLOWORLD_SITE_METHOD:=local
  HELLOWORLD_INSTALL_TARGET:=YES
  
  define HELLOWORLD_BUILD_CMDS
          $(MAKE) CC=&quot;$(TARGET_CC)&quot; LD=&quot;$(TARGET_LD)&quot; -C $(@D) all
  endef
  
  define HELLOWORLD_INSTALL_TARGET_CMDS
          $(INSTALL) -D -m 0755 $(@D)/helloworld $(TARGET_DIR)/bin
  endef
  
  define HELLOWORLD_PERMISSIONS
         /bin/helloworld f 4755 0 0 - - - - - 
  endef
  
  $(eval $(generic-package))
  </code></pre>
  <p>(inspiration <a href="http://buildroot-busybox.2317881.n4.nabble.com/Build-root-local-site-method-td34174.html" rel="nofollow noreferrer">source</a>)
  The HelloWorld directory contains: main.c &amp; Makefile:</p>
  <p><strong>main.c :</strong></p>
  <pre><code>#include &lt;stdio.h&gt;
  
  int main()
  {
          printf(&quot;\nMain entry.\n&quot;);
          return 0;
  }
  </code></pre>
  <p>Makefile:</p>
  <pre><code>CC=gcc
  CFLAGS=-I.
  
  all: *.c
          $(CC) -Os -Wall  *.c -o helloworld
  #       $(STRIP) helloworld
  
  clean:
          rm -f a.out helloworld
          rm -f *.o
  </code></pre>
  <p><strong>Edit</strong>: And I have also added source <em>&quot;package/HelloWorld/Config.in&quot;</em> to 'package/Config.in'
  But when I mount my rootfs.ext2 partition I can't find my HelloWorld executable inside /usr/bin .., I am really new to this and don't have any prior knowledge, so could you please explain to me, what am I missing from this, because I'm sure I'm doing something wrong.</p>
  <p><strong>UPDATE:</strong> The program builds and install at the desired location but when I try to run it like so: <code>./helloworld</code>, I get: <code>bash: ./helloworld: No such file or directory</code> It has execution rights. What is the matter with it? (I try to run it after I mount the rootfs.ext2 into a ubuntu directory, the target arch for buildroot is i386, so it should be ok, right?)</p>
  <p>After building and installing the HelloWorld program, and eventually running it, I'd like to add to init.d so it starts after booting, and replace the HelloWorld with a Qt Window that doesn't need a X server, like this thing <a href="http://qt-project.org/doc/qt-4.8/qt-embedded-linux.html" rel="nofollow noreferrer">here</a>.</p>
  <p>The main source of inspiration <a href="http://buildroot.uclibc.org/downloads/manual/manual.html#generic-package-reference" rel="nofollow noreferrer">here</a>.</p>