
WARNING: this article is unfinished, under revision and is not tested 100% yet. I do not issue any guarantee that this will work and maybe you can crash your system. I will update this article when all this process works fine. Keep in touch! Requeriments This guide assumes you’ve installed Ubuntu, Debian or another GNU/Linux distribution [...]
WARNING: this article is unfinished, under revision and is not tested 100% yet. I do not issue any guarantee that this will work and maybe you can crash your system. I will update this article when all this process works fine. Keep in touch!
Requeriments
This guide assumes you’ve installed Ubuntu, Debian or another GNU/Linux distribution on your Chromebook, and you’ve succesful installed a Chrome OS chroot environment on your local machine.
Please look at previous posts of this blog for install Ubuntu on your Chromebook, and follow this guide to install a Chrome OS chroot environment in your local machine: http://www.chromium.org/chromium-os/developer-guide
1. Install required packages for kernel compilation
If you are an experienced Linux user, you can skip this and go thru step 4.
First we update our package database:
Then we install some needed packages like this:
sudo apt-get install ncurses-dev wget bzip2
2. Getting the source
We are going to work with last stable (when writing this article) kernel version (Linux 3.1.1). But you should check the last stable kernel here: http://www.kernel.org
Then we unpack the kernel sources and create a symlink linux to the kernel sources directory:
sudo tar -xjvf linux-3.1.1.tar.bz2
3. Configuring and compiling the kernel
It’s a good idea to use the configuration of your current working kernel as a basis for your new kernel. After copying the .config file we run:
sudo make menuconfigConfigure the kernel at your choice, save and exit.
Processor type and features --->
[*] Symmetric multi-processing support
Processor family (Intel Atom) --->
[*] Enable DMI scanning
[*] EFI runtime service support
Power management and ACPI options --->
[*] Suspend to RAM and standby
[*] Run-time PM core functionality
CPU Frequency scaling --->
x86 CPU frequency scaling drivers --->
< *> ACPI Processor P-States driver
-*- CPU idle PM support
Bus options (PCI, PCMCIA, EISA, MCA, ISA) --->
[*] PCI support
[*] PCI Express support
Networking --->
<m> Bluetooth subsystem support --->
Bluetooth device drivers --->
</m><m> HCI USB driver
-*- Wireless --->
</m><m> cfg80211 - wireless configuration API
[*] enable powersave by default
[*] cfg80211 DebugFS entries
[*] cfg80211 wireless extensions compatibility
{M} Common routines for IEEE802.11 drivers
</m><m> Generic IEEE 802.11 Networking Stack (mac80211)
[*] Minstrel
[*] Minstrel 802.11n support
[*] Export mac80211 internals in DebugFS
File systems --->
Partition Types --->
[*] Advanced partition selection
[*] EFI GUID Partition support
Device Drivers --->
SCSI device support --->
< *> SCSI disk support
< *> Serial ATA and Parallel ATA drivers --->
[*] ATA ACPI Support
< *> AHCI SATA support
[*] ATA SFF support
[*] ATA BMDMA support
< *> Intel ESB, ICH, PIIX3, PIIX4 PATA/SATA support
< *> Generic ATA support
[*] Network device support --->
[*] Wireless LAN --->
</m><m> Atheros Wireless Cards --->
[*] Atheros wireless debugging
</m><m> Atheros 802.11n wireless cards support
[*] Atheros ath9k PCI/PCIe bus support
[*] Atheros ath9k debugging
[*] Atheros ath9k rate control
Input device support --->
[*] Mice --->
< *> PS/2 mouse
[*] Synaptics PS/2 mouse protocol extension
Hardware I/O ports --->
-*- Serial I/O support
-*- i8042 PC Keyboard controller
-*- PS/2 driver library
< *> Raw access to serio ports
-*- I2C support --->
I2C Hardware Bus support --->
</m><m> Intel 82801 (ICH/PCH)
< *> Hardware Monitoring support --->
< *> Intel Core/Core2/Atom temperature sensor
-*- Generic Thermal sysfs driver --->
[*] Hardware monitoring support
</m><m> Multimedia support --->
[*] Video capture adapters --->
</m><m> Video For Linux
[*] V4L USB devices --->
</m><m> USB Video Class (UVC)
Graphics support --->
< *> /dev/agpgart (AGP Support) --->
< *> Intel 440LX/BX/GX, I8xx and E7x05 chipset support
< *> Direct Rendering Manager (XFree86 4.1.0 and higher DRI support) --->
< *> Intel 8xx/9xx/G3x/G4x/HD Graphics
[*] Enable modesetting on intel by default
-*- Lowlevel video output switch controls
[*] Backlight & LCD device support --->
-*- Lowlevel Backlight controls
< *> Generic (aka Sharp Corgi) Backlight Driver
< *> Sound card support --->
< *> Advanced Linux Sound Architecture --->
[*] PCI sound devices --->
</m><m> Intel HD Audio --->
[*] Build HDMI/DisplayPort HD-audio codec support
[*] Aggressive power-saving on HD-audio
[*] USB sound devices --->
</m><m> USB Audio/MIDI driver
[*] USB support --->
{*} Support for Host-side USB
[*] USB runtime power management (autosuspend) and wakeup
< *> EHCI HCD (USB 2.0) support
< *> OHCI HCD support
< *> UHCI HCD (most Intel and VIA) support
< *> USB Mass Storage support
< *> Realtek Card Reader support
[*] The shared table of common (or usual) storage devices
</m>
sudo make -j `cat /proc/cpuinfo | grep processor | wc -l`I assume you’ve a GNU/Linux distribution running on your Chromebook, so we’re going to get the same kernel parameters that we’re using on our Chromebook device:
cat /proc/cmdlineconsole=tty1 init=/sbin/init add_efi_memmap boot=local rootwait ro noresume noswap i915.modeset=1 loglevel=7 kern_guid=%U tpm_tis.force=1 tpm_tis.interrupts=0 root=/dev/sda7 noinitrdecho "console=tty1 init=/sbin/init add_efi_memmap boot=local rootwait ro noresume noswap i915.modeset=1 loglevel=7 kern_guid=%U tpm_tis.force=1 tpm_tis.interrupts=0 root=/dev/sda7 noinitrd” > config.txtMore easy: cat /proc/cmdline > config.txt, but you should check what parameters are you passing to kernel.
Basically, you should change the kern_guid to %U, check if the rootfs path is correct, change the loglevel to 7 and check if console is tty1.
Into our chroot environment we need to build and sign the kernel image like this:
--keyblock /usr/share/vboot/devkeys/kernel.keyblock \ --signprivate /usr/share/vboot/devkeys/kernel_data_key.vbprivk \ --version 1 \ --config config.txt \ --vmlinuz bzImage \ --bootloader /lib64/bootstub/bootstub.efi6. Copying the kernel blob and prioritizing partitions
Now we’ve to copy the kernel blob on a valid kernel partition of our device. We are going to use KERN-C partition as /dev/sda6:
sudo dd if=kern.bin of=/dev/sda6This article isn’t finished yet and will be updated !!









18 Responses
Regarding:
It’s a good idea to use the configuration of your current working kernel as a basis for your new kernel.
Where can one get an appropriate config file?
Have looked around on this site and on a Chromebook with Debian GNU/Linux installed as per:
http://www.chromebook-linux.com/2011/11/shell-script-to-easy-install-gnulinux.html
but didn’t have any success.
I’d like to build a custom kernel to make use of a USB-Ethernet device — it uses pegasus.ko, but that doesn’t appear to get installed via the aforementioned instructions.
Thanks for any help
Getting the kernel configuration is a little tricky, maybe the best approach will be to use the config files from chromium chroot.
Check here: http://www.chromium.org/chromium-os/how-tos-and-troubleshooting/kernel-configuration
And here for installing developer chroot: http://www.chromium.org/chromium-os/developer-guide
Thanks for the response.
I’ve been trying to set up the developer chroot, but I’ve been getting errors during the chroot construction on my last few attempts. When I get access to the environment where I’ve been trying, I’ll try to retain the error output. Better still, may be a subsequent attempt will lead to success…
BTW, I noticed that chrolin-usb.tar.bz2 contains kernel-2.6.38.3.bin and related modules — would it be possible to bundle the kernel config used to create those pieces? Are there some reasons that is impractical / undesirable / etc.?
Thanks again.
kernel 2.6.38.3 was the stable version when I created the scripts, I’m a bit outdate about the last kernel version for Chromebook’s.
Chroot environment will give a newer kernel config file which doesn’t fit the current 2.6.38.3 kernel, so I’m afraid I can’t get the current config file of this kernel version.
Best way would be to compile manually from chroot environment a newer kernel for your architecture.
I wish to have more time to update all scripts, kernel and modules, but right now I’m leading a new project which requires all my attention. Anyway if you have any question feel free to ask here and I’ll reply asap.
Thanks for the explanation.
Below is the output (ending in errors) of running ./chromite/bin/cros_sdk in a chromiumos directory (after having run repo init for a minilayout followed by repo sync).
Any ideas what might be up?
Attempting download: https://commondatastorage.googleapis.com/chromiumos-sdk/cros-sdk-09.06.12.161048.tbz2
23:26:40: INFO: RunCommand: ['curl', '-f', '-L', '-y', '30', '--output', '/media/prepchromedeb/chromiumos/sdks/cros-sdk-09.06.12.161048.tbz2', 'https://commondatastorage.googleapis.com/chromiumos-sdk/cros-sdk-09.06.12.161048.tbz2']
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 549M 100 549M 0 0 6114k 0 0:01:32 0:01:32 –:–:– 6379k
INFO cros_sdk: Unpacking STAGE3…
INFO cros_sdk: Set timezone…
INFO cros_sdk: Adding user/group…
INFO cros_sdk: Setting up mounts…
INFO cros_sdk: Running init_setup()…
INFO cros_sdk: Setting up hosts/resolv…
INFO cros_sdk: Setting up /etc/make.*…
INFO cros_sdk: Running post-inst configuration hacks
>>> Regenerating /etc/ld.so.cache…
lrwxrwxrwx 1 root root 88 2012-06-09 23:31 /etc/make.conf -> /home/mint/trunk/src/third_party/chromiumos-overlay/chromeos/config/make.conf.amd64-host
lrwxrwxrwx 1 root root 63 2012-06-09 23:31 /etc/make.profile -> /usr/local/portage/chromiumos/profiles/default/linux/amd64/10.0
/usr/local/portage/chromiumos/profiles/default/linux/amd64/10.0:
total 32
drwxr-xr-x 2 mint chronos 4096 2012-06-09 23:22 chromeos
drwxr-xr-x 2 mint chronos 4096 2012-06-09 23:22 desktop
drwxr-xr-x 2 mint chronos 4096 2012-06-09 23:22 developer
-rw-r–r– 1 mint chronos 2 2012-06-09 23:22 eapi
-rw-r–r– 1 mint chronos 410 2012-06-09 23:22 make.defaults
drwxr-xr-x 2 mint chronos 4096 2012-06-09 23:22 no-multilib
-rw-r–r– 1 mint chronos 29 2012-06-09 23:22 parent
drwxr-xr-x 2 mint chronos 4096 2012-06-09 23:22 server
Copying ~/.gitconfig into chroot
INFO cros_sdk: Updating portage
Performing Global Updates
(Could take a couple of minutes if you have a lot of binary packages.)
>>> Jobs: 0 of 0 complete Load avg: 1.49, 1.06, 0.74
INFO cros_sdk: Updating host toolchain
>>> Jobs: 0 of 0 complete Load avg: 1.49, 1.06, 0.74
Determining required toolchain updates…
Nothing to update!
Nothing to clean!
INFO cros_sdk: Deselecting dhcpcd
>>> No matching atoms found in “world” favorites file…
INFO cros_sdk: Running emerge curl sudo …
Starting fast-emerge.
Building package pbzip2 net-misc/curl sudo on root
Calculating deps…
Deps calculated in 0m1.4s
Total: 0 packages, Size of downloads: 0 kB
Done
sudo: must be setuid root
sudo: must be setuid root
/home/mint/trunk/src/scripts/run_chroot_version_hooks: line 33: /etc/cros_chroot_version: Permission denied
INFO : Chroot of unknown version, initializing to 0
sudo: must be setuid root
sudo: must be setuid root
/home/mint/trunk/src/scripts/run_chroot_version_hooks: line 33: /etc/cros_chroot_version: Permission denied
cat: /etc/cros_chroot_version: No such file or directory
ERROR : Your chroot version file /etc/cros_chroot_version is bogus:
ERROR : script called: ‘–skip_toolchain_update’ ‘–usepkg’ ‘–fast’
ERROR : Backtrace: (most recent call is last)
ERROR : file update_chroot, line 46, called: die_err_trap ‘${SCRIPTS_DIR}/run_chroot_version_hooks’ ’1′
ERROR :
ERROR : Command failed:
ERROR : Command ‘${SCRIPTS_DIR}/run_chroot_version_hooks’ exited with nonzero code: 1
ERROR : (Note bash sometimes misreports “command not found” as exit code 1 instead of 127)
Running ['/media/prepchromedeb/chromiumos/src/scripts/sdk_lib/make_chroot.sh', '--stage3_path', '/media/prepchromedeb/chromiumos/sdks/cros-sdk-09.06.12.161048.tbz2', '--chroot', '/media/prepchromedeb/chromiumos/chroot'] failed!
First of all make sure you’re not behind a proxy server, if you’re behind a proxy server check this additional notes: http://code.google.com/p/chromium-os/issues/detail?id=10048
You did repo checkout in your home folder? If not, had full permissions on that directory? Because it looks like ‘make’ files are hardcoded to be in home folder directory
Thanks for the hints.
I created a new user to work as, and following a modified set of instructions seems to have done the trick. Hurray
Explicitly performing the instructions:
git config –global user.email “[email protected]”
git config –global user.name “Your Name”
didn’t seem to be necessary before (I did get cros_sdk to work once previously) — but they appear to be necessary now. I think running repo init before would prompt if necessary, but now instructions to run git config are mentioned instead.
Any hints on the next steps to perform to eventually end up with a kernel config? I’m using an original Samsung Series 5 Chromebook FWIW.
Thanks again!
The notes on this article comes to an investigation to install GRUB on Samsung Series 5, then can easy switch between kernels, that was my first idea.
Unfortunately, I ran into a biggest problem: console output is disabled on BIOS, so no output from GRUB on Samsung Series 5 and Acer 700.
In your case, I would follow the official guide to extract the kernel config, then you can recompile as usual and copy the kernel to Chromebook to run your new kernel automatically.
Wasn’t quite sure what following the official guide meant, but I continued along “4. Building Chromium OS”:
1. After snooping around a bit, decided to try the following for selecting a board: export BOARD=x86-alex
2. For initializing the build for the board: ./setup_board –board=${BOARD}
3. Setting the chronos user password: ./set_shared_user_password.sh
4. Building the packages for the board: ./build_packages –board=${BOARD}
Since the hardware I’m using is some years old with only two cores, I started poking around during the building. I found:
~/chromiumos/chroot/build/x86-alex/tmp/portage/sys-kernel/chromeos-kernel-3.4-r958/work/chromeos-kernel-3.4/build/x86-alex/.config
Do you think this is what I’m looking for? It looks like a kernel config file to me:
http://pastebin.com/raw.php?i=0UdXmL7E
Thanks for your ongoing help.
After around 140 minutes, the packages finished building
Within the chroot, found:
/build/x86-alex/boot/config-3.4.0
The file appears to be identical to the .config I found earlier.
Wanted to also leave a record that the following page was helpful in determing the board choice:
http://www.chromium.org/chromium-os/developer-information-for-chrome-os-devices
That page had a table which when viewed along with the contents of the ~/trunk/src/overlays/ helped to narrow down a choice.
Now I hope that choice was decent…
I’m trying to modify chrolin-usb.sh to work with the newly built kernel and modules. I’ve replaced the kernel file and the modules directory with newly built content and (hopefully) appropriately replaced references to those bits within the script.
When I run the modified script, I get:
[...]
- Signing kernel 3.4.0+ with config.txt…
ERROR: key_block_size advances past the end of the blob
I presume that output is from:
$VBUTIL_KERNEL –repack kernel-3.4.0.bin.new –config $KERNEL_ARGS –signprivate kernel_data_key.vbprivk –oldblob kernel-3.4.0.bin || exit $?
Any hints as to what’s going on? Also, is there any more information I should provide?
You need to sign your new kernel manually with -pack instead of -repack. IIRC that was the command, will check when I back home
Okay, I’m at home now, I’m going to tell you a bit more about this kernel.
Your Chromebook needs a signed kernel to boot, so if you directly copy your generated kernel without signing will not work. For this reason, we need to generate a kernel blob, which is a container of: your new kernel, kernel params, and some other data.
On chrolin-usb.sh you already have this kernel blob, because the stock kernel blob is provided, so If you change the kernel parameters you just need to repack to update the kernel parameters (because you can modify them on config.txt file).
But, in your case, you need to generate this kernel blob before, so you need to use the vbutil_kernel with –pack argument.
Check at point 5 of this webpage, on: 5. Build and sign the kernel image to see an example.
You can found more info about this tool on Chromium official website: http://www.chromium.org/chromium-os/chromiumos-design-docs/disk-format
Thanks for the pointers — they appear to have helped appropriately.
Just booted a USB device with Linux kernel version 3.4.0 — and the USB-Ethernet device works too
The following link should lead to a modified chrolin-usb tar ball:
http://www38.zippyshare.com/v/60403856/file.html
SHA1SUM: 1cc742011adb0fcde86079642cb54fe93c895a3d
Apart from using kernel version 3.4.0, there is a modification to one of the dd invocations so one of the zeroings should be faster (it’s about 5 times faster here — taking the script execution time down from over 3 hours to a little over an hour for a particular USB device).
Thanks for all of your help!
I’m glad it was useful!
Thank you very much for sharing the upgrade. With your permission, I’m going to publish this update of kernel and scripts to download site, so if you give me some name I’ll add you to credits, or will be anonymous
Permission granted
I hope the changes work appropriately and anonymous is fine!
Thanks again for your help.
First of all thanks for your work! I want to ask you if it’s possible to share the kernel headers / kernel sources? for me would have been useful because i tried to install virtual box on my debian chromebook and for dkms kernel module is necessary the kernel headers
Thanks in advance!
Although I’m still figuring out the modules I have managed to install a custom Kernel (3.7.1) and install it onto my Acer C7 Chromebook. Desktop came up fine (and seemed faster) but wireless wasnt working so back to the old kernel while i figure things out