blob: 1b2e049a4c3355f171a7fdb1812786abf7a4009e [file] [log] [blame] [view]
Tom Hughes9ae6c932019-08-14 17:00:491# Developer Mode
2
Mike Frysinger05bebd52021-01-27 18:48:113*** note
4**Warning: This document is old & has moved. Please update any links:**<br>
5https://chromium.googlesource.com/chromiumos/docs/+/HEAD/developer_mode.md
6***
7
Tom Hughes9ae6c932019-08-14 17:00:498Production Chrome OS devices that are shipped from the factory are locked down
9and will not let you make changes to the software. This page describes how to
10enable developer mode and get root access to your system.
11
12[TOC]
13
14## Enable Developer Mode {#dev-mode}
15
16Modern 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 Werner6eb5def2020-08-10 20:23:5922*** note
23**Caution:** Modifications you make to the system are not supported by Google,
24may cause hardware, software or security issues and may void warranty.
25***
Tom Hughes9ae6c932019-08-14 17:00:4926
27NOTE: Putting your device into developer mode inherently makes it a little less
28secure. Specifically, it makes the "verified boot" that's built-in to your
29hardware 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 Chen8bad1842020-09-16 19:49:3532If you’re encountering issues putting your device into Developer Mode,
33it's possible that your device administrator has blocked Developer
34Mode access on your device. Please follow the link to read more
35details about [blocked Developer Mode].
36
Tom Hughes9ae6c932019-08-14 17:00:4937You can tell that you're in Developer Mode if you see one of these screens when
38you turn the device on:
39
Shelley Chen236bbd12020-09-30 06:54:0440![developer mode 1] ![developer mode 2] ![developer mode 3] ![developer mode 4]
Tom Hughes9ae6c932019-08-14 17:00:4941
42## Switch to Normal Mode {#normal-mode}
43
44To restore your device to Normal Mode (i.e., disable Developer Mode), reboot
45your 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
52NOTE: If you've made changes to the rootfs filesystem while in developer mode,
53you may have to use the [recovery process] to restore your device to its factory
54condition. However, as long as you don't crack open the case, you shouldn't be
55able to do anything that can't be undone by recovery (software).
56
57## Getting to a Command Prompt {#shell}
58
59If you're a Linux hacker, you probably know that Google Chrome OS is built on
60top of Linux and you're wondering how you can jailbreak your device so you can
61get to a command prompt. It turns out: there's no need. The command prompt is
62built in to your device!
63
64NOTE: 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
69One way to get the login prompt is through something called `VT-2`, or "virtual
70terminal 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
77where the `[ → ]` key is the right-arrow key just above the number `3` on your
78keyboard.
79
80Once you have the login prompt, you should see a set of instructions telling you
81about command-line access. By default, you can login as the `chronos` user with
82no password. This includes the ability to do password-less `sudo`. The
83instructions on the screen will tell you how you can set a password. They also
84tell you how to disable screen dimming.
85
86In order to get back to the browser press:
87
88```
89[ Ctrl ] [ Alt ] [ ← ]
90```
91
92where the `[ ← ]` key is the left-arrow key just above the number `1` on your
93keyboard.
94
95NOTE: The top-rows of the keyboard on a Chrome OS device are actually treated by
96Linux as the keys `F1` through `F10`. Thus, the `[ → ]` key is actually `F2`
97and the `[ ← ]` key is actually `F1`.
98
99NOTE: Kernel messages show up on `VT-8`.
100
101### Getting the Command Prompt Through "crosh" {#crosh}
102
103An alternate way to get to a terminal prompt is to use [`crosh`]:
104
1051. 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.
1071. Press `[ Ctrl ] [ Alt ] [ T ]` to get the [`crosh`] shell.
1081. 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
112NOTE: 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
116If you want to get back to the browser without killing the shell, you can use `[
117Alt ] [ Tab ]`.
118
119NOTE: You can create as many shells as you want with `[ Ctrl ] [ Alt ] [ T ]`
120again and another shell will be opened. You can `[ Alt ] [ Tab ]` between them.
121
122## Making Changes to the Filesystem {#disable-verity}
123
124The Chromium OS rootfs is mounted read-only. In developer mode you can disable
125the rootfs verification, enabling it to be modified.
126
Julius Werner6eb5def2020-08-10 20:23:59127*** note
128**NOTE:** If you mount the root filesystem in writeable mode, even if you make
129no changes, it will no longer be verifiable and you'll have to use a recovery
130image to restore your system when you switch back to normal mode. Auto updates
131may also fail until a full payload is downloaded.
132***
Tom Hughes9ae6c932019-08-14 17:00:49133
134To make your rootfs writable, run the following command from a shell on the
135device:
136
137```bash
138(dut) $ sudo /usr/share/vboot/bin/make_dev_ssd.sh --remove_rootfs_verification
139```
140
141Then 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 Werner7ff4dd42020-08-05 20:45:59156## Booting from USB or SD card
Tom Hughes9ae6c932019-08-14 17:00:49157
Julius Werner7ff4dd42020-08-05 20:45:59158Chromium 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
160first enable booting from external storage by [opening a shell](#shell) and
161running the command `crossystem deb_boot_usb=1`. (Even though this only says
162USB, it will also work for SD cards.)
Tom Hughes9ae6c932019-08-14 17:00:49163
Julius Werner7ff4dd42020-08-05 20:45:59164Afterwards, reboot the device and use the
165[method appropriate for your device][debug buttons] to trigger external storage
166boot when you see the developer mode boot screen.
Tom Hughes9ae6c932019-08-14 17:00:49167
Julius Werner7ff4dd42020-08-05 20:45:59168## Running an alternative bootloader ("legacy BIOS") {#alt-firmware}
Tom Hughes9ae6c932019-08-14 17:00:49169
Julius Werner7ff4dd42020-08-05 20:45:59170You can install an alternative bootloader that may make it easier to boot other
171operating systems. This does **not** require you to disable firmware write
172protection (with its associated risks).
173
Julius Werner6eb5def2020-08-10 20:23:59174*** note
175**NOTE:** Some Chrome OS devices may ship with one or more alternative
176bootloaders pre-installed. These are merely provided as examples of how to set
177up the alternative bootloader feature. They are not officially supported,
178usually not tested and may or may not work at all or do anything useful. The
179point of the alternative bootloader feature is just to allow users to install
180their own -- we may occasionally pre-install software if it is readily
181available, but we are not committing to test and maintain it or to provide the
182same set across all platforms.
Julius Werner7ff4dd42020-08-05 20:45:59183
Julius Werner6eb5def2020-08-10 20:23:59184You can also find ready-made alternative bootloaders to install on third-party
Julius Werner7ff4dd42020-08-05 20:45:59185community sites such as [mrchromebox.tech]. Note that these sites are not
186affiliated with Google or the Chromium OS project and we are not responsible for
Julius Werner6eb5def2020-08-10 20:23:59187any issues or damages arising from them. Use at your own risk.
188***
Julius Werner7ff4dd42020-08-05 20:45:59189
190Alternative bootloaders must be packaged as a coreboot payload and installed in
191the `RW_LEGACY` section of the firmware flash. You can read out the flash and
192print the contents of this section by [opening a shell](#shell) and running
193```
194flashrom -r /tmp/bios.bin
195cbfstool /tmp/bios.bin print -r RW_LEGACY
196```
197If you see a file called `altfw/list` in this output, you have a 2019+ platform
198that supports having more than one alternative bootloader installed at the same
199time. 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
201via `cbfstool /tmp/bios.bin remove -r RW_LEGACY -n payload` to make room.
202
203The new bootloader you want to add should be formatted as an ELF file. Make sure
204that the entry point information in the file is correctly set and that it
205contains code able to run in a firmware environment (i.e. no operating system
206support, nothing set up other than what coreboot usually provides to its
207payloads). Then add the file via
208```
209cbfstool /tmp/bios.bin add-payload -r RW_LEGACY -c lzma -n <your bootloader name> -f <path/to/your/bootloader.elf>
210```
211On an older platform make sure the name is `payload` and you're done. On a newer
212platform, you can choose any name you want but you need to enter it in the
213bootloader directory file. Extract this file with
214```
215cbfstool /tmp/bios.bin extract -r RW_LEGACY -n altfw/list -f /tmp/altfw.txt
216```
217and edit `/tmp/altfw.txt` with a normal text editor (e.g. `nano`). The file
218contains one line per bootloader with the following values separated by
219semicolons:
220
Julius Werner6eb5def2020-08-10 20:23:592211. 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.
2251. Name of the bootloader in CBFS (i.e. the `-n` parameter to `cbfstool`)
2261. Name of the bootloader that shall appear in the developer mode menu
2271. Comment field for more detailed description (not used by firmware)
Julius Werner7ff4dd42020-08-05 20:45:59228
229Add a line for the bootloader you just added, save the file, then replace the
230file in CBFS with the updated version via
231```
232cbfstool /tmp/bios.bin remove -r RW_LEGACY -n altfw/list
233cbfstool /tmp/bios.bin add -r RW_LEGACY -n altfw/list -f /tmp/altfw.txt -t raw
234```
235You may also want to delete the `cros_allow_auto_update` file, if present. This
236will prevent future Chrome OS system updates from overwriting the alternative
237bootloader section after you modified it:
238```
239cbfstool /tmp/bios.bin remove -r RW_LEGACY -n cros_allow_auto_update
240```
241Finally, you must write the modified CBFS section back to the firmware flash and
242tell the firmware to enable the alternative bootloader feature:
243```
244flashrom -w /tmp/bios.bin -i RW_LEGACY
245crossystem dev_boot_legacy=1
246```
247Now you can reboot and use the
248[method appropriate for your device][debug buttons] to run your alternative
249bootloader when you see the developer mode boot screen.
Tom Hughes9ae6c932019-08-14 17:00:49250
251<!-- Links -->
252
253[`VT-2`]: #vt2
Julius Werner6eb5def2020-08-10 20:23:59254[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 Werner7ff4dd42020-08-05 20:45:59259[mrchromebox.tech]: https://mrchromebox.tech
Tom Hughes9ae6c932019-08-14 17:00:49260[recovery process]: https://www.google.com/chromeos/recovery
Shelley Chen8bad1842020-09-16 19:49:35261[blocked Developer Mode]: https://support.google.com/chrome/a/answer/6150653
Tom Hughes9ae6c932019-08-14 17:00:49262
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 Chen236bbd12020-09-30 06:54:04268[developer mode 4]: ./images/developer_mode4.jpg