1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
|
curl https://alx.sh | sh
# From gentoo livecd
net-setup
ifconfig
lsblk
fdisk /dev/nvmeX
- 512M EFI
- 130GB Root
mkfs.fat -F32 /dev/nvmeEFI
mkfs.btrfs -f /dev/nvmeRoot
mount /dev/nvmeRoot /mnt/gentoo
mkdir -p /mnt/gentoo/boot/
mount /dev/nvmeEFI /mnt/gentoo/boot/
> vendorfw ?
wget stage3
tar xpvf stage3-X.tar.xz --xattrs-include='*.*' --numeric-owner -C /mnt/gentoo
nano /mnt/gentoo/etc/portage/make.conf
```
# vim: set language=bash;
CHOST="aarch64-unknown-linux-gnu"
# Optimization flags.
COMMON_FLAGS="-march=armv8.5-a+fp16+simd+crypto+i8mm -mtune=native -O2 -pipe"
CFLAGS="${COMMON_FLAGS}"
CXXFLAGS="${COMMON_FLAGS}"
FCFLAGS="${COMMON_FLAGS}"
FFLAGS="${COMMON_FLAGS}"
RUSTFLAGS="-C target-cpu=native"
LC_MESSAGES=C
MAKEOPTS="-j(nproc)" *************
EMERGE_DEFAULT_OPTS="--jobs 3"
ACCEPT_LICENSE="linux-fw-redristribuable no-source-code"
GENTOO_MIRRORS="" ???????????????
VIDEO_CARDS="asahi" ????????????
# Keep a newline at the end! Important!
```
> ? necessary ?
cp -r /boot /mnt/gentoo
cp -r /usr/lib/modules /mnt/gentoo/usr/lib
cp -r /usr/lib/firmware /mnt/gentoo/usr/lib
> ? The --make-rslave operations are needed for systemd support later in the installation.
mount --types proc /proc /mnt/gentoo/proc
mount --rbind /sys /mnt/gentoo/sys
mount --make-rslave /mnt/gentoo/sys
mount --rbind /dev /mnt/gentoo/dev
mount --make-rslave /mnt/gentoo/dev
mount --bind /run /mnt/gentoo/run
mount --make-slave /mnt/gentoo/run
chroot /mnt/gentoo /bin/bash
source /etc/profile
emerge-webrsync
emerge --sync
emerge -1 sys-apps/portage
eselect profile
emerge -av dev-vcs/git
git clone https://github.com/chadmed/asahi-gentoosupport
cd asahi-gentoosupport
./install.sh
```
set -e
install_overlay() {
echo "Installing the Asahi Overlay. For more information, visit"
echo "https://github.com/chadmed/asahi-overlay/"
echo
emerge -q eselect-repository
eselect repository enable asahi
emaint sync -r asahi
echo "The Asahi overlay has been installed."
}
install_meta() {
echo "We will now install the Asahi metapackage with some sane"
echo "defaults to get you started. This step will:"
echo " * Emerge rust-bin (you can switch to the compiled rust later)"
echo " * Add VIDEO_CARDS=\"asahi\" to /etc/portage/make.conf"
echo " * Emerge the Asahi metapackage"
echo " * Emerge the Asahi dist-kernel (you may switch to asahi-sources later)"
echo " * Unpack the Asahi firmware"
echo " * Update m1n1 and U-Boot"
read -sp "Press Enter to continue..."
[ ! -d /etc/portage/package.mask ] && mkdir /etc/portage/package.mask
cp resources/package.mask /etc/portage/package.mask/asahi
[ ! -d /etc/portage/package.use ] && mkdir /etc/portage/package.use
cp resources/package.use /etc/portage/package.use/asahi
[ ! -d /etc/portage/package.license ] && mkdir /etc/portage/package.license
echo "sys-kernel/linux-firmware linux-fw-redistributable no-source-code" > /etc/portage/package.license/firmware
echo "VIDEO_CARDS=\"asahi\"" >> /etc/portage/make.conf
emerge -q1 dev-lang/rust-bin
emerge -q sys-apps/asahi-meta virtual/dist-kernel:asahi sys-kernel/linux-firmware
asahi-fwupdate
update-m1n1
}
install_grub() {
echo "Installing GRUB."
echo "GRUB_PLATFORMS=\"efi-64\"" >> /etc/portage/make.conf
emerge -q grub:2
grub-install --boot-directory=/boot/ --efi-directory=/boot/ --removable
grub-mkconfig -o /boot/grub/grub.cfg
echo "GRUB has been installed."
}
if [[ $(whoami) != "root" ]]; then
echo "You must run this script as root."
exit 1
fi
if [[ ! -d /boot/vendorfw ]]; then
echo "We use ESP-as-boot. Please mount the Asahi ESP to /boot before"
echo "continuing. This is absolutely essential for the system"
echo "to function correctly."
exit 1
fi
echo "This script automates the setup and configuration of Apple Silicon"
echo "specific tooling for Gentoo Linux. Please mount the ESP to /boot."
echo
echo "NOTE: This script will install linux-firmware automatically. It is not"
echo "possible to run these machines properly without binary blobs. Please make"
echo "sure you understand this, and agree to the linux-fw-redistributable and"
echo "no-source-code licenses before continuing."
echo
read -sp "Press Enter to continue..."
install_overlay
install_meta
install_grub
echo "This script will now exit. Continue setting up your machine as per the"
echo "Gentoo Handbook, skipping the steps related to setting up the kernel or"
echo "GRUB as these have been done for you. Don't forget to add /boot to your"
echo "fstab!"
```
lsblk
blkid
nano /etc/fstab
```
# /etc/fstab: static file system information.
#
#
# <fs> <mountpoint> <type> <opts> <dump/pass>
UUID=XXXX-XXXX /boot vfat defaults,noatime 0 2
UUID=xxxxxxx-xxxx-xxxx-xxxx-xxxxxxx / btrfs subvol=/@,defaults,noatime,autodefrag,compress=zstd 0 0
```
ls /usr/share/zoneinfo
echo "US/Eastern" > /etc/timezone
emerge --config sys-libs/timezone-data
nano /etc/[locale.gen](locale.gen)
locale-gen
eselect locale list
eselect locale set x
env-update && source /etc/profile
emerge -av sys-fs/dosfstools
echo 'dev-lang/rust' >> /etc/portage/package.mask
>?
emerge -avuND @world - or not because not runninf update-m1n1 again before reboot ...
OPENRC or Systemd ????
>?
exit
umount -l /mnt/gentoo/dev{/shm,/pts,}
umount -R /mnt/gentoo
reboot
# USERLAND
## setup sudo
emerge app-admin/sudo
visudo
```
# Allow members of group sudo to execute any command without any password
%sudo ALL=(ALL:ALL) ALL
%sudo ALL=NOPASSWD: ALL
```
## Add User
useradd -m -G users,wheel,audio,sudo ??? $USER
passwd $USER
> choose Cron pkg
## ZSH
emerge app-shells/zsh app-shells/zsh-completions app-shells/gentoo-zsh-completions app-shells/zsh-syntax-highlighting
chsh -s /bin/zsh
## EIX
emerge app-portage/eix
eix-update
## using git to sync repos instead of rsync - /var/db/repos/gentoo
vim /etc/portage/repos.conf/gentoo.conf
```
[DEFAULT]
main-repo = gentoo
[gentoo]
location = /var/db/repos/gentoo
sync-type = git
sync-uri = https://gitweb.gentoo.org/repo/sync/gentoo.git
auto-sync = yes
sync-openpgp-key-path = /usr/share/openpgp-keys/gentoo-release.asc
sync-openpgp-key-refresh-retry-count = 40
sync-openpgp-key-refresh-retry-overall-timeout = 1200
sync-openpgp-key-refresh-retry-delay-exp-base = 2
sync-openpgp-key-refresh-retry-delay-max = 60
sync-openpgp-key-refresh-retry-delay-mult = 4
```
## Dotfiles
## gpg pass ect
## Neovim
## Email setup
emerge mail-client/mutt-wizard mail-client/neomutt net-mail/isync mail-mta/msmtp
## https://github.com/gokcehan/lf
|