Accessing Linux From Linux

From WebOS Internals
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
This page is deprecated.

Please follow the instructions on the Accessing Linux page instead.

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.

Getting the code

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

Read the README once it's downloaded to learn how to compile.

Using Precomd

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


Next Steps

Your rooted pre is in a very sensitive and unusual state. There are several steps you should take immidiately:

  • Create a new username and password so that you don't connect as root
  • Open up ports in the pre so that you can connect to it.
  • Create a secure connection so that your pre is not open to everyone in the universe. **If you do not secure the network, your device will be accessible by anyone on the internet until it is rebooted.**
  • Install the Optware package manager so that you can install software onto the Pre.

All this picks up in Next steps accessing linux .

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.