This project aims to add a package manager to ChromeOS running on Cr-48. At present there are only two ways to install native Linux applications:
- Build a ChromiumOS image and customize its packages,
- Install a real Linux distro.
The first approach is powerful but inflexible. After you've built the image and boot the computer, you can no longer add new programs due to ChromeOS' security policy. ChromeOS mounts writable partions as non-executable, and executable partitions as non-writable. Did I mention setting up the build environment is intimidating too?
The second approach is somewhat tedious, and throws all the ChromeOS goodness away.
Since I am new to this ChromeOS thing, and I've been away from Debian for a while, I need your help to make this project succeed.
I chose to port dpkg
/apt
from Ubuntu Karmic, because its glibc
2.10.1 matches the version on ChromeOS. Using any rolling distro on
top of ChromeOS is impossible, although I like Debian and Arch so much
more.
# Turn off rootfs verification
sudo /usr/share/vboot/bin/make_dev_ssd.sh --remove_rootfs_verification
sudo reboot
sudo mount -o remount,rw /
# Remount /var exec because dpkg wants to execute scripts extracted from .deb files
# This command must be run after each reboot
sudo mount -o remount,exec /var
# Download dpkg's data.tar.gz from Ubuntu Karmic, extract it to / to get the dpkg binary
cd /; sudo tar zxf /path/to/data.tar.gz
# Create files needed by dpkg
sudo touch /var/lib/dpkg/status /var/lib/dpkg/available
# Copy ldconfig and update-rc.d, they are needed by dpkg
# Satisfy dpkg's dependencies by installing fake debs
# Install dpkg.deb for real
# Install apt.deb and copy /etc/apt
To download a .deb file, run sudo apt-get -d install --reinstall foo
and you'll find /var/cache/apt/archives/foo*.deb
.
Before you apt-get install
a program, double check if it's pulling
in any dependency that will overwrite existing files. Doing so
may break the login manager, the browser, or any other critical
program. I've created a simple tool TestPkg
:
$ ./tools/TestPkg ocaml
["camlp4","ledit","libncurses5-dev","libpthread-stubs0","libpthread-stubs0-dev","libx11-dev","libxau-dev","libxcb1-dev","libxdmcp-dev","ocaml-base","ocaml-base-nox","ocaml-interp","ocaml-nox","x11proto-core-dev","x11proto-input-dev","x11proto-kb-dev","xtrans-dev"]
I'll be updating the wiki for compatible programs.
Modifying your root file system will most likely disable ChromeOS' auto update. Overwriting existing libraries may make your system fail to start. But good thing is you're always able to restore to factory setting.
I've created a simple tool FakePkg
that automates the process of
generating fake packages. Simply add the name of the package to
fake-debs/build-debs.sh
. If you've tested a fake package can be
safely added, please send me a pull request and explain what real
package was safely installed that requires the fake package you added.
You're also welcome to improve my simple tools, or report which packages can be safely installed.
I admit my approach is an ugly hack and if you know a better solution please let me know.
ChromiumOS manages packages based on Gentoo's portage system. Its
overlay can be viewed on the web
and cloned from
http://git.chromium.org/git/chromiumos-overlay
. chromeos/scripts/setup_board
sets the version of the system packages such as glibc.
To get an overview of the packages, we can run ls *
at the top
level. The structure resembles Gentoo a lot, except that many packages
are removed. In fact I believe the ebuilds are taken from Gentoo
directly. ChromeOS-specific ebuilds are found under chromeos-base/
.
When you emerge the virtual package
chromeos
(there are some variants like chromeos-dev and
chromeos-factoryinstall), image building starts and dependencies are
pulled in. Unfortunately, while the package manager (sys-apps/portage
)
and the toolchain (sys-devel/
) are in the portage, they don't get built into
the image.
The stock system on cr-48 seems to be built from ChromiumOS'
0.9.128.B
branch (B for beta?), with some changes (some dev packages
removed, and some proprietary drivers added).
Another important piece of code is the verified bootloader and the disk
management utilities, available via git
at http://git.chromium.org/git/vboot_reference
.
For more information, see
http://www.chromium.org/chromium-os/developer-guide
http://www.chromium.org/tips-and-tricks-for-chromium-os-developers
http://www.chromium.org/chromium-os/how-tos-and-troubleshooting
http://www.chromium.org/chromium-os/building-chromium-os/directory-structure
- Port more packages
- Write scripts for auto installation
- Improve the workflow