Custom ChromeOS kernel with Docker support

487 views
Skip to first unread message

Dave Noel

unread,
Oct 16, 2017, 1:09:11 AM10/16/17
to Chromium OS dev
I'm new to ChromeOS, so I'm not even sure this is possible.

I have my chromebook(intel based) in developer mode with Crouton installed.  I can do most things I need to do but I would like to run docker containers as well.  

It looks like the ChromeOs kernel from Google does not have have the options compiled in that the docker daemon needs (mount sym links, etc.)  What I want to do is compile the exact same version of the kernel that is already on my machine but turn on the required flags for docker. Once the image is built I want to replace the active kernel partition(A or B, it looks like ChromeOS toggles back and forth through the auto update process?) with my kernel.  I want to continue to use the existing root partition(I don't want to install custom versions of chrome or install custom keys to access google APIs) with my new kernel.  It sounds like the kernel modules are installed on the root file system and I may run into problem if the version of gcc used to compile the modules does not match the version to compile the kernel.  If this approach works I imagine I would loose my kernel on each auto update and I would need to build a new one with the new kernel source.

This seems like quite a bit of work to figure out if this will work.  Does anyone know if this sounds feasible?  In the end I'm looking for a Google version of ChromeOS with Android support, Crouton and Docker.

Thanks

Dave  

Mike Frysinger

unread,
Oct 16, 2017, 9:52:40 AM10/16/17
to Dave Noel, Chromium OS dev
yes, it's feasible

can you enumerate the set of kernel config options you're looking to turn on relative to the current CrOS kernel ?
-mike

--
--
Chromium OS Developers mailing list: chromiu...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-os-dev?hl=en


Craig Bergstrom

unread,
Oct 16, 2017, 11:29:05 AM10/16/17
to Mike Frysinger, Dave Noel, Chromium OS dev
If you want to learn how to do this and you're willing to document it, reach our to me via chat and I'll walk you through the process.

---
You received this message because you are subscribed to the Google Groups "Chromium OS dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-os-dev+unsubscribe@chromium.org.

kr...@flintos.io

unread,
Oct 16, 2017, 12:01:09 PM10/16/17
to Chromium OS dev
Hi Dave,

I'm aware of what kernel configuration changes is required, and how to build docker for chromium OS. In fact, it is going to be included in the next release of our Chromium OS based OS, Flint OS. I've been running it on my test system for a couple of weeks and it runs great.

I'm understand that you would like to keep the original Chrome OS as is as much as possible. That probably is doable but different from my approach. I'm still listing what I did as below, just for your reference.

First, follow the Chromium OS developer guide to setup local Chromium OS build environment. Once that is done, find out the board name of the Chromebook from /etc/lsb-release and setup board, build package, build image for it.

Then tweak the kernel configurations to enable some options docker requires to run. Gentoo Wiki is a good resource on this: https://wiki.gentoo.org/wiki/Docker

Then port ebuilds of docker and its dependencies from Gentoo portage tree to the board, and build docker. There are a few patches required to make docker and runc package compatible with how cgroup fs is mounted in Chromium OS. I also created docker upstart script to start the docker daemon on startup, with some required pre-start operations.

Finally a Chromium OS image can be built, with the kernel that support docker and the docker program itself included. Install it on the Chromebook and it's done.

There are many commands to run and many problems to solve. If you are a experienced Linux user you will find it is a bit complex but not too hard to work with. If you have questions, just ask here and I'm sure many people will be glad to help.

Dave Noel

unread,
Oct 16, 2017, 1:07:40 PM10/16/17
to Mike Frysinger, Chromium OS dev
Mike,

I found this link on the web.


I was going to start with those settings and see how it goes.

Dave

Mike Frysinger

unread,
Oct 16, 2017, 3:08:48 PM10/16/17
to Dave Noel, Chromium OS dev
pretty sure the changes from =m to =y aren't really needed.  those should be usable with a modprobe rather than hacking the source.

the mount symlink option is behind a kernel config option now (CONFIG_SECURITY_CHROMIUMOS_NO_SYMLINK_MOUNT), so you don't need to edit the source files to disable it.  there is no runtime knob for that currently.

for CONFIG_MACVLAN, it looks like turning it on as a module is possible, which should limit the impact on the kernel/runtime when it's disabled.  if that's the case, then we could change that to CONFIG_MACVLAN=m in the default configs.

that leaves us with a bunch of cgroup related options which can't be built as modules:
CONFIG_BLK_CGROUP
CONFIG_CGROUP_DEBUG
CONFIG_CGROUP_PERF
CONFIG_MEMCG
CONFIG_MEMCG_SWAP

for each of these options, if we could get a sense of how much overhead they incur, both on disk and at runtime, we can see about turning them on by default.  but someone would have to do that analysis.
-mike

Richard Fisher

unread,
Feb 18, 2018, 11:26:19 PM2/18/18
to Chromium OS dev
Hi,

Are your flintos versions of the docker and runc ebuilds available anywhere?

gi...@flintos.io

unread,
Feb 21, 2018, 10:06:05 AM2/21/18
to Chromium OS dev
Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages