Original link: http://weepingdogel.github.io/posts/%E5%88%A9%E7%94%A8rsync%E7%BB%99%E7%AC%94%E8%AE%B0%E6%9C% AC%E5%AE%89%E8%A3%85gentoo/
sequence
I haven’t seen you for half a year, I miss you
I have an underwhelming ChromeBook
2GB of RAM and an old dual-core low-voltage U with only 2.6 GHz are not enough for current popular distributions. Currently running Mint is also 100% of the CPU’s regular occupancy.
So I wondered if I could put a Gentoo on him.
However, this turtle U is estimated to have to be turned on for a week before it can be compiled…
Hmm, but I want to see if I can compile Gentoo on the desktop and transfer it to the ChromeBook via rsync.
On the compilation, I feel that even in E3 2022, the Church will not let me down.
At least much faster than this little Celeron.
Preparation
Don’t talk nonsense and start directly.
But we have to prepare these things
- Gentoo Wiki
- Official guidelines and documentation are required during the installation process
- Translation tools
- Due to the small user group of Gentoo, the localization of documents may not be very comprehensive, so you can use translation tools to recommend deepl here
- a USB stick
- Used to install a temporary Linux as the rsync receiver for the notebook.
- This one has nothing to say, it’s better to support USB 3.0
- Download the stage package officially provided by Gentoo
- This will be written down below the process
- A working Linux terminal
Download the stage tarball
Since our installation method is special, we can skip directly to this step of the official wiki
According to the documentation given by the official wiki, we do the following:
First enable root
|
|
Next, you can mount a partition to mnt
, or you can directly create a folder. I have enough space here, so I can directly operate it without loading.
As for how to mount, you can refer to the Arch Wiki.
|
|
Then we need to download the stage package with wget to open this page here we choose stage3
Because I am lazy and like to use systemd, I can choose according to my needs.
Note right-click stage3 systemd copy link
Paste the link on the terminal
|
|
Waiting to download.
After the download is complete, you can check the file. You can refer to this official entry .
Under normal circumstances, my side will not be damaged, so I will not write it here. Next, we will go directly to the step of decompressing the stage file.
Unzip the stage archive
We use tar to decompress this is the command given by the official wiki
|
|
Some readers may not understand that the string in the middle is actually a wildcard, but this wildcard may not be the same as the file you downloaded, so we will change the middle section to an accurate file name.
This step is as simple as pressing the Tab key.
|
|
Just wait for a while to decompress unless you use an IDE hard drive .
Configure compile options
This step is officially explained as follows
To optimize Gentoo you can set some variables that affect Portage. Gentoo officially supports the package manager. All these variables can be set as environment variables using export but this is not permanent. To preserve settings Portage reads /etc/portage/make.conf a configuration file for Portage.
Notes
A commented list of all possible variables can be found in /mnt/gentoo/usr/share/portage/config/make.conf.example. To successfully install Gentoo you just need to set the variables mentioned below.
Start the editor In this guide we use nano to change the optimization variables we will discuss below.
1
root #nano -w /mnt/gentoo/etc/portage/make.conf
It is obvious from the make.conf.example file that the structure of the file. Comment lines start with “#” and other lines use the VARIABLE=”content syntax to define variables. Next, select a few of them for discussion.
Here we use vim to write
|
|
Add COMMON_FLAGS=
to the -march=silvermont
option so that the compiler can optimize the garbage CPU of the silvermont
architecture.
The complete file is as follows
|
|
Install Gentoo base system
The operation of the first stage has been completed above, and the basic system can be installed, hehe.
The next thing to do is to select the mirror source. We can refer to the help document given by ustc mirror
- Gentoo Source Usage Help — USTC Mirror Help documentation
- Gentoo Portage Source Usage Help — USTC Mirror Help documentation
Just follow the help given by ustc to set these two source addresses.
Then copy the DNS information
|
|
Mount the necessary filesystems
Pay attention here. I have to type several commands here.
Why
official explanation
After a few moments the root directory of Linux will change to the new location. To make sure the new environment works properly requires making sure that some filesystems are available.
The file system that needs to be provided is
- /proc/ A pseudo file system looks like a regular file but is actually generated in real time and exposed by the Linux kernel with some environmental information
- /sys/ A pseudo filesystem like /proc/ to be replaced is more structured than /proc/
- /dev/ is a regular filesystem part containing all device files managed by the Linux device manager usually udev
The /proc/ location will be mounted to /mnt/gentoo/proc/ while the other two are bind mounts. Literally for example /mnt/gentoo/sys/ is in fact /sys/ which is just the second entry point of the same filesystem and /mnt/gentoo/proc/ is a new mount of the filesystem so to speak. load.
So execute the following commands in order to mount
|
|
But it’s not over
Therefore, we will add these three
|
|
Chroot : enter a new environment
Once everything is mounted, you can chroot in
|
|
|
|
|
|
Then the terminal will look like this
mount the boot partition
We skip this step directly because the final installed device is not this machine but another laptop.
After that, we will manually install the boot media.
Install Gentoo ebuild database snapshot from website
Officially, this is equivalent to sudo pacman -Syyu
in Arch
Not to mention copy and paste.
|
|
Choose a configuration file
How do I feel like I’m copying the content of the wiki…
Configuration files are the building blocks of any Gentoo system. Not only does it specify default values for USE, CFLAGS, and other important variables, it also locks down the system’s range of package versions. These settings are all maintained by the Portage developers at Gentoo.
|
|
|
|
Then enter the following command
|
|
In fact, it will list a lot of options, we need to choose the version with desktop/system
set time zone
Here is the method of Arch directly
|
|
According to my situation I should write like this
|
|
Then run hwclock to generate /etc/adjtime
|
|
set USE
For the Gentoo system, the USE flag is necessary, so we need to set the global USE flag before compiling
|
|
|
|
Update @world collection
In fact, it is similar to the “rolling” of Arch, but it will be a relatively long process.
|
|
In addition to changing the USE flag this command is also used to dynamically adjust the system functionality.
configure locale
Please refer to this Installation guide (Simplified Chinese) – ArchWiki
configure the kernel
Hmm, you think I’m so stupid and I compile it for eight hours, this time I choose to use the bin kernel
|
|
Save a lot of time.
|
|
Oops
see for yourself
Install firmware
Some drivers require additional firmware to be installed on the system in order to work. Often network interfaces are used especially wireless network interfaces. Additionally, modern video chips from vendors such as AMD, NVidia, and Intel often require external firmware files when using open source drivers. Most firmware is packaged in sys-kernel/linux-firmware
Most device drivers depend on the linux-firmware
package
|
|
configure fstab
This step is to let the kernel know the partition when the system starts.
But Gentoo doesn’t seem to be able to use genfstab
only handwritten
First get the UUID in the notebook
|
|
Next, write the UUID
of the partition corresponding to the /
partition in the file /etc/fstab
in the following format
|
|
Dump the system to the laptop via rsync
At this time, you need to insert an ArchISO U disk into the notebook, boot to the ISO , connect to WIFI and start the ssh service.
Next, format the original partition
|
|
Then mount it and rsync the file you just made into it
|
|
Next, start the ssh service on the notebook side
|
|
Then use rsync to transfer the compiled file to the notebook’s system partition.
|
|
Install bootloader on laptop
This is also a very familiar operation.
|
|
|
|
Epilogue
After a series of tossing, this old book can finally exert its maximum performance.
From this it seems possible to copy Linux distribution system files to other devices via rsync.
But it took a long time
Reference link
- Gentoo Wiki
- Downloads â Gentoo Linux
- Install Gentoo installation files – Gentoo Wiki
- Gentoo Source Usage Help — USTC Mirror Help documentation
- Gentoo Portage Source Usage Help — USTC Mirror Help documentation
- Installation guide (Simplified Chinese) – ArchWiki
This article is reprinted from: http://weepingdogel.github.io/posts/%E5%88%A9%E7%94%A8rsync%E7%BB%99%E7%AC%94%E8%AE%B0%E6%9C% AC%E5%AE%89%E8%A3%85gentoo/
This site is for inclusion only, and the copyright belongs to the original author.