imperador / chromefy

Project Croissant: Install Chrome OS on any Computer - Transforming Chromium to Chrome
GNU General Public License v3.0
880 stars 80 forks source link

This project is not regularly maintained anymore. We suggest you to use Brunch Framework instead

Project Croissant

Transforming Chromium to Chrome

You can find us at the Telegram Group: https://t.me/chromeosforpc

Please, ask your questions at the group and don't PM the admins. :)

You can also follow us on Twitter: https://twitter.com/CroissantDev

Observations


Required Files

Installation Methods

Project Croissant has three installation options. The first option generates an img ready to deploy into your usb stick and then you can boot from it to install Chrome at your computer. The last two options will probably require you to resize the third partition of your sdX drive (EX: sda3 inside sda) from its current size to atleast 4GB; I suggest using Gparted live USB to resize it;

Option 1: Automated generation of Chrome img

Option 2-A: Automated Script (drive)

Option 2-B: Automated Script (partition)

Option 3: Manual Configuration

Choose the best method for you and follow the installation process.


Installation Process

With the automated script method you can either generate your own Chrome img ready to run and install (Option 1) or you can also apply the Chrome into a installed Chromium at your computer (Option 2). I strongly suggest you to use the first one, because it will also allows you to have a backup img to deploy anytime you want to install it on a new pc.

Option 1: Automated Script - Generating your own Chrome img:

Here you will generate your img and then deploy it to a usb stick, this will allow you to install it on your computer. If you already have a Project Croissant generated ChromeOS img, you can deploy it to a usb stick, boot from it at your computer and then jump to the Installing an img at your computer. We won't provide the imgs.

Generating the img

Log into a Linux or Chromium OS computer. Download your Chromium image (e.g Arnold the bat), your ChromeOS recovery image (e.g Eve), TPM2 emulator (swtpm.tar) or TPM1.2 ChromeOS recovery image (e.g Caroline [https://cros-updates-serving.appspot.com]) and the Croissant.sh script (https://github.com/imperador/chromefy/releases). Place all the files in one location. Downloads is a good idea.

In the next step you need to replace '{path}' with the location of all these files. If you put them in Downloads then {path} would be replaced with 'home/chronos/user/Downloads'. If the files are in another folder, replace it with the other folder location. If you don't know how to discover the path, internet is your friend, you can learn how to discover it.

Note: Your original chromium.img file will be replaced, so backup it if you want

Now open a terminal (if you’re using ChromiumOS press CTRL + ALT + T, then type the command shell.) For any other Linux OS a normal terminal is fine, and then type the following commands:

sudo su
cd {path}
bash  croissant.sh  chromium.img  recovery.bin  caroline.bin

or

sudo  bash  croissant.sh  chromium.img  recovery.bin  swtpm.tar

Reminder: {path} is the folder where you saved your files

After finishing the process, you will have the chromium.img. It is now a full ChromeOS img. You can use any program to deploy it to a usb stick and boot from it. Programs like Etcher (Windows or Linux), Rufus (Windows only) and Chromebook Recovery Utility (Chromium only) will do the work. Just deply the img to your usb stick.

Installing an img at your computer

If you already have a Project Croissant generated ChromeOS img, you can deploy it to a usb stick and then just boot from it at your computer.

When the login screen appears, press "CTRL + ALT + F2" and type the following commands:

chronos
sudo su
cd /
sudo   /usr/sbin/chromeos-install  --dst  /dev/sda  --skip_postinstall

When the process finish, turn off your computer, remove your usb stick and turn it on again. It will boot into your Chrome OS device. Congratulations!

Fixing Grub

If it doesn't work after your reboot, just boot into your USB stick again, make sure you have an internet connection, go to the shell command line and type this command:

curl  -L  https://goo.gl/HdjwAZ   |  sudo  bash  -s  /dev/sda

Updating Chrome OS

To update Chrome OS, repeat the process, but when you run chromeos-install make sure to add the flag --preserve_stateful like so:

chromeos-install --dst /dev/sda --skip_postinstall --preserve_stateful

This ensures that existing Chrome OS user data is not wiped.


Option 2: Automated Script - Applying Chrome to Chromium:

Flash the selected Chromium OS build on the first USB, boot into the live USB and install it on your HDD/SSD by typing the following command on the shell (keep in mind this will wipe your HDD, so backup everything you need and don't blame us later)

sudo /usr/sbin/chromeos-install --dst YOURDRIVE (Ex: /dev/sda)

OPTION 2B ONLY: Resize the third partition of your sdX drive (EX: sda3 inside sda) from its current size to atleast 4GB (suggestion: search about using Gparted live USB to resize it). And remember: You can either downsize sdX1 (data partition) or delete the sdX5 partition (we won't need it) to get more unallocated space.

Multiboot users: You must use the ROOT-A partition instead of your third partition (sda3).

After this, connect both USB sticks to you computer and boot from your live USB again (with Chromium), make sure you have your Chrome OS images available (on the second USB stick) and go to the folder where you downloaded the croissant script and run it with the following command (considering your system partition as /dev/sda3):

OPTION 2A:

sudo bash croissant.sh /dev/sda /path/to/chosenImg.bin /path/to/carolineImg.bin_OR_swtpm.tar

OPTION 2B:

sudo bash croissant.sh /dev/sda3 /path/to/chosenImg.bin /path/to/carolineImg.bin_OR_swtpm.tar

Don't leave live USB yet, make a powerwash (manually) by typing

sudo mkfs.ext4 YOURDATAPARTITION(Ex: /dev/sda1)

You can now reboot and enjoy your new "chromebook"

To update, repeat the process, but:

1. when you run chromeos-install make sure to add the flag --preserve_stateful like so:

    * chromeos-install  --dst  /dev/sda  --skip_postinstall --preserve_stateful

2. Run Option 2B, *even if* you installed with option 2A.

3. Omit the last step where you run mkfs.ext4

Option 3: Manual Configuration

After finishing installing a Chromium OS, open the browser and press CTRL+ALT+T to open chroot Type:

shell
sudo su

Installing Chrome OS (some notes):

Configuring the new Chrome partition

Use the following commands to configure the sda5 (or nvem0n1p5) and other basic things (the exemple is using caroline recovery file): Type "lsblk" to know your partitions. Search for sda, sdb or nvme0n1 with the size of your usb or HDD. In the following commands, change "sda" for the one that you've found:

losetup -fP {path}/chosenImg.bin
mkdir /home/chronos/image
mkdir /home/chronos/local
mkfs.ext4 /dev/sda5
mount /dev/sda5 /home/chronos/local

Copying the img to the local path

Type "losetup" to get a list, search for loop{number} that has the img file on it Memorise the number. So if it is loop2, then {number} = 2 Type the following commands (using the {number} that you got in the last step):

mount /dev/loop{number}p3 /home/chronos/image -o loop,ro
cp -av /home/chronos/image/* /home/chronos/local
rm -rf /home/chronos/local/lib/firmware
rm -rf /home/chronos/local/lib/modules/ 
cp -av /lib/firmware /home/chronos/local/lib/
cp -av /lib/modules/ /home/chronos/local/lib/
rm -rf /home/chronos/local/etc/modprobe.d/alsa-skl.conf

Change in /home/chronos/local/etc/selinux/config the word enforcing to permissive with the following command:

sudo sed '0,/enforcing/s/enforcing/permissive/' -i /home/chronos/local/etc/selinux/config

Type "sync" and press Enter

Now restart your computer. When the screen with the boot options appear (the grub), press 'e' FAST (or it will boot into the chromium). You will have to change the root for: root=/dev/sda5

Now press F10. If it boots corectly, you are ready to go

ADDITIONAL:


Using ChromeOS with other Operating systems (Multiboot)

Not everyone is willing to wipe their hard drives just to install ArnoldTheBats Chromium as a base, and for those people we have made a handy multiboot guide. You can check it out here: MultiBoot Guide

Chainloading is not a requirement with ArnoldTheBats Chromium, however you may need to when you make the initial ChromeOS upgrade. Also remember to save your partition layout in between upgrades to newer ChromeOS versions, and also when you initially upgrade to ChromeOS otherwise it will not find the State partition which is needed for a successful boot.


Updating ChromeOS (for the Method 3)

Updating ChromeOS and Chromium Native: The Setup

You will need a Live USB of any Linux distribution. I recommend Mint or Ubuntu. Note: Replace "chronos" with the your username if dual booting or the name of the of distribution if booting from USB

Find and download the updated recovery image for the device you used at chrome.qwedl.com

Now type in the following commands in the Linux terminal:

losetup -fP /home/chronos/user/Downloads/chromeos_image.bin
losetup -fP /home/chronos/user/Downloads/chromium_image.bin
mount /dev/sda5 /home/chronos/local
losetup

The last call of losetup without paramaters prints a list of Loop devices, find the one that corresponds to your ChromeOS and Chromium Image and then type:

mount /dev/loop{chromeos_number}p3 /home/chronos/image -o loop,ro
mount /dev/loop{chromium_number}p3 /home/chronos/native -o loop,ro

Updating both ChromeOS and Chromium Native: The actual upgrade

Remember, the commands outlined here must be done in EXACTLY this order to guarantee everything goes smoothly. IF you don't do this and find neither the touchscreen, trackpad, or keyboard works, that's on you. Not me, or anyone else.

rm -rf /home/chronos/local/*
cp -av /home/chronos/image/* /home/chronos/local
rm -rf /home/chronos/local/lib/firmware
rm -rf /home/chronos/local/lib/modules/
cp -av /home/chronos/native/lib/firmware /home/chronos/local/lib/
cp -av /home/chronos/native/lib/modules /home/chronos/local/lib/
rm -rf /home/chronos/local/etc/modprobe/alsa-.conf

(Alsa-* being whatever the config name is, in my case it would be Alsa-skl.conf)

Change in /home/chronos/local/etc/selinux/config the word enforcing to permissive with the following command:

sudo sed '0,/enforcing/s/enforcing/permissive/' -i /home/chronos/local/etc/selinux/config

If you use multiboot, do not forget to change /usr/sbin/write_gpt.sh again. For details, see the multiboot section above.


Resolving Problems With Login

Bypassing TPM for select recovery images (Eve, Fizz, etc)


Credits:

Big Thanks: