| Tom Hughes | 9ae6c93 | 2019-08-14 17:00:49 | [diff] [blame] | 1 | # Developer Mode |
| 2 | |
| Mike Frysinger | 05bebd5 | 2021-01-27 18:48:11 | [diff] [blame] | 3 | *** note |
| 4 | **Warning: This document is old & has moved. Please update any links:**<br> |
| 5 | https://chromium.googlesource.com/chromiumos/docs/+/HEAD/developer_mode.md |
| 6 | *** |
| 7 | |
| Tom Hughes | 9ae6c93 | 2019-08-14 17:00:49 | [diff] [blame] | 8 | Production Chrome OS devices that are shipped from the factory are locked down |
| 9 | and will not let you make changes to the software. This page describes how to |
| 10 | enable developer mode and get root access to your system. |
| 11 | |
| 12 | [TOC] |
| 13 | |
| 14 | ## Enable Developer Mode {#dev-mode} |
| 15 | |
| 16 | Modern Chrome OS devices can be put into developer mode by pressing |
| 17 | [specific keys][debug buttons] while Chrome OS is booting: |
| 18 | |
| 19 | * [Developer mode for devices with a keyboard][keyboard developer mode] |
| 20 | * [Developer mode for devices without a keyboard (tablets)][keyboardless developer mode] |
| 21 | |
| Julius Werner | 6eb5def | 2020-08-10 20:23:59 | [diff] [blame] | 22 | *** note |
| 23 | **Caution:** Modifications you make to the system are not supported by Google, |
| 24 | may cause hardware, software or security issues and may void warranty. |
| 25 | *** |
| Tom Hughes | 9ae6c93 | 2019-08-14 17:00:49 | [diff] [blame] | 26 | |
| 27 | NOTE: Putting your device into developer mode inherently makes it a little less |
| 28 | secure. Specifically, it makes the "verified boot" that's built-in to your |
| 29 | hardware a little bit more lax, allowing your hardware to run custom |
| 30 | (non-Google-signed) images. It also gives you access to a "root" shell. |
| 31 | |
| Shelley Chen | 8bad184 | 2020-09-16 19:49:35 | [diff] [blame] | 32 | If you’re encountering issues putting your device into Developer Mode, |
| 33 | it's possible that your device administrator has blocked Developer |
| 34 | Mode access on your device. Please follow the link to read more |
| 35 | details about [blocked Developer Mode]. |
| 36 | |
| Tom Hughes | 9ae6c93 | 2019-08-14 17:00:49 | [diff] [blame] | 37 | You can tell that you're in Developer Mode if you see one of these screens when |
| 38 | you turn the device on: |
| 39 | |
| Shelley Chen | 236bbd1 | 2020-09-30 06:54:04 | [diff] [blame] | 40 | ![developer mode 1] ![developer mode 2] ![developer mode 3] ![developer mode 4] |
| Tom Hughes | 9ae6c93 | 2019-08-14 17:00:49 | [diff] [blame] | 41 | |
| 42 | ## Switch to Normal Mode {#normal-mode} |
| 43 | |
| 44 | To restore your device to Normal Mode (i.e., disable Developer Mode), reboot |
| 45 | your device and perform the following action: |
| 46 | |
| 47 | * Device with keyboard: Press the `Spacebar` at the firmware screen. |
| 48 | * Devices without keyboard (tablet): Use the `Volume-Up` and `Volume-Down` |
| 49 | keys to select the `Enable OS Verification` option. Press the `Power` button |
| 50 | to confirm. |
| 51 | |
| 52 | NOTE: If you've made changes to the rootfs filesystem while in developer mode, |
| 53 | you may have to use the [recovery process] to restore your device to its factory |
| 54 | condition. However, as long as you don't crack open the case, you shouldn't be |
| 55 | able to do anything that can't be undone by recovery (software). |
| 56 | |
| 57 | ## Getting to a Command Prompt {#shell} |
| 58 | |
| 59 | If you're a Linux hacker, you probably know that Google Chrome OS is built on |
| 60 | top of Linux and you're wondering how you can jailbreak your device so you can |
| 61 | get to a command prompt. It turns out: there's no need. The command prompt is |
| 62 | built in to your device! |
| 63 | |
| 64 | NOTE: Before following these instructions, remember to put your device into |
| 65 | [Developer Mode](#dev-mode). |
| 66 | |
| 67 | ### Get the Command Prompt Through VT-2 {#vt2} |
| 68 | |
| 69 | One way to get the login prompt is through something called `VT-2`, or "virtual |
| 70 | terminal 2". If you're a Linux user, this is probably familiar. You can get to |
| 71 | `VT-2` by pressing: |
| 72 | |
| 73 | ``` |
| 74 | [ Ctrl ] [ Alt ] [ → ] |
| 75 | ``` |
| 76 | |
| 77 | where the `[ → ]` key is the right-arrow key just above the number `3` on your |
| 78 | keyboard. |
| 79 | |
| 80 | Once you have the login prompt, you should see a set of instructions telling you |
| 81 | about command-line access. By default, you can login as the `chronos` user with |
| 82 | no password. This includes the ability to do password-less `sudo`. The |
| 83 | instructions on the screen will tell you how you can set a password. They also |
| 84 | tell you how to disable screen dimming. |
| 85 | |
| 86 | In order to get back to the browser press: |
| 87 | |
| 88 | ``` |
| 89 | [ Ctrl ] [ Alt ] [ ← ] |
| 90 | ``` |
| 91 | |
| 92 | where the `[ ← ]` key is the left-arrow key just above the number `1` on your |
| 93 | keyboard. |
| 94 | |
| 95 | NOTE: The top-rows of the keyboard on a Chrome OS device are actually treated by |
| 96 | Linux as the keys `F1` through `F10`. Thus, the `[ → ]` key is actually `F2` |
| 97 | and the `[ ← ]` key is actually `F1`. |
| 98 | |
| 99 | NOTE: Kernel messages show up on `VT-8`. |
| 100 | |
| 101 | ### Getting the Command Prompt Through "crosh" {#crosh} |
| 102 | |
| 103 | An alternate way to get to a terminal prompt is to use [`crosh`]: |
| 104 | |
| 105 | 1. Go through the standard Chrome OS login screen (you'll need to setup a |
| 106 | network, etc) and get to the web browser. It's OK if you login as guest. |
| 107 | 1. Press `[ Ctrl ] [ Alt ] [ T ]` to get the [`crosh`] shell. |
| 108 | 1. Use the shell command to get the shell prompt. NOTE: even if you set a |
| 109 | password for the chronos user, you won't need it here (though you still need |
| 110 | it for sudo access) |
| 111 | |
| 112 | NOTE: Entering the shell this way doesn't give you all the instructions that |
| 113 | [`VT-2`] does (like how to set your password). You might want to follow the |
| 114 | [`VT-2`] steps once just to get the instructions. |
| 115 | |
| 116 | If you want to get back to the browser without killing the shell, you can use `[ |
| 117 | Alt ] [ Tab ]`. |
| 118 | |
| 119 | NOTE: You can create as many shells as you want with `[ Ctrl ] [ Alt ] [ T ]` |
| 120 | again and another shell will be opened. You can `[ Alt ] [ Tab ]` between them. |
| 121 | |
| 122 | ## Making Changes to the Filesystem {#disable-verity} |
| 123 | |
| 124 | The Chromium OS rootfs is mounted read-only. In developer mode you can disable |
| 125 | the rootfs verification, enabling it to be modified. |
| 126 | |
| Julius Werner | 6eb5def | 2020-08-10 20:23:59 | [diff] [blame] | 127 | *** note |
| 128 | **NOTE:** If you mount the root filesystem in writeable mode, even if you make |
| 129 | no changes, it will no longer be verifiable and you'll have to use a recovery |
| 130 | image to restore your system when you switch back to normal mode. Auto updates |
| 131 | may also fail until a full payload is downloaded. |
| 132 | *** |
| Tom Hughes | 9ae6c93 | 2019-08-14 17:00:49 | [diff] [blame] | 133 | |
| 134 | To make your rootfs writable, run the following command from a shell on the |
| 135 | device: |
| 136 | |
| 137 | ```bash |
| 138 | (dut) $ sudo /usr/share/vboot/bin/make_dev_ssd.sh --remove_rootfs_verification |
| 139 | ``` |
| 140 | |
| 141 | Then reboot. Your rootfs will be mounted read/write. |
| 142 | |
| 143 | ## Specifying Command Line Flags for Chrome {#chrome-cmdline-flags} |
| 144 | |
| 145 | * [Enable developer mode.](#dev-mode) |
| 146 | * [Disable rootfs verification.](#disable-verity) |
| 147 | * [Access a shell.](#shell) |
| 148 | * Modify `/etc/chrome_dev.conf` (read the comments in the file for more |
| 149 | details). |
| 150 | * Restart the UI with: |
| 151 | |
| 152 | ```bash |
| 153 | (dut) $ sudo restart ui |
| 154 | ``` |
| 155 | |
| Julius Werner | 7ff4dd4 | 2020-08-05 20:45:59 | [diff] [blame] | 156 | ## Booting from USB or SD card |
| Tom Hughes | 9ae6c93 | 2019-08-14 17:00:49 | [diff] [blame] | 157 | |
| Julius Werner | 7ff4dd4 | 2020-08-05 20:45:59 | [diff] [blame] | 158 | Chromium OS can be installed on a USB stick or SD card, for example if you |
| 159 | [build it yourself][Building Chromium OS]. In order to boot these, you have to |
| 160 | first enable booting from external storage by [opening a shell](#shell) and |
| 161 | running the command `crossystem deb_boot_usb=1`. (Even though this only says |
| 162 | USB, it will also work for SD cards.) |
| Tom Hughes | 9ae6c93 | 2019-08-14 17:00:49 | [diff] [blame] | 163 | |
| Julius Werner | 7ff4dd4 | 2020-08-05 20:45:59 | [diff] [blame] | 164 | Afterwards, reboot the device and use the |
| 165 | [method appropriate for your device][debug buttons] to trigger external storage |
| 166 | boot when you see the developer mode boot screen. |
| Tom Hughes | 9ae6c93 | 2019-08-14 17:00:49 | [diff] [blame] | 167 | |
| Julius Werner | 7ff4dd4 | 2020-08-05 20:45:59 | [diff] [blame] | 168 | ## Running an alternative bootloader ("legacy BIOS") {#alt-firmware} |
| Tom Hughes | 9ae6c93 | 2019-08-14 17:00:49 | [diff] [blame] | 169 | |
| Julius Werner | 7ff4dd4 | 2020-08-05 20:45:59 | [diff] [blame] | 170 | You can install an alternative bootloader that may make it easier to boot other |
| 171 | operating systems. This does **not** require you to disable firmware write |
| 172 | protection (with its associated risks). |
| 173 | |
| Julius Werner | 6eb5def | 2020-08-10 20:23:59 | [diff] [blame] | 174 | *** note |
| 175 | **NOTE:** Some Chrome OS devices may ship with one or more alternative |
| 176 | bootloaders pre-installed. These are merely provided as examples of how to set |
| 177 | up the alternative bootloader feature. They are not officially supported, |
| 178 | usually not tested and may or may not work at all or do anything useful. The |
| 179 | point of the alternative bootloader feature is just to allow users to install |
| 180 | their own -- we may occasionally pre-install software if it is readily |
| 181 | available, but we are not committing to test and maintain it or to provide the |
| 182 | same set across all platforms. |
| Julius Werner | 7ff4dd4 | 2020-08-05 20:45:59 | [diff] [blame] | 183 | |
| Julius Werner | 6eb5def | 2020-08-10 20:23:59 | [diff] [blame] | 184 | You can also find ready-made alternative bootloaders to install on third-party |
| Julius Werner | 7ff4dd4 | 2020-08-05 20:45:59 | [diff] [blame] | 185 | community sites such as [mrchromebox.tech]. Note that these sites are not |
| 186 | affiliated with Google or the Chromium OS project and we are not responsible for |
| Julius Werner | 6eb5def | 2020-08-10 20:23:59 | [diff] [blame] | 187 | any issues or damages arising from them. Use at your own risk. |
| 188 | *** |
| Julius Werner | 7ff4dd4 | 2020-08-05 20:45:59 | [diff] [blame] | 189 | |
| 190 | Alternative bootloaders must be packaged as a coreboot payload and installed in |
| 191 | the `RW_LEGACY` section of the firmware flash. You can read out the flash and |
| 192 | print the contents of this section by [opening a shell](#shell) and running |
| 193 | ``` |
| 194 | flashrom -r /tmp/bios.bin |
| 195 | cbfstool /tmp/bios.bin print -r RW_LEGACY |
| 196 | ``` |
| 197 | If you see a file called `altfw/list` in this output, you have a 2019+ platform |
| 198 | that supports having more than one alternative bootloader installed at the same |
| 199 | time. Otherwise, you can only install a single bootloader that must be called |
| 200 | `payload`. In that case you may need to remove an already installed bootloader |
| 201 | via `cbfstool /tmp/bios.bin remove -r RW_LEGACY -n payload` to make room. |
| 202 | |
| 203 | The new bootloader you want to add should be formatted as an ELF file. Make sure |
| 204 | that the entry point information in the file is correctly set and that it |
| 205 | contains code able to run in a firmware environment (i.e. no operating system |
| 206 | support, nothing set up other than what coreboot usually provides to its |
| 207 | payloads). Then add the file via |
| 208 | ``` |
| 209 | cbfstool /tmp/bios.bin add-payload -r RW_LEGACY -c lzma -n <your bootloader name> -f <path/to/your/bootloader.elf> |
| 210 | ``` |
| 211 | On an older platform make sure the name is `payload` and you're done. On a newer |
| 212 | platform, you can choose any name you want but you need to enter it in the |
| 213 | bootloader directory file. Extract this file with |
| 214 | ``` |
| 215 | cbfstool /tmp/bios.bin extract -r RW_LEGACY -n altfw/list -f /tmp/altfw.txt |
| 216 | ``` |
| 217 | and edit `/tmp/altfw.txt` with a normal text editor (e.g. `nano`). The file |
| 218 | contains one line per bootloader with the following values separated by |
| 219 | semicolons: |
| 220 | |
| Julius Werner | 6eb5def | 2020-08-10 20:23:59 | [diff] [blame] | 221 | 1. Number of the bootloader in the developer mode menu (0 through 9) |
| 222 | * NOTE: The bootloader number 0 is always the "default" that will boot |
| 223 | if `dev_default_boot=legacy` is set and the developer boot screen |
| 224 | timer runs out. |
| 225 | 1. Name of the bootloader in CBFS (i.e. the `-n` parameter to `cbfstool`) |
| 226 | 1. Name of the bootloader that shall appear in the developer mode menu |
| 227 | 1. Comment field for more detailed description (not used by firmware) |
| Julius Werner | 7ff4dd4 | 2020-08-05 20:45:59 | [diff] [blame] | 228 | |
| 229 | Add a line for the bootloader you just added, save the file, then replace the |
| 230 | file in CBFS with the updated version via |
| 231 | ``` |
| 232 | cbfstool /tmp/bios.bin remove -r RW_LEGACY -n altfw/list |
| 233 | cbfstool /tmp/bios.bin add -r RW_LEGACY -n altfw/list -f /tmp/altfw.txt -t raw |
| 234 | ``` |
| 235 | You may also want to delete the `cros_allow_auto_update` file, if present. This |
| 236 | will prevent future Chrome OS system updates from overwriting the alternative |
| 237 | bootloader section after you modified it: |
| 238 | ``` |
| 239 | cbfstool /tmp/bios.bin remove -r RW_LEGACY -n cros_allow_auto_update |
| 240 | ``` |
| 241 | Finally, you must write the modified CBFS section back to the firmware flash and |
| 242 | tell the firmware to enable the alternative bootloader feature: |
| 243 | ``` |
| 244 | flashrom -w /tmp/bios.bin -i RW_LEGACY |
| 245 | crossystem dev_boot_legacy=1 |
| 246 | ``` |
| 247 | Now you can reboot and use the |
| 248 | [method appropriate for your device][debug buttons] to run your alternative |
| 249 | bootloader when you see the developer mode boot screen. |
| Tom Hughes | 9ae6c93 | 2019-08-14 17:00:49 | [diff] [blame] | 250 | |
| 251 | <!-- Links --> |
| 252 | |
| 253 | [`VT-2`]: #vt2 |
| Julius Werner | 6eb5def | 2020-08-10 20:23:59 | [diff] [blame] | 254 | [Building Chromium OS]: developer_guide.md#Building-Chromium-OS |
| 255 | [crosh]: https://chromium.googlesource.com/chromiumos/platform2/+/HEAD/crosh |
| 256 | [debug buttons]: debug_buttons.md |
| 257 | [keyboard developer mode]: debug_buttons.md#firmware-keyboard-interface |
| 258 | [keyboardless developer mode]: debug_buttons.md#firmware-menu-interface |
| Julius Werner | 7ff4dd4 | 2020-08-05 20:45:59 | [diff] [blame] | 259 | [mrchromebox.tech]: https://mrchromebox.tech |
| Tom Hughes | 9ae6c93 | 2019-08-14 17:00:49 | [diff] [blame] | 260 | [recovery process]: https://www.google.com/chromeos/recovery |
| Shelley Chen | 8bad184 | 2020-09-16 19:49:35 | [diff] [blame] | 261 | [blocked Developer Mode]: https://support.google.com/chrome/a/answer/6150653 |
| Tom Hughes | 9ae6c93 | 2019-08-14 17:00:49 | [diff] [blame] | 262 | |
| 263 | <!-- Images --> |
| 264 | |
| 265 | [developer mode 1]: ./images/developer_mode1.jpg |
| 266 | [developer mode 2]: ./images/developer_mode2.jpg |
| 267 | [developer mode 3]: ./images/developer_mode3.jpg |
| Shelley Chen | 236bbd1 | 2020-09-30 06:54:04 | [diff] [blame] | 268 | [developer mode 4]: ./images/developer_mode4.jpg |