Tuesday, April 21, 2015

Merge partition Ubuntu

If the unused partition is physically after the partition with the filesystem, you can resize the partition on the disk, reboot, and then grow the filesystem (if it was a growable filesystem like ext3, ext4, etc).
For example, if you have /dev/sda1 as the filesystem, and /dev/sda2 as the unused partition, check the partitions with fdisk /dev/sda:
# fdisk /dev/sda
...    
Command (m for help): p
...
  Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *          63     8016434     4008186   83  Linux
/dev/sda2         8016435  1953520064   972751815   83  Linux
You need to make sure that your new sda1 starts in the same location (here, 63) and ends where sda2 ended (here, 1953520064). And double-check that where sda1 ends is immediately before where sda2 starts (here, 8016434 is immediately followed by 8016435) just to be sure.
Then delete the unused partition, and the filesystem partition:
Command (m for help): d
Partition number (1-4): 2
...
Command (m for help): d
Partition number (1-4): 1
And finally, recreate the filesystem partition:
Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4, default 1): 1
First sector (63-1953520064, default: 63): 63
...
Last sector, +sectors or +size{K,M,G} (63-1953520064, default 1953520064): 1953520064

Command (m for help): t
Partition number (1-4): 1
Hex code (type L to list codes): 83
And make sure you've got what you're expecting:
Command (m for help): p
...
  Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *          63  1953520064   976760001   83  Linux
Finally, save it:
Command (m for help): w
If any partitions were mounted on the disk, you'll have to reboot first, and then you can grow the filesystem:
# resize2fs /dev/sda1
Be careful and good luck. Always back up your data first. :)

Wednesday, March 11, 2015

Xcode tuneup and notes

Changing the Build Location

Although most developers don’t need to change the default location of build products, you can specify a different location.

  1. Choose Xcode > Preferences, and click Locations.
  2. Click the Advanced button for the Derived Data setting.


    ../art/derived_data_advanced_button_2x.png
  3. Select a build location from the available options, and click Done.


    ../art/derived_data_pane_2x.png
The derived data settings in the Locations preferences give you control over the location of build products and other derived data. Most developers don’t need to change the default settings. If you’re sure that you need to store your build products in a location different from the one for other derived data, click Advanced.
You have several choices for the location of build products:
  • unique subfolder inside the derived data folder. The subfolder name is based on your project or workspace name and location. This is the recommended choice and the default setting.
  • shared folder inside the derived data folder. You specify the name of this subfolder, which is shared by all projects. This choice assumes that the derived data location is not workspace-relative.
    This option can be used to let separate projects build into the same location so that they can share their build products. Build products are automatically shared among all projects in a workspace, so this setting is unnecessary if you can place your projects in the same workspace.
  • custom path. From the pop-up menu, choose whether the path should be relative to the derived data, relative to your workspace, or absolute. In the text fields, specify the custom path to the build products and intermediate build files.
    ../art/custom_build_location_2x.png
  • The legacy location specified in each target’s build settings.
    This option is intended to support older projects that won’t work correctly unless they’re in custom per-target or per-project build locations (SYMROOT and OBJROOT build settings).

Opening a File in an Editor Pane, Window, or Tab

Opening a file in an Editor Pane, Window, or Tab

Open a file in a specific editor pane, window, or tab using the navigation chooser. You can select a file to open in the project navigator or a jump bar.
  1. In the project navigator, Shift-Option-click the file you want to open.
  2. In the navigation chooser, choose the pane, window, or tab in which you want to open the file.
The navigation chooser shows the layout of the workspace window. If the selected file is already open in one of the editor panes, the navigation chooser displays a star to indicate the pane containing the file.
../art/navigation_chooser.png
With the navigation chooser you can open the file in the primary editor, an existing assistant editor or tab by choosing the items without a plus sign. To open the file in a new assistant editor, tab, or window, chose an item with a plus sign. When making your choice from the navigation chooser:
  • To choose an editor pane or window, double-click it.
  • To choose a new tab, click it.
To dismiss the navigator without making a choice, press the Esc (Escape) key.
See the related article on General preferences to learn how to specify outcomes for these navigation gestures:
  • Click
  • Option-click
  • Double-click

 The DEBUG preprocessor macro in XCode

The preprocessor "DEBUG" macro is defined in all Xcode project templates for debug builds. Preprocessor macros are interpreted at compile time and the DEBUG preprocessor macro can be used to allow debug code to be run in debug builds of your project. If you aren't sure that your project has it defined, you can verify that this it is by selecting the project in Xcode and clicking on the build settings tab. Search for Preprocessing and make sure that DEBUG=1 is being defined for your debug builds (as shown bellow). If it isn't already defined in your project, you can add it. Preprocessor macros are case sensitive.

Figure 1  The DEBUG preprocessor macro setting in an Xcode project.

How do you specify command line arguments in XCode

Command line arguments and environment variables can be set up in the Run section of the scheme editor.
Product -> Edit Scheme... -> Run -> Arguments

Starting a debugging session

Attaching to an existing process

You can attach to Firefox with following command:
(lldb) process attach --name firefox
Some versions of lldb causes crashes after attaching to Firefox.

Running a new process

To start Firefox under the debugger, run lldb followed by "--", followed by the command line you'd like to run, like this:
$ lldb -- obj-ff-dbg/dist/Nightly.app/Contents/MacOS/firefox-bin -no-remote -profile /path/to/profile
Then set breakpoints you need and start the process:
(lldb) breakpoint set --name nsInProcessTabChildGlobal::InitTabChildGlobal
Breakpoint created: 1: name = 'nsInProcessTabChildGlobal::InitTabChildGlobal', locations = 0 (pending)
WARNING:  Unable to resolve breakpoint to any actual locations.

(lldb) r
Process 7602 launched: '/.../obj-ff-opt/dist/Nightly.app/Contents/MacOS/firefox-bin' (x86_64)
1 location  added to breakpoint 1

Saturday, February 21, 2015

Transplant dates in Northern California


Transplant Dates
Moon Favorable
* Barley3/15–4/73/20–4/4
* Beans (E)4/15–304/18–30
(L)7/1–217/1, 7/15–21
Beets (E)3/15–4/33/15–19
(L)8/15–318/30–31
* Broccoli (E)3/7–313/20–31
(L)8/1–208/14–20
* Brussels sprouts3/7–4/153/20–4/4
* Cabbage3/7–4/153/20–4/4
Carrots (E)3/7–313/7–19
(L)7/7–317/7–14
* Cauliflower (E)3/15–4/73/20–4/4
(L)7/1–8/77/1, 7/15–31
* Celery (E)3/7–313/20–31
(L)8/15–9/78/15–29
* Collards (E)3/7–4/73/20–4/4
(L)8/15–318/25–29
* Corn, sweet (E)4/1–174/1–4
(L)7/7–217/15–21
* Cucumbers4/7–5/154/18–5/3
* Eggplants4/7–5/154/18–5/3
* Endive (E)4/7–5/154/18–5/3
(L)7/15–8/157/15–31, 8/14–15
* Kale (E)3/7–4/73/20–4/4
(L)8/15–318/15–29
Leeks3/7–4/73/7–19, 4/5–7
* Lettuce3/1–313/1–5, 3/20–31
* Muskmelons4/15–5/74/18–5/3
* Okra5/25–6/155/25–6/2
Onion sets3/1–313/6–19
* Parsley3/1–313/1–5, 3/20–31
Parsnips3/7–313/7–19
* Peas (E)3/7–303/20–31
(L)8/7–318/15–29
* Peppers4/1–304/1–4, 4/18–30
Potatoes4/1–304/5–17
* Pumpkins4/23–5/154/23–5/3
Radishes (E)3/7–313/7-19
(L)9/7–309/7–12, 9/28–30
* Spinach (E)3/15–4/203/20–4/4, 4/18–20
(L)8/1–9/158/14–29, 9/13–15
* Squashes4/15–304/18–30
Sweet potatoes4/21–5/95/4–9
* Swiss chard3/15–4/153/20–4/4
* Tomatos4/7–304/18–30
Turnips (E)3/15–313/15–19
(L)8/1–208/1–13
*Watermelons4/15–5/74/18–5/3
* Wheat, spring3/1–203/1–5, 3/20
* Wheat, winter9/15–10/209/15–27, 10/12–20

Wednesday, February 18, 2015

Chromebook HP 14


Chrome and Chromium OS Introduction


Chromium OS


o    http://www.chromium.org/chromium-os (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

Hardware

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 ./enter_chroot.sh --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  http://www.hp.com/nb/c14xc board would be nyan
https://chromium.googlesource.com/chromiumos/overlays/board-overlays.git/+/master/overlay-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 $ ./set_shared_user_password.sh
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
or
~/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 $ ./image_to_usb.sh --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/make_dev_ssd.sh --remove_rootfs_verification --partitions 2



Contributing code to the chromium project


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

chrome-os-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.

ssh

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.
chromebook-ssh-client

ssh_forget_host

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.

top

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.
chromebook-top-command

ping

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.
chromebook-ping-command

tracepath

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.
tracepath-chrome-os

network_diag

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-os-network_diag

sound

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.
chromebook-record-sound-file

tpcontrol

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.
chromebook-tpcontrol

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.
chrome-os-xset

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.
chrome-os-developer-mode-shell

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
network

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:
ssh-keygen
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/id_rsa.pub.
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/id_rsa.pub >> ~/.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 192.168.1.1

Lighttpd Windows for file exchange only

http://lighttpd.dtech.hu/
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:
http://ipaddress_vn/id_rsa.txt
You can create tar file on the VM and copy them under /var/wwww

save-as
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
connect
!connect
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
/home/chronos/user/Downloads/id_rsa.txt

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.

Examples

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)  
src/third_party/kernel/3.14
 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 ./enter_chroot.sh --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
or
~/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 
~/trunk/.hroot/build/falco/var/cache/portage/sys-kernel/
5 Kernel Install
~/chromiumos/src/third_party/kernel-next$ ./update_kernel.sh --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


chromeos/config/base.config:CONFIG_USB_SERIAL_CP210X=m

drivers/usb/serial/Makefile:obj-$(CONFIG_USB_SERIAL_CP210X)
  
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
make

# 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
log
dmesg
/var/log/messages
/dev/pstore/console-ramoops   // last-minute kernel log before system crash