Accessing Linux From Linux
From WebOS Internals
Getting the code
git clone git://gitorious.org/webos-internals/precomd.git
Read the README once it's downloaded to learn how to compile.
The novacom executable that is built can perform 4 different functions:
- Terminal access
- Get files from the filesystem
- Put files onto the filesystem
- 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:
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
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 .
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.