Wednesday, February 18, 2015

Chromebook HP 14

Chrome and Chromium OS Introduction

Chromium OS

o (Complete introduction for developers)

Difference between Chromium OS and Google Chrome OS
o    Chromium OS
o    Google Chrome OS
o    Chromium Browser Vs. Google Chrome
o    High-level developer FAQ
o    Chromium OS FAQ


o    Getting developer hardware
o    Developer hardware list

The Chromium Project

Chromium OS developer Guide
The key document for building Chromium OS

ChromiumOS Image Build

Inside host Coding Ununtu VM

Install git, subversion, and curl and ncurses-dev for kernel menu config
$ sudo apt-get install git-core gitk git-gui subversion curl ncurses-dev
Install depot_tools
  • Get a copy of the full layout
NOTE : If repo init would fail with the following error sometimes -
gpg: Signature made Tue 22 Oct 2013 11:23:31 AM PDT using RSA key ID 18275935
gpg: Can't check signature: public key not found
error: could not verify the tag 'v1.11.1-cr4'
If so, that means the incorrect repo is being picked up by the build environment. Instead of the common repo in ~/bin/ folder,
ChromiumOS needs repo version in repot_tools path. Correct the $PATH to pick the correct repo.
~/chromiumos$ ./depot_tools/repo sync
Create a chroot
~/chromiumos$  ./depot_tools/cros_sdk // create chroot by downloading and seting up a prebuilt chroot from ChromiumOS mirrors and enter the chroot
Enter the chroot
~/chromiumos$ ./chromiumos/depot_tools/cros_sdk
or ~/trunk/src/scripts/sdk_lib/sudo ./ --chrome_root=~/truck --cache_dir=~/trunk/.cache/distfiles/ccache/

Inside chrooted environment - YOU ARE NO LONGER on the HOST shell but inside a chrooted JAIL

Select a board
Building Chromium OS produces a disk image (usually just called an "image") that can be copied directly onto the boot disk of a computer intended to run Chromium OS.  Depending on the specifics of that computer, you may want different files in the disk image. For example, if your computer has an ARM processor, you'll want to make sure that all executables in the image are compiled for the ARM instruction set. Similarly, if your computer has special hardware, you'll want to include a matching set of device drivers.
Different classes of computers are referred to by Chromium OS as different target "boards"  The following are some example boards:
  • x86-generic - builds a generic image suitable for computers with a x86-compatible CPU (32 bit)
  • amd64-generic - builds a generic image suitable for computers with a x86_64-compatible CPU (64 bit)
  • arm-generic - builds a generic image suitable for computers with an ARM CPU (32 bit)
You need to choose a board for your first build. Don't worry too much about this choice – you can always build for another board later. If you want a list of known boards, you can look in ~/trunk/src/overlays.
Each command in the build processes takes a --board parameter.  To facilitate this, it can be helpful to keep the name of the board in a shell variable. This is not strictly necessary, but if you do this, you can simply copy and paste the commands below into your terminal program. Enter the following inside your chroot (note: change x86-generic to whatever board you want to build for):

For HP Chromebook - 14-x010nr board would be nyan
                How to know which board is matching the Chromebook Notebook you purchased from the store. Good to start but not up to date because HP Chromebook 14 exist for ARM and X86 (Falco)
~/trunk/src/scripts $ export BOARD=nyan or export BOARD=arm-generic
Initialize the build for a board
~/trunk/src/scripts $ ./setup_board --board=${BOARD}
add --force to force cleanup of previous build
  • Set the chronos user password
~/trunk/src/scripts $ ./
guest or dev is a good one

Work on one package

~/trunk/src/scripts $./cros_workon start --board=${BOARD} net-wireless/broadcom

better present temporary workspace to be pruned in case of failure at the end of the build

~/trunk/src/scripts $ FEATURES="noclean" emerge-${BOARD} net-wireless/broadcom
~/trunk/src/scripts $./build_packages --board=${BOARD} net-wireless/broadcom > ~/build.log

inside a secondary instance of cross_sdk inside chroot
tail -f ~/build.log
Build the packages for the board
~/trunk/src/scripts $ ./build_packages --board=${BOARD}
NOTE : The following error might come up at this step -
The following license changes are necessary to proceed:
 (see "package.license" in the portage(5) man page for more details)
#required by virtual/opengles-2-r2, required by chromeos-base/chromeos-chrome-33.0.1736.3_rc-r1, required by chromeos-base/telemetry-0.0.1-r3, required by chromeos-base/autotest-chrome-0.0.1-r3286, required by chromeos-base/autotest-all-0.0.1-r16, required by chromeos-base/autotest-all (argument)
>=media-libs/mali-drivers-bin-1.20-r123 Google-TOS
ERROR   : emerge detected broken ebuilds. See error message above.
 If so, please modify the file '/mnt/host/source/src/third_party/chromiumos-overlay/chromeos/config/make.conf.arm-target' to add ' ACCEPT_LICENSE="*" ' to fix the error for FALCO target.
  • Build a disk image for the board
~/trunk/src/scripts $ ./build_image --board=${BOARD} --noenable_rootfs_verification dev
  • Put the image on a USB disk
~/trunk/src/scripts $ ./ --board=${BOARD}

Developer Mode on a physical Chromebook hardware with pre-installed OS

Caution: Modifications you make to the system are not supported by Google, may cause hardware, software or security issues and may void warranty.
An unrelated note: Holding just Refresh and poking the Power button hard-resets the machine without entering Recovery. That's occasionally useful, but use it with care - it doesn't sync the disk or shut down politely, so there's a nonzero chance of trashing the contents of your stateful partition.

Developer Mode Introduction

Enabling Developer mode is the first step to tinkering with your Chromebook. With Developer mode enabled you can do things like poke around on a command shell (as root if you want), install Chromium OS, or try other OS's. Note that Developer mode turns off some security features like verified boot and disabling the shell access. If you want to browse in a safer, more secure way, leave Developer mode turned OFF. Note: Switching between Developer and Normal (non-developer) modes will remove user accounts and their associated information from your Chromebook.

Entering Developer Mode

On this device, both the recovery button and the dev-switch have been virtualized. Our partners don't really like physical switches - they cost money, take up space on the motherboard, and require holes in the case.
To invoke Recovery mode, you hold down the ESC and Refresh (F3) keys and poke (quick press and release) the Power button.
To enter Dev-mode you first invoke Recovery, and at the Recovery screen press Ctrl-D (there's no prompt - you have to know to do it). It will ask you to confirm, then reboot into dev-mode.
Dev-mode works the same as always: It will show the scary boot screen and you need to press Ctrl-D or wait 30 seconds to continue booting.
Overview of code structure

o    Turning Cr48 to developer mode (only apply Cr48 device)

Getting to a command prompt

If you're a Linux hacker, you probably know that Google Chrome OS is built on top of Linux and you're wondering how you can jailbreak your device so you can get to a command prompt.  It turns out: there's no need.  The command prompt is built in to your device!  
IMPORTANT NOTE: Before following these instructions, remember to put your device into Developer Mode (see above).

Get the command prompt through VT-2

One way to get the login prompt is through something called VT-2, or "virtual terminal 2".  This is probably familiar to the Linux hackers out there.  You can get to VT-2 by pressing:
[ Ctrl ] [ Alt ] [ => ]
...where the [ => ] key is the right-arrow key just above the number 3 on your keyboard.
Once you have the login prompt, you should see a set of instructions telling you about command-line access.  By default, you can login as the chronos user with no password.  This includes the ability to do password-less sudo.  The instructions on the screen will tell you how you can set a password.  They also tell you how to disable screen dimming.

USB Boot

By default, USB booting is disabled. Once you are in Dev-mode and have a root shell, you can run:
sudo crossystem dev_boot_usb=1

Making changes to the filesystem

The Chromium OS rootfs is mounted read-only. In developer mode you can disable the rootfs verification, enabling it to be modified.

NOTE: If you mount the root filesystem in writeable mode, even if you make no changes, it will no longer be verifiable and you'll have to use a recovery image to restore your system when you switch back to normal mode.

To make your rootfs writable, run this from a shell:
sudo /usr/share/vboot/bin/ --remove_rootfs_verification --partitions 2

Contributing code to the chromium project

10+ Commands Included In Chrome OS’s Hidden Crosh Shell

Google’s Chrome OS includes a shell environment known as Chrome Shell, or “crosh” for short. Crosh includes several terminal commands that can be used on all Chromebooks, even if developer mode isn’t enabled.
Crosh includes commands for connecting to SSH servers, monitoring resource usage, debugging network problems, tweaking hidden hardware settings, performing hardware tests, and other debugging purposes.

Opening Crosh

To open the Crosh, press Ctrl+Alt+T anywhere in Chrome OS. The Crosh shell will open in a browser tab.
From here, you can run the help command to view a list of basic commands or run thehelp_advanced command for a list of “more advanced commands, mainly used for debugging.” We’ll cover some of the most interesting ones below.


Google provides an SSH client in the Chrome Web Store, but you don’t need to use it. You can use the built-in ssh command to connect to SSH servers without installing anything else on your Chromebook.
The ssh command is more advanced than you might expect. In addition to simply connecting to an SSH server, you can also use SSH tunneling to create a local proxy that allows you to tunnel your Chrome OS network activity over your SSH connection. You can also add private keys that you may need to connect to SSH servers.


The ssh_forget_host command displays a list of known hosts you’ve connected to with the SSH command and allows you to “forget” a host. The next time you connect to the host, you’ll be asked to verify its key fingerprint again.


Chrome includes its own task manager that shows you which Chrome tabs, extensions, and plug-ins are using resources. However, Crosh also includes the top command from Linux, which gives you a display of all the low-level processes that may also be using resources. Most users will prefer using Chrome’s built-in task manager, but the top utility does provide more information. It also displays some information you can’t find elsewhere in Chrome OS, such as your Chromebook’s uptime.


Yes, Chrome OS also has a ping command. Ping is an important utility for network troubleshooting, allowing you to see how long packets take to travel between your system and a web server and see whether any packets are being dropped. It works just like the ping command on other operating systems. Press Ctrl+C to stop the ping process or halt any other command in Crosh.


The tracepath command functions similarly to traceroute, allowing you to trace the path packets take to reach a remote server. It’s another useful network-troubleshooting command, as it allows you to determine exactly where network problems are occurring between you and another networked device.


The network_diag command performs a short set of network diagnostic tests, saving the output as a .txt file you can view in your Chromebook’s Files app.


Chrome includes a command that can record audio from your Chromebook’s microphone and play it back later.
To record 10 seconds of audio from your Chromebook’s microphone, run the following command:
sound record 10
The audio will be saved as a file you can access from your Chromebook’s Files app. You can then play it back with the sound play command.


The tpcontrol command allows you to fine-tune your device’s touchpad. Some of these options are available in Chrome OS’ settings window, but you can tweak many properties that aren’t available from the graphical interface.

xset m

The xset m command allows you to tweak your mouse acceleration rate. Chrome OS only has options for controlling the mouse’s speed in its graphical interface, so any fine-tuning of the acceleration rate — particularly useful if you’re using an external mouse that doesn’t work well with the default rate — must be done from here. The acceleration rate is configured in the same way you’d use the xset m command to configure acceleration rates on a standard Linux system.

xset r

The xset r command allows you to tweak the autorepeat behavior for when you hold a keyboard button down. You can select a delay before autorepeat starts and configure how many repeats occur per second. You can also disable autorepeat completely for every key on the keyboard or just disable autorepeat for specific keys.

Developer Mode Commands

In developer mode, you also have the following commands available to you:
  • shell: Opens a full bash shell where you can run other Linux commands, including ones that can launch standard Linux desktop environments after you install them.
  • systrace: Start system tracing, allowing you to capture logs for debugging purposes.
  • packet_capture: Start capturing and logging packets.

Using SSH on a Chromebook to connect to your Koding VM

Connect broadcom Intranet mini rooter cable to WIFI rooter. Connect both the Coding VM and the Chromebook to the WIFI rooter so that both the Chromebook and the VM appears on the same

In this guide, we will cover how to set up ssh on your Chromebook. There are two ways you can use SSH on a Chromebook. You can either install Google's SSH Chrome extention or use the native SSH client that is built into the Chrome OS. For the purposes of this guide, we will use the native SSH client method as it does not require the installation of any new software.

Sstep 1: Verify you have crosh installed

Before beginning, make sure that you have a newer build of Chrome OS (build 32 or above) and that your particular build supports the built in crosh shell which contains the SSH client that we will use. To check, press ctrl-alt-T on your keyboard and you should be greeted with a prompt
.crosh shell
If you do not get the above screen, chances are high that you either have an older build of Chrome OS or that your device manufacturer has opted to remove crosh from their customd build of the Chrome OS.

Sstep 2: Generate the required ssh private and public keys on your VM

Note: if you already have a private and public key generated, you can skip the section below
Open up Terminal on your Koding VM and type in the following command:
You will be presented with a few choices, accept all defaults until you end up with something like this:
Generating public/private rsa key pair.
Enter file in which to save the key (/home/your_username/.ssh/id_rsa): 
Created directory '/home/your_username/.ssh'.
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /home/your_username/.ssh/id_rsa.
Your public key has been saved in /home/your_username/.ssh/
The key fingerprint is:
7a:36:29:6d:9d:5c:45:5a:8b:53:c0:1a:61:29:3f:ce your_username@your_username
The key's randomart image is:
+--[ RSA 2048]----+
|          o+..+  |
|        ..o .* . |
|         o o+ o  |
|          +  o   |
|        So ..    |
|       o +Eo     |
|      o B +      |
|       = .       |
|                 |

Sstep 3: Copy the generated public key to authotized_keys file on your VM

Doing this allows your Chromebook to be recognized as a valid host (once we copy over the private keys, which is the next step).
Create an authorized_keys file (if it does not exist)
touch ~/.ssh/authorized_keys
Copy the public key into it.
cat ~/.ssh/ >> ~/.ssh/authorized_keys

Sstep 4: Moving the generated private key to your Chromebook

To achieve this, we will first copy over the private key to our Web folder so that we can download it over the browser.

Installing OpenSSH server

Once you have installed an OpenSSH server,    
 sudo apt-get install openssh-server 

you will need to configure it by editing the sshd_config file in the /etc/ssh directory.   

sshd_config is the configuration file for the OpenSSH server. ssh_config is the configuration file for the OpenSSH client. Make sure not to get them mixed up.

First, make a backup of your sshd_config file by copying it to your home directory, or by making a read-only copy in /etc/ssh by doing:  

 sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config.factory-defaults
 sudo chmod a-w /etc/ssh/sshd_config.factory-defaults
Creating a read-only backup in /etc/ssh means you'll always be able to find a known-good configuration when you need it.  
Once you've backed up your sshd_config file, you can make changes with any text editor, for example;    
 sudo gedit /etc/ssh/sshd_config

runs the standard text editor in Ubuntu 12.04 or more recent. For older versions replace "sudo" with "gksudo". Once you've made your changes (see the suggestions in the rest of this page), you can apply them by saving the file then doing:  

 sudo restart ssh

Lighttpd for Ubuntu Coding VM

To install lighttpd on Ubuntu, simply run in a terminal:   
 sudo apt-get install lighttpd

This will automatically install Lighttpd, start it, and set it to run at boot.  
You can access your web server by going to "http://localhost" in any web browser on the local machine, or "http://serverip" (where serverip is the IP address of the computer running lighttpd) from any other computer on the network.  
The root of the web server is at "/var/www/" and the configuration file is "/etc/lighttpd/lighttpd.conf".  

Enabling User Directories

With user directories enabled, each user can have their own web directory in their home folder.  
To enable user directories, run in a terminal:   
 sudo lighttpd-enable-mod userdir

Then reload the configuation:   
 sudo service lighttpd reload

Now users can place files in a "public_html" folder in their home directory to have them hosted on the web server.  
For example, the user "joe" would put his files in "/home/joe/public_html" and access them at "http://serverip/~joe".

Note: after downloading the private key you should immediately delete if from your Web folder. This is not the most secure way of copying over your file but is the easiest. If you prefer, you can also upload the file to your Google Drive account and then download it your Chromebook.
Copy the private key to your Web folder:
cp ~/.ssh/id_rsa /var/www/id_rsa.txt
sudo chown root:root /var/www/id_rsa.txt
sudo chmod 655 /var/www/id_rsa.txt

If Ununtu is running on a VM you need to make sure you can get an IP address on the same network than the WIFI rooter so that the Chromebook can see the VM http server.
Why using a WIFI rooter. It is more convenient because lcoal IP address will never change so no need to worry about DNS change to access the Coding VM from the Chromebook

  1. Open Settings-Network, for VMWARE then choose bridge.
  2. Open Network and Sharing-Center in Windows, then go to change Adapter settings, then disable the virtual box host only adapter.
  3. On Windows connect to WIFI rooter instead of VLAN
  4. ifconfig in the VM should now return 192.168.1.* assuming the rooter is at

Lighttpd Windows for file exchange only
Copy C:\Program Files (x86)\LightTPD\conf\* to C:\Program Files (x86)\LightTPD\
Open shell under C:\Program Files (x86)\LightTPD\
LightTPD.exe -D -f lighttpd.conf

Now hop over to your Chromebook and type in the Web URL of your VM to download this file. The Web URL of your VM usually is:
You can create tar file on the VM and copy them under /var/wwww

Make sure you have the file without the .txt extension. You can check/rename the file by using theFiles app on your Chromebook (as seen in the screenshot below).finder
As soon as the file is downloaded on your Chromebook, delete it from the Web folder of your VM
rm /var/www/id_rsa.txt
At this point, you now have the generated private key on your Chromebook and are ready to connect.
Press ctrl-alt-T to bring up crosh and then on the crosh shell, type ssh Use the following commands to set up ssh:
host = your_coding_vm_ip
user = your_coding_vm_username
key = id_rsa
Now you you have access to the Coding Ubuntu VM so you can easilly build and bring binary over using scp as well 

You’ll find other commands if you run the help_advanced command — everything from memory tests and a Bluetooth debugging console to commands that let you control
the debugging level for different background services. Many of these options are only useful for Chrome developers.

Note when you download file using your ChromeBook device web browser that the location of downloaded file on the device will be

Useful syntax for Secure Copy (scp) between Chromebook and Coding VM

What is Secure Copy?

scp allows files to be copied to, from, or between different hosts. It uses ssh for data transfer and provides the same authentication and same level of security as ssh.


Copy the file "foobar.txt" from a remote host to the local host

$ scp your_username@Coding_Ubuntu_VM_IP_ADDRESS:foobar.txt /some/local/directory

Copy the file "foobar.txt" from the local host to a remote host

$ scp foobar.txt your_username@Coding_Ubuntu_VM_IP _ADDRESS:/some/remote/directory

Copy the directory "foo" from the local host to a remote host's directory "bar"

$ scp -r foo your_username@Coding_Ubuntu_VM_IP _ADDRESS:/some/remote/directory/bar

Copying the files "foo.txt" and "bar.txt" from the local host to your home directory on the remote host

$ scp foo.txt bar.txt your_username@Coding_Ubuntu_VM_IP _ADDRESS:~

Copy the file "foobar.txt" from the local host to a remote host using port 2264

$ scp -P 2264 foobar.txt your_username@Coding_Ubuntu_VM_IP _ADDRESS:/some/remote/directory

Copy multiple files from the remote host to your current directory on the local host

$ scp your_username@Coding_Ubuntu_VM_IP _ADDRESS:/some/remote/directory/\{a,b,c\} .

$ scp your_username@Coding_Ubuntu_VM_IP _ADDRESS:~/\{foo.txt,bar.txt\} .

Kernel Build

  • Kernel version
src/third_party/kernel/files // current kernel version 3.4
src/third_party/kernel-next // kernel version 3.8 (ARM)
src/third_party/kernel/3.10 // kernel version 3.10 (x86/x64)  
 3.10.18 for HP Chrome Book
  • Kernel config

Compile Silab CP210x driver

1 Enter chroot
inside HOST ~/chromiumos$ ./chromiumos/depot_tools/cros_sdk
or ~/chromiumos/src/scripts/sdk_lib/sudo ./ --chrome_root=~/truck --cache_dir=~/trunk/.cache/distfiles/ccache/
2 Select the board 
~/trunk/src/scripts $ export BOARD=nyan
~/trunk/src/scripts $ ./setup_board --board=${BOARD}
--force to cleanup
~/trunk/src/scripts $ ./setup_board --board=${BOARD} --job 4 -default
~/trunk/src/scripts $locate cccache should be under ~/trunk locate ccache after you build entire image once
3 cros_workon 
Tell the build system to use local source
~/trunk/src/scripts $ cros_workon start  --board=${BOARD} chromeos-kernel
for new kernel cerate kernel-next folder under ~/chromiumos/src/third_party/ in this case in previous command choose chromeos-kernel-next

Build kernel

         Check kernel version on your device uname -r
             HB Chromebook returned 3.10.18

~/trunk/src/scripts $ USE="-wireless34" emerge-falco chromeos-kernel-3_10
 * If you see a "Google-TOS" error, pleae append or correct ACCEPT_LICENSE="Google-TOS" in the .../overlay-falco/make.conf and then try again.

Tempory ko output folder should be under 
5 Kernel Install
~/chromiumos/src/third_party/kernel-next$ ./ --remote

Manual Building kernel

Enter the chroot
inside HOST ~/chromiumos$ ./chromiumos/depot_tools/cros_sdk
Here is how to build the kernel yourself manually, from within the chroot.
Make sure you have done something like:
export ARCH=arm
export BOARD=nyan
export CROSS_COMPILE=arm-linux-gnueabi-

Select the board 
~/trunk/src/scripts $ export BOARD=nyan  or export BOARD=arm-generic
~/trunk/src/scripts $ ./setup_board --board=${BOARD}

Indicate that you are making kernel changes
~/trunk/src/scripts/./cros_workon start --board=${BOARD} sys-kernel/chromeos-kernel
make sure config:CONFIG_USB_SERIAL_CP210X is enable as a loadable module
cd /path/to/kernel


replace drivers/usb/serial/cp210x.c with new one in this example 

# set up the .config file
./chromeos/scripts/prepareconfig chromeos-tegra
make oldconfig
Exit chroot

export ARCH=arm
export BOARD=nyan
export CROSS_COMPILE=arm-linux-gnueabi-
install arm cross compiler
sudo apt-get install gcc-arm-linux-gnueabi
install ncurses-dev
sudo apt-get install ncurses-dev
# edit config
make menuconfig
# (make your changes) 
Now, after you make a kernel change, you can simply type 
make as normal:
# build the kernel and modules

# or maybe: build the uImage on an 8 core machine
make -j10 uImage

# or both!
make && make uImage

Silab Driver Load

use scp
cp -f cp210x.ko /lib/modules/$(KERNELVER)/kernel/drivers/usb/serial/ 
Chromebook ~ # insmod /lib/modules/$(KERNELVER)/kernel/drivers/usb/serial/cp210x.ko
/dev/pstore/console-ramoops   // last-minute kernel log before system crash

No comments: