2019年2月17日星期日

Chromium OS official installation method defects:
1. Format the entire hard disk, it is difficult to carry out multi-system boot and boot installation;
2. Generate 12 gpt partitions, unable to perform partition maintenance adjustment;
3. Unreasonable hard disk layout, ESP partition and root file  system partition (ROOT_A, /dev/sda3) allocation space is too small, ROOT_A allocation space is only 2GB, long-term operation will seriously reduce system efficiency.

The effect of fully customized installation:
1. Format the hard disk optional, if you keep the original system (such as win10) need to manually configure multi-system boot;
 2. Only need 3 gpt partitions, one ESP (EFI boot partition, /dev/ sda1), a ROOT_A partition (Chromium OS root file partition, /dev/sda2), a STATE partition (Chromium OS data partition, /dev/sda3);
3. According to the actual hard disk situation, reasonably allocate three gpt partition sizes, old notebooks run smoothly.

Custom installation to USB looks like this:
chronos@localhost / $ sudo fdisk -l /dev/sdb
Disk /dev/sdb: 57.6 GiB, 61872793600 bytes, 120845300 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: DE104D23-DE67-4F24-8A6A-F35712914425

Device        Start       End  Sectors  Size Type
/dev/sdb1      2048   1050623  1048576  512M EFI System
/dev/sdb2   1050624  21530623 20480000  9.8G Linux filesystem
/dev/sdb3  21530624 120844287 99313664 47.4G Microsoft basic data

Custom installation to the hard drive and implementation of arch linux multi-system boot looks like this:
chronos@localhost / $ sudo fdisk -l /dev/sda
Password: 
Disk /dev/sda: 698.7 GiB, 750156374016 bytes, 1465149168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 35763ECA-E90B-F247-BFED-C52F84306069

Device          Start        End   Sectors  Size Type
/dev/sda1        2048    1050623   1048576  512M EFI System
/dev/sda2     1050624   84936703  83886080   40G ChromeOS root fs
/dev/sda3    84936704  294651903 209715200  100G Linux filesystem
/dev/sda4   294651904  311429119  16777216    8G Linux swap
/dev/sda5   311429120  626001919 314572800  150G Linux root\x09(IA-64)
/dev/sda6   626001920 1045432319 419430400  200G Linux home

1. Make the Chromium OS USB installation disk and start the computer.Download it from here.
        Go to the "Let's go" screen and open the settings in the lower right corner of the screen to confirm that wifi is properly driven. Switch to terminal 2 with Ctrl + Alt + F2, enter the login name: chronos, the password is empty, and enter the Chromium OS console.

2. Disk partition and make file system.
        At the command line type: sudo su, switch to the root user. At this point you can choose to customize the installation to the hard disk (note the backup hard disk data) or another usb (injection of another usb at this time), the operation is exactly the same. I choose the second usb here, pay attention to confirm the device name with the fdisk -l command.
chronos@localhost / $ sudo su
localhost / # fdisk -l

Disk /dev/sdc: 28.9 GiB, 31043616768 bytes, 60632064 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00000000

        According to the actual situation, determine the size of the three partitions. Note that the hard disk replaces /dev/sdc with /dev/sda, and the original data will disappear.
localhost / # fdisk /dev/sdc

Welcome to fdisk (util-linux 2.32).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): g
Created a new GPT disklabel (GUID: 15A60008-EFAC-2847-930D-FAC8BCB11246).
The old vfat signature will be removed by a write command.

Command (m for help): n
Partition number (1-128, default 1): 
First sector (2048-60632030, default 2048): 
Last sector, +sectors or +size{K,M,G,T,P} (2048-60632030, default 60632030): +512M

Created a new partition 1 of type 'Linux filesystem' and of size 512 MiB.

Command (m for help): t
Selected partition 1
Partition type (type L to list all types): 1
Changed type of partition 'Linux filesystem' to 'EFI System'.
Command (m for help): n
Partition number (2-128, default 2): 
First sector (1050624-60632030, default 1050624): 
Last sector, +sectors or +size{K,M,G,T,P} (1050624-60632030, default 60632030): +10G

Created a new partition 2 of type 'Linux filesystem' and of size 10 GiB.

Command (m for help): t
Partition number (1,2, default 2): 
Partition type (type L to list all types): 66

Changed type of partition 'Linux filesystem' to 'ChromeOS root fs'.

Command (m for help): n
Partition number (3-128, default 3): 
First sector (22022144-60632030, default 22022144): 
Last sector, +sectors or +size{K,M,G,T,P} (22022144-60632030, default 60632030): 

Created a new partition 3 of type 'Linux filesystem' and of size 18.4 GiB.

Command (m for help): t
Partition number (1-3, default 3): 
Partition type (type L to list all types): 20

Changed type of partition 'Linux filesystem' to 'Linux filesystem'.

Command (m for help): p
Disk /dev/sdc: 28.9 GiB, 31043616768 bytes, 60632064 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 15A60008-EFAC-2847-930D-FAC8BCB11246

Device        Start      End  Sectors  Size Type
/dev/sdc1      2048  1050623  1048576  512M EFI System
/dev/sdc2   1050624 22022143 20971520   10G ChromeOS root fs
/dev/sdc3  22022144 60632030 38609887 18.4G Linux filesystem

Command (m for help): w

Now format these three partitions and make file system.
localhost / # mkfs.fat -F32 /dev/sdc1 
localhost / # mkfs.ext2 dev/sdc2 
localhost / # mkfs.ext4 /dev/sdc3

3. Mount the partition and transfer the file.
localhost / # exit
exit
chronos@localhost / $ cd ~/Downloads
chronos@localhost ~/Downloads $ sudo su
localhost /home/chronos/user/Downloads #  mkdir efi sdc1 sdc2
localhost /home/chronos/user/Downloads # mount /dev/sdb12 ./efi
localhost /home/chronos/user/Downloads # mount /dev/sdc1 ./sdc1
localhost /home/chronos/user/Downloads # mount /dev/sdc2 ./sdc2

After completing the above, type the execution at the command line:
cp -av ./efi/* ./sdc1
tar -cvzpf chromium_rootfs.tar.gz --one-file-system /
tar -xvzpf chromium_rootfs.tar.gz -C ./sdc2

4. Modify the configuration file to complete the Chromium OS installation.
Modify the write_gpt.sh script
Type the command line: localhost /home/chronos/user/Downloads # fdisk -l --bytes /dev/sdc . Remember the number of bytes corresponding to the Size column partition. At the command line, type: vim ./sdc2/usr/sbin/write_gpt.sh, modify the functions load_base_vars() and load_partition_vars(), delete unnecessary partitions, and only keep three partitions of EFI, ROOT_A and STATE, and modify them to corresponding NUM and the correct number of bytes above looks like this:
load_partition_vars() {
  DEFAULT_ROOTDEV=""
  PARTITION_SIZE_EFI_SYSTEM=536870912
    RESERVED_EBS_EFI_SYSTEM=0
       DATA_SIZE_EFI_SYSTEM=536870912
          FORMAT_EFI_SYSTEM=
       FS_FORMAT_EFI_SYSTEM=vfat
      FS_OPTIONS_EFI_SYSTEM=""
   PARTITION_NUM_EFI_SYSTEM="1"
  PARTITION_SIZE_1=536870912
    RESERVED_EBS_1=0
       DATA_SIZE_1=536870912
          FORMAT_1=
       FS_FORMAT_1=vfat
      FS_OPTIONS_1=""
   PARTITION_NUM_1="1"
  PARTITION_SIZE_ROOT_A=42949672960
    RESERVED_EBS_ROOT_A=0
       DATA_SIZE_ROOT_A=42949672960
          FORMAT_ROOT_A=
       FS_FORMAT_ROOT_A=ext2
      FS_OPTIONS_ROOT_A=""
   PARTITION_NUM_ROOT_A="2"
  PARTITION_SIZE_2=42949672960
    RESERVED_EBS_2=0
       DATA_SIZE_2=42949672960
          FORMAT_2=
       FS_FORMAT_2=ext2
      FS_OPTIONS_2=""
   PARTITION_NUM_2="2"
  PARTITION_SIZE_STATE=107374182400
    RESERVED_EBS_STATE=0
       DATA_SIZE_STATE=107374182400
          FORMAT_STATE=
       FS_FORMAT_STATE=ext4
      FS_OPTIONS_STATE=""
   PARTITION_NUM_STATE="3"
  PARTITION_SIZE_3=107374182400
    RESERVED_EBS_3=0
       DATA_SIZE_3=107374182400
          FORMAT_3=
       FS_FORMAT_3=ext4
      FS_OPTIONS_3=""
   PARTITION_NUM_3="3"
}
ROOTFS_PARTITION_SIZE=42949672960

Modify the grub.cfg startup configuration file:
Type: blkid /dev/sdc2 on the command line, remember the value of PARTUUID. At the command line type: vim ./sdc1/efi/boot/grub.cfg, modify it like this:
set default=0
set timeout=3

# NOTE: These magic grub variables are a Chrome OS hack. They are not portable.

menuentry "local image A" {
  linux /syslinux/vmlinuz.A init=/sbin/init boot=local rootwait ro noresume noswap loglevel=7 noinitrd console=  i915.modeset=1 cros_efi cros_debug       root=PARTUUID=51c8e934-02ff-4045-adbb-9fecde9dc908
}
Remember to change root=PARTUUID= to the value obtained earlier.

At this point, the Chromium OS custom installation is complete!

0 评论:

发表评论