Difference between revisions of "Chrome OS devices/Custom firmware"

From ArchWiki
Jump to: navigation, search
m (Dhead moved page Custom firmware for Chrome OS devices to Chrome OS devices/Custom firmware: move to a sub-page of Chrome OS devices)
m (avoid contractions to comply with Help:Style#Language_register)
Line 13: Line 13:
  
 
* Adds a much recent version of SeaBIOS
 
* Adds a much recent version of SeaBIOS
* Adds SeaBIOS payload of coreboot to Chrome OS devices that didn't shipped with SeaBIOS.
+
* Adds SeaBIOS payload of coreboot to Chrome OS devices that did not shipped with SeaBIOS.
 
* Reduce boot time.
 
* Reduce boot time.
 
* Remove developer Mode screen.
 
* Remove developer Mode screen.
Line 23: Line 23:
 
* Dangerous, might brick your device.
 
* Dangerous, might brick your device.
 
* Cannot boot stock Chrome OS (you can install [http://arnoldthebat.co.uk/wordpress/chromium-os/ Arnold the Bat’s Chromium OS build] and it should be possible upgrade it to full blown Chrome OS with a script).
 
* Cannot boot stock Chrome OS (you can install [http://arnoldthebat.co.uk/wordpress/chromium-os/ Arnold the Bat’s Chromium OS build] and it should be possible upgrade it to full blown Chrome OS with a script).
* It's possible that some quirks will be added, [https://bbs.archlinux.org/viewtopic.php?pid=1460520#p1460520].
+
* It is possible that some quirks will be added, [https://bbs.archlinux.org/viewtopic.php?pid=1460520#p1460520].
  
 
== Flashing the custom firmware ==
 
== Flashing the custom firmware ==
Line 30: Line 30:
 
* Use John Lewis' script which will save you time finding the correct firmware.
 
* Use John Lewis' script which will save you time finding the correct firmware.
 
* Use Matt DeVillier's [http://forum.kodi.tv/showthread.php?tid=194362 ezScript] (currently supports only Chromeboxes).
 
* Use Matt DeVillier's [http://forum.kodi.tv/showthread.php?tid=194362 ezScript] (currently supports only Chromeboxes).
* Manually with {{ic|flashrom}}, in this case you'll need to obtain the firmware by yourself or to compile it from the Coreboot sources ([http://www.coreboot.org/Download_coreboot official] or [https://chromium.googlesource.com/chromiumos/third_party/coreboot/ Chromium OS fork]).
+
* Manually with {{ic|flashrom}}, in this case you will need to obtain the firmware by yourself or to compile it from the Coreboot sources ([http://www.coreboot.org/Download_coreboot official] or [https://chromium.googlesource.com/chromiumos/third_party/coreboot/ Chromium OS fork]).
  
 
=== Disable the hardware write protection ===
 
=== Disable the hardware write protection ===
Line 49: Line 49:
 
* Writes the custom firmware.
 
* Writes the custom firmware.
  
===== What the script doesn't do ? =====
+
===== What the script does not do ? =====
* Doesn't ask for confirmation.
+
* Does not ask for confirmation.
* Doesn't check if the hardware write protection is disabled.
+
* Does not check if the hardware write protection is disabled.
* Doesn't confirm the compatibility of a custom firmware to a specific Chromebook sub-model.
+
* Does not confirm the compatibility of a custom firmware to a specific Chromebook sub-model.
  
 
===== Conclusions =====  
 
===== Conclusions =====  
Line 59: Line 59:
 
* [https://johnlewis.ie/custom-chromebook-firmware/rom-download/ Confirm that your Chromebook model is supported], if your model is untested then visit the [https://plus.google.com/communities/112479827373921524726 coreboot on Chromebooks Google+ community] and ask for advice.
 
* [https://johnlewis.ie/custom-chromebook-firmware/rom-download/ Confirm that your Chromebook model is supported], if your model is untested then visit the [https://plus.google.com/communities/112479827373921524726 coreboot on Chromebooks Google+ community] and ask for advice.
  
{{Warning|If you're flashing a custom firmware be prepared to the possibility that you might brick your device and make yourself familiar with the [[#Unbricking_Your_Chromebook|unbricking methods]].}}
+
{{Warning|If you are flashing a custom firmware be prepared to the possibility that you might brick your device and make yourself familiar with the [[#Unbricking_Your_Chromebook|unbricking methods]].}}
  
 
==== Running the script in Chrome OS ====
 
==== Running the script in Chrome OS ====
Line 76: Line 76:
 
==== Running the script in Arch Linux ====
 
==== Running the script in Arch Linux ====
  
* In Arch Linux on 64bit envirmonment you''ll need to enable the Multilib repository (if it isn't already enabled) in pacman.conf and install {{Pkg|lib32-glibc}}.
+
* In Arch Linux on 64bit environment you will need to enable the Multilib repository (if it is not already enabled) in pacman.conf and install {{Pkg|lib32-glibc}}.
 
  # pacman -S lib32-glibc
 
  # pacman -S lib32-glibc
  
Line 107: Line 107:
 
  # wget --no-check-certificate https://johnlewis.ie/flashrom
 
  # wget --no-check-certificate https://johnlewis.ie/flashrom
 
  # chmod +x flashrom
 
  # chmod +x flashrom
Don't forget that {{ic|flashrom}}'s location isn't in {{ic|$PATH}}, to execute it you'll need to precede the command with {{ic|./}}, e.g. {{ic|# ./flashrom}}.
+
Do not forget that {{ic|flashrom}}'s location is not in {{ic|$PATH}}, to execute it you will need to precede the command with {{ic|./}}, e.g. {{ic|# ./flashrom}}.
  
 
==== Get flashrom for Chrome OS ====
 
==== Get flashrom for Chrome OS ====
Line 134: Line 134:
 
== Unbricking your Chrome OS device ==
 
== Unbricking your Chrome OS device ==
  
{{Note|This doesn't intended to be a thorough guide but just give you a basic understanding of the process of flashing a firmware to a bricked Chromebook. The ArchWiki isn't the place for detailed hardware hacking guides so there is no sense in expanding this topic.}}
+
{{Note|This does not intended to be a thorough guide but just give you a basic understanding of the process of flashing a firmware to a bricked Chromebook. The ArchWiki is not the place for detailed hardware hacking guides so there is no sense in expanding this topic.}}
  
 
=== Required tools ===
 
=== Required tools ===
  
* Programmer, both the [http://flashrom.org/RaspberryPi Raspberry Pi] and the [http://flashrom.org/Bus_Pirate Bus Pirate] are mentioned as compatible devices on the [http://flashrom.org/ flashrom wiki]. The [http://flashrom.org/Bus_Pirate Bus Pirate] is preferable as it'll allow you to use Chromium OS's version of {{ic|flashrom}} that supports {{ic|--wp-disable}} and {{ic|--wp-status}} flags.
+
* Programmer, both the [http://flashrom.org/RaspberryPi Raspberry Pi] and the [http://flashrom.org/Bus_Pirate Bus Pirate] are mentioned as compatible devices on the [http://flashrom.org/ flashrom wiki]. The [http://flashrom.org/Bus_Pirate Bus Pirate] is preferable as it will allow you to use Chromium OS's version of {{ic|flashrom}} that supports {{ic|--wp-disable}} and {{ic|--wp-status}} flags.
 
* SOIC clip is recommended, see [http://flashrom.org/ISP].
 
* SOIC clip is recommended, see [http://flashrom.org/ISP].
 
* Female jumper wires.
 
* Female jumper wires.
Line 148: Line 148:
 
* Connect the SOIC clip to the ROM chip.
 
* Connect the SOIC clip to the ROM chip.
 
* If your programmer is running Linux (Raspberry Pi) then modprobe the spi modules.
 
* If your programmer is running Linux (Raspberry Pi) then modprobe the spi modules.
* If your programmer isn't running Linux then connect it to your Linux machine.
+
* If your programmer is not running Linux then connect it to your Linux machine.
 
* Write the firmware with {{ic|flashrom}}, you might need to disable software write protection by running {{ic|flashrom}} with the {{ic|--wp-disable}} flag (this is why Chromium OS's {{ic|flashrom}} is handy).
 
* Write the firmware with {{ic|flashrom}}, you might need to disable software write protection by running {{ic|flashrom}} with the {{ic|--wp-disable}} flag (this is why Chromium OS's {{ic|flashrom}} is handy).
  
Line 160: Line 160:
 
== Firmware write protection ==
 
== Firmware write protection ==
  
{{Note|The information on this topic only intended to give you the basic understanding on the write protection feature in your Chromebook. The ArchWiki isn't the place for detailed hardware hacking guides so there is no sense in expanding this topic.}}
+
{{Note|The information on this topic only intended to give you the basic understanding on the write protection feature in your Chromebook. The ArchWiki is not the place for detailed hardware hacking guides so there is no sense in expanding this topic.}}
  
 
The firmware (Coreboot and its payloads) stored on a SPI chip (usually SOIC8) that some of its storage is protected from writing (mostly Coreboot).
 
The firmware (Coreboot and its payloads) stored on a SPI chip (usually SOIC8) that some of its storage is protected from writing (mostly Coreboot).
  
As long as the write protection wasn't disabled or the protected range wasn't set to (0,0) any change made to the unprotected part of the firmware (mainly SeaBIOS) should be recoverable with Chrome OS recovery media.
+
As long as the write protection was not disabled or the protected range was not set to (0,0) any change made to the unprotected part of the firmware (mainly SeaBIOS) should be recoverable with Chrome OS recovery media.
  
 
There are two parts of the write protection: hardware and software.
 
There are two parts of the write protection: hardware and software.
Line 183: Line 183:
 
* Disable the hardware write protection of the special software register.
 
* Disable the hardware write protection of the special software register.
 
* Change the value of the special software register to disable software write protection or change the range of the protected addresses so no data will be protected (start and end at 0).
 
* Change the value of the special software register to disable software write protection or change the range of the protected addresses so no data will be protected (start and end at 0).
Conclusion: If we will disable the software write protection and won't enable it back, then even if we will enable the hardware write protection the firmware chip will stay unprotected.
+
Conclusion: If we will disable the software write protection and will not enable it back, then even if we will enable the hardware write protection the firmware chip will stay unprotected.
  
 
==== Disabling the hardware write protection ====
 
==== Disabling the hardware write protection ====
  
To find the location of the hardware write-protect screw/switch/jumper and how to disable it visit the ArchWiki page for your Chromebook model (see [[Chromebook#Chromebook_Models|Chromebook Models]]). If there's no information about your device on the ArchWiki then turn to [http://www.chromium.org/chromium-os/developer-information-for-chrome-os-devicesDeveloper Information for Chrome OS Devices] and [http://www.coreboot.org/Chromebooks Coreboot's Chromebooks page].
+
To find the location of the hardware write-protect screw/switch/jumper and how to disable it visit the ArchWiki page for your Chromebook model (see [[Chromebook#Chromebook_Models|Chromebook Models]]). If there is no information about your device on the ArchWiki then turn to [http://www.chromium.org/chromium-os/developer-information-for-chrome-os-devicesDeveloper Information for Chrome OS Devices] and [http://www.coreboot.org/Chromebooks Coreboot's Chromebooks page].
  
 
==== Disabling the software write protection ====
 
==== Disabling the software write protection ====

Revision as of 09:37, 28 April 2015

Warning: This article relies on third-party scripts and modifications, and may irreparably damage your hardware or data. Proceed at your own risk.

Tango-edit-clear.pngThis article or section needs language, wiki syntax or style improvements.Tango-edit-clear.png

Reason: This topic on this page were moved out from the Chromebook page as it was too bloated, hard to navigate and follow, the page here is still needs a little more work to stand by it own and we can probably move out a little more details from the Chromebook page to avoid duplicates, anyone who create hot links in other pages to specific topics in this page should be aware that some topics' headers might be change. (Discuss in Talk:Chrome OS devices/Custom firmware#)

Introduction

Why flash a custom firmware?

Pros

  • Adds a much recent version of SeaBIOS
  • Adds SeaBIOS payload of coreboot to Chrome OS devices that did not shipped with SeaBIOS.
  • Reduce boot time.
  • Remove developer Mode screen.
  • Enables VMX.
  • Fixes some issues (like suspend) without further modifications.

Cons

  • Dangerous, might brick your device.
  • Cannot boot stock Chrome OS (you can install Arnold the Bat’s Chromium OS build and it should be possible upgrade it to full blown Chrome OS with a script).
  • It is possible that some quirks will be added, [1].

Flashing the custom firmware

There are several approaches for flashing a custom firmware:

  • Use John Lewis' script which will save you time finding the correct firmware.
  • Use Matt DeVillier's ezScript (currently supports only Chromeboxes).
  • Manually with flashrom, in this case you will need to obtain the firmware by yourself or to compile it from the Coreboot sources (official or Chromium OS fork).

Disable the hardware write protection

See the Disabling the hardware write protection at the Firmware write protection.

Flashing with John Lewis' script

Warning: Do not run the script before disabling the hardware write protection.

Understanding the script

What John Lewis' getnflash_johnlewis_rom.sh script does ?
  • Automatically downloads Chromium OS 32bit version of flashrom.
  • Backup your current firmware.
  • Disables software write protection by running # ./flashrom --wp-disable.
  • Checks the Chromebook product name with dmidecode and download the proper custom firmware.
  • Writes the custom firmware.
What the script does not do ?
  • Does not ask for confirmation.
  • Does not check if the hardware write protection is disabled.
  • Does not confirm the compatibility of a custom firmware to a specific Chromebook sub-model.
Conclusions
Warning: If you are flashing a custom firmware be prepared to the possibility that you might brick your device and make yourself familiar with the unbricking methods.

Running the script in Chrome OS

Note: The reason for not posting here is to force you to visit the site and read the page before proceeding.
  • After the script exited copy the backed up firmware to an external storage before rebooting the system.

You should now have a custom firmware installed on your device, cross your fingers and reboot.

If you flashed the firmware as part of the installation process then continue by following Installing Arch Linux, if the custom firmware boots the installation media correctly then you might want to enable back the hardware write protection.

Running the script in Arch Linux

  • In Arch Linux on 64bit environment you will need to enable the Multilib repository (if it is not already enabled) in pacman.conf and install lib32-glibc.
# pacman -S lib32-glibc
# pacman -S dmidecode
Note: The reason for not posting here is to force you to visit the site and read the page before proceeding.
  • After the script exited copy the backed up firmware to an external storage before rebooting the system.

You should now have a custom firmware installed on your device, cross you fingers and reboot.

If the custom firmware boots Arch Linux correctly then you might want to enable back the hardware write protection, although John Lewis states that it's not necessary and will only make upgrading more difficult later. However, if you do not re-enable it you want to be careful not to use flashrom.

Flashing with ezScript

Currently ezScript supports only Intel based Chromeboxes.

Before installing this custom firmware carefully read instructions at ezScript official page. To install firmware only use install option #5 (Install/update: custom coreboot Firmware).

Manually with flashrom

The use of the upstream flashrom package is discourage as it's missing operations like --wp-disable, --wp-status and it will not write firmware successfully to the ROM of the Chromebook unless it already been programmed externally (i.e. flashing by another device over SPI with SOIC clip), this is why it's recommended to use Chromium OS's flashrom.

Get flashrom for Arch Linux

  • Download a 32bit statically linked Chromium OS's flashrom version, enable the Multilib repository in pacman.conf and install lib32-glibc
# pacman -S lib32-glibc
# wget --no-check-certificate https://johnlewis.ie/flashrom
# chmod +x flashrom

Do not forget that flashrom's location is not in $PATH, to execute it you will need to precede the command with ./, e.g. # ./flashrom.

Get flashrom for Chrome OS

Chrome OS already includes flashrom.

Basic use of flashrom

  • Disable software write protection before writing to the firmware chip.
# flashrom --wp-disable
  • Backup firmware from the firmware chip.
# flashrom -r old_firmware.bin
  • Write firmware to the firmware chip.
# flashrom -w new_firmware.bin
Tip: Find your firmware chip by running the command flashrom -V|grep 'Found' |grep 'flash chip'

Flashing back stock firmware

Note: The following assumes that your device is not bricked, if it does bricked then jump to Unbricking your Chrome OS device

Disable the hardware write protection and follow the how to manually flash firmware with flashrom to flash the backup of your stock firmware.

Unbricking your Chrome OS device

Note: This does not intended to be a thorough guide but just give you a basic understanding of the process of flashing a firmware to a bricked Chromebook. The ArchWiki is not the place for detailed hardware hacking guides so there is no sense in expanding this topic.

Required tools

  • Programmer, both the Raspberry Pi and the Bus Pirate are mentioned as compatible devices on the flashrom wiki. The Bus Pirate is preferable as it will allow you to use Chromium OS's version of flashrom that supports --wp-disable and --wp-status flags.
  • SOIC clip is recommended, see [2].
  • Female jumper wires.
  • If you want to use Chromium OS's flashrom another Linux machine (32bit or 64bit) is required.

General idea on the unbricking process

  • Connect the jumper wires to the programmer and the SOIC clip.
  • Connect the SOIC clip to the ROM chip.
  • If your programmer is running Linux (Raspberry Pi) then modprobe the spi modules.
  • If your programmer is not running Linux then connect it to your Linux machine.
  • Write the firmware with flashrom, you might need to disable software write protection by running flashrom with the --wp-disable flag (this is why Chromium OS's flashrom is handy).

Recommended reading about unbricking

Firmware write protection

Note: The information on this topic only intended to give you the basic understanding on the write protection feature in your Chromebook. The ArchWiki is not the place for detailed hardware hacking guides so there is no sense in expanding this topic.

The firmware (Coreboot and its payloads) stored on a SPI chip (usually SOIC8) that some of its storage is protected from writing (mostly Coreboot).

As long as the write protection was not disabled or the protected range was not set to (0,0) any change made to the unprotected part of the firmware (mainly SeaBIOS) should be recoverable with Chrome OS recovery media.

There are two parts of the write protection: hardware and software.

Hardware write protection

The hardware write protection is an electrical circuit that when it's closed or open it prevent writing to the software protection special registers, thus the hardware write protection only protect directly these special registers but indirectly also the data in the firmware chip.

To disable the hardware write protection you may need to remove a screw, press a switch or short a jumper.

Software write protection

The software write protection are special registers which determining if the data stored in the firmware chip is protected and also holds the range of addresses of the protected data.

Understanding the Process of Disabling the Write Protection

To disable the write protection one would need to:

  • Disable the hardware write protection of the special software register.
  • Change the value of the special software register to disable software write protection or change the range of the protected addresses so no data will be protected (start and end at 0).

Conclusion: If we will disable the software write protection and will not enable it back, then even if we will enable the hardware write protection the firmware chip will stay unprotected.

Disabling the hardware write protection

To find the location of the hardware write-protect screw/switch/jumper and how to disable it visit the ArchWiki page for your Chromebook model (see Chromebook Models). If there is no information about your device on the ArchWiki then turn to Information for Chrome OS Devices and Coreboot's Chromebooks page.

Disabling the software write protection

Chromium OS's flashrom can manipulate the software write protection special registers.

  • Read the status of the software write protection special registers.
# flashrom --wp-status
  • Disable or enable the software write protection.
# flashrom --wp-disable
  • Change software write protection addresses range.
# flashrom --wp-range 0 0

For more details on Chromium OS's flashrom and how to obtain it, see Manually Flash Custom Firmware with flashrom.