Accessing Linux From Linux

From WebOS Internals
Revision as of 03:59, 20 July 2009 by Hopspitfire (talk | contribs)
Jump to navigation Jump to search

Getting a root prompt using Linux

Some reverse engineering effort has been made to write a multi platform open source driver for the novacom protocol. The project is hosted at the webos-internals gitorious repository.

The novacom executable that is built can perform 4 different functions:

  1. Terminal access
  2. Get files from the filesystem
  3. Put files onto the filesystem
  4. Execute commands

Root is required to claim the USB interface.

To get a terminal, simply connect your pre to the USB port with dev mode enabled, and run:

sudo ./novacom

Terminal access is the default mode for the executable at the current time. This may change in the future.

NOTE: All key commands are sent to the device! This means ^C, escape, etc are NOT interpreted by the program running. This also means that if you get into a bad state on your pre, you need to locally kill the novacom executable from another terminal since it won't respond to keyboard signals.

To execute commands:

sudo ./novacom run "file://[file] [arguments]"

NOTE: The arguments are not very robust so performing actions on files that have spaces in the name or complex expressions is not recommended or supported.

To get or put files:

sudo ./novacom [get|put] file://[file]

When specifying a file, this is always on the device. When the action is to get a file, the file is opened on the device and the contents are output to stdout. Redirect stdout to your local file.

For example, to get /etc/passwd and put it in device_passwd on your host computer:

sudo ./novacom get file:///etc/passwd > device_passwd

Similarly, when putting a file, the file:// URI defines where on the device you want to put the file. The file contents are read from stdin, so recirection is required.

For example, to put local file called package.ipk to /tmp:

sudo ./novacom put file:///tmp/package.ipk < package.ipk

Getting the code

git clone git://gitorious.org/webos-internals/precomd.git

Read the README once it's downloaded.

Problems

If you get errors stating that usb.h cannot be found, it's probably because you don't have libusb-dev. Make sure you install libusb-dev and it is in your include and library paths when compiling.

If you stop the program and re-start it quickly, the previous session may not have timed out yet. You will see messages stating that we are awaiting an ACCOUNCEMENT packet and not sending a NOP reply. This will last no longer than 10 seconds. Please be patient.

  • Ported by hopspitfire