OPK

From GCW Zero Wiki
Jump to: navigation, search

OPK files consist of read-only SquashFS images containing binaries, assets and metadata. The metadata is stored in .desktop files. In freedesktop.org-compliant environments an application is registered automatically into the environment menus through a .desktop entry. Similarly, OPK files will be automatically listed in the apropriate category in GMenu2x, the current graphical environment of the GCW Zero.

Contents

Create an OPK file

OPK metadata

For an OPK to appear on the menu, it needs a metadata file to declare its content. This file is a standard .desktop file.

This file must be named ${NAME}.${ARCH}.desktop, where ${NAME} is commonly just 'default', and ${ARCH} must be 'gcw0' for the app to run on the GCW Zero. Thus, if you name it default.gcw0.desktop, you're good.

Important: The file must be written with Unix line endings, not DOS/Windows.

Note that one OPK can provide more than one of those metadata files; if two files with a different name but for the same platform are found, two icons will appear on the menu, one corresponding to each of the metadata files. On the other hand, having two metadata files corresponding to two different platforms will make your OPK work on those two platforms.

An minimal metadata file should contain the following fields:

 [Desktop Entry]
 
 Type=Application
 Name=Cool Game
 Comment=A super good game
 Exec=coolgame
 Icon=icon
 Categories=games;


For information about the different fields, have a look at the .desktop standard. Only the fields listed above are supported by OpenDingux's menu, plus those two:

  • Terminal, to select whether or not the application should launch in a terminal:
  Terminal=true
  • MimeType, which is a semicolon-separated list of the MIME types the application can open:
  MimeType=application/x-zip;application/x-gzip;

Note that if you want your app to open files, you will need the %f token at the end of the Exec= line; more information here.


Finally, you can add translations for the Name and Comment fields:

 Name=Cool Game
 Name[fr]=Super Jeu
 Name[es]=Buen Juego
 Comment=A super good game
 Comment[fr]=Un super bon jeu
 Comment[es]=Un juego super entretenido

OpenDingux-specific metadata

Some of the following fields can only be used on an OpenDingux system:

  • X-OD-Manual, to specify a manual file to open with the "view manual" option of gmenu2x:
 X-OD-Manual=readme.txt
  • X-OD-NeedsJoystick, to bind the internal controls of the GCW Zero to a joystick device instead of a keyboard:
 X-OD-NeedsJoystick=true
  • X-OD-NeedsGSensor, to bind the gravity sensor of the GCW Zero to a joystick device accessible alongside the joystick or keyboard:
 X-OD-NeedsGSensor=true
  • X-OD-NeedsDownscaling, to enable the hardware scaling of resolutions larger than 320x240 (up to 640x480):
 X-OD-NeedsDownscaling=true

Compression

Before starting mksquashfs must be installed.

The package name is squashfs-tools under Ubuntu, Debian, and Arch Linux.

mksquashfs is also provided within the toolchain.

 mksquashfs <dir> <file>.opk -all-root -noappend -no-exports -no-xattrs

<dir>

  • The directory, or folder, to be compressed.

<file>

  • The OPK file to be created.

Creating OPK Files using Windows

Open Package Creator 1.1
Main article: Open Package Creator

You can create an OPK file for the GCW Zero easily on Windows using an application called Open Package Creator. This application also handles creation of the OPK metadata.

| Download here