Creating an app bin

From WikiDLXTV
Jump to: navigation, search

When creating a custom app.bin you should follow these guidelines:

  • binaries should be placed in bin/ or sbin/ and not in usr/bin and usr/sbin
  • libraries should be placed in lib/ and not in usr/lib
  • modules should be placed in lib/modules/2.6.22.19-19-4
    • lib/modules/2.6.22.19-19-4 can contain a modules.dep file which will be added to /lib/modules/2.6.22.19-19-4/modules.dep for modprobe insertion of app.bin modules
  • etc/init.d/ contains the init scripts that will be called when the system boots and when /sbin/resume is executed
    • init.d scripts should contain at the minimum start and stop cases
    • only SXX scripts are executed during rcS


For example, I have test-app.app.bin containing the following structure:
README
version
bin/test-bin01
bin/test-bin02
etc/init.d/S10test-app-init
lib/test-lib01.so
lib/test-lib01.so.0.3.0
lib/modules/2.6.22.19-19-4/modules.dep
lib/modules/2.6.22.19-19-4/test-module.ko
lib/modules/2.6.22.19-19-4/test-dep.ko
sbin/test-sbin01
sbin/test-sbin02
usr/bin/ignored-bin01
usr/sbin/ignored-sbin01


Note:

  • The README file contains ancillary information and whatever required details/etc.
  • version contains the version of the app.bin


After test-app.app.bin is mounted by /bin/crazymount at /apps/test-app/ the following things happen:

  • /apps/test-app/bin and /apps/test-app/sbin are added to PATH
  • /apps/test-app/lib is added to ld.so.conf
  • ldconfig is refreshed
  • /apps/test-app/lib/modules/2.6.22.19-19-4 is scanned for modules and any found are symlinked into /lib/modules/2.6.22.19-19-4
  • /apps/test-app/lib/modules/2.6.22.19-19-4/modules.dep is cat'd onto the end of /lib/modules/2.6.22.19-19-4/modules.dep
  • /apps/test-app/etc/init.d/S10test-app-init is symlinked into /tmp/init.d for execution by rcS/suspend/resume


Now /apps/test-app/usr/bin and /apps/test-app/usr/sbin both contain binaries...but those two locations are not scanned, therefore binaries in both locations will not be available without full path.


I included two kernel modules inside of test-app.app.bin, here is the contents of /apps/test-app/lib/modules/2.6.22.19-19-4/modules.dep:
/lib/modules/2.6.22.19-19-4/test-module.ko: /lib/modules/2.6.22.19-19-4/test-dep.ko
/lib/modules/2.6.22.19-19-4/test-dep.ko:


This means that test-module.ko depends on test-dep.ko and therefore when test-module.ko is modprobe'd test-dep.ko will be inserted first by the system. Take note that the modules.dep file contains locations that are inside of /lib/modules/2.6.22.19-19-4 and not /apps/test-app/lib/modules/2.6.22.19-19.