§2023-08-28
sudo su -
parted /dev/mmcblk1 mklabel msdos mkpart p ext4 10M 210M mkpart p btrfs 210M 100% toggle 1 boot quit
apt update apt install btrfs-progs nano
mkfs.ext4 -L boot /dev/mmcblk1p1 mkfs.btrfs -L root /dev/mmcblk1p2 mkdir /mnt/root mount /dev/mmcblk1p2 /mnt/root btrfs sub create /mnt/root/@ btrfs sub create /mnt/root/@swap umount /mnt/root mount -o subvol=@,noatime,compress=lzo,autodefrag /dev/mmcblk1p2 /mnt/root mkdir /mnt/root/swap mount -o subvol=@swap,noatime /dev/mmcblk1p2 /mnt/root/swap touch /mnt/root/swap/swapfile chmod 600 /mnt/root/swap/swapfile chattr +C /mnt/root/swap/swapfile fallocate /mnt/root/swap/swapfile -l6g mkswap /mnt/root/swap/swapfile swapon /mnt/root/swap/swapfile
TIMESTAMP="20210318T005104Z" STAGE3="stage3-arm64-$TIMESTAMP" wget http://ftp.free.fr/mirrors/ftp.gentoo.org/releases/arm64/autobuilds/current-stage3-arm64/$STAGE3.tar.xz tar xJf $STAGE3.tar.xz -C /mnt/root/
COMMON_FLAGS="-O2 -pipe -mcpu=cortex-a55 -mabi=lp64 -ftree-vectorize --param l1-cache-size=32 --param l1-cache-line-size=32 --param l2-cache-size=512"
CFLAGS="${COMMON_FLAGS}"
CXXFLAGS="${COMMON_FLAGS}"
FCFLAGS="${COMMON_FLAGS}"
FFLAGS="${COMMON_FLAGS}"
CHOST="aarch64-unknown-linux-gnu"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j4"
CPU_FLAGS_ARM="edsp neon thumb vfp vfpv3 vfpv4 vfp-d32 crc32 v4 v5 v6 v7 v8 thumb2"
AUTOCLEAN="yes"
EMERGE_DEFAULT_OPTS="--with-bdeps=y --quiet-build=y"
PORTAGE_COMPRESS="bzip2"
PORTAGE_COMPRESS_FLAGS="-9"
ACCEPT_LICENSE="* -@EULA"
LINGUAS="en"
L10N="en"
USE="logrotate symlink"
cp -L /etc/resolv.conf /mnt/root/etc/ mount -t proc proc /mnt/root/proc mount --rbind /sys /mnt/root/sys mount --make-rslave /mnt/root/sys mount --rbind /dev /mnt/root/dev mount --make-rslave /mnt/root/dev
arch-chroot root /bin/bash hc4Gentoo / # source /etc/profile hc4Gentoo / # export PS1="(chroot) $PS1" (chroot) hc4Gentoo / # mount /dev/mmcblk1p1 /boot
(chroot) hc4Gentoo / # mkdir /etc/portage/repos.conf
nano /etc/portage/repos.conf/gentoo.conf
[gentoo]
location = /usr/portage
sync-type = rsync
sync-uri = rsync://rsync.namerica.gentoo.org/gentoo-portage
auto-sync = yes
priority = 10
emerge --sync
mkdir /etc/portage/package.accept_keywords
echo "app-editors/joe **" >/etc/portage/package.accept_keywords/joe # Not yet available for arm64 emerge -av app-editors/joe nano -w /etc/bash/bashrc.d/joe export EDITOR=jpico alias pico=jpico alias edit=jpico source /etc/bash/bashrc
passwd groupadd ssh-users useradd -c "John Doe" -m -G users,ssh-users jdoe # Copy the SSH keys once the users are created passwd jdoe pico /etc/ssh/sshd_config
ClientAliveInterval 120
ClientAliveCountMax 30
AllowGroups ssh-users
KexAlgorithms curve25519-sha256@libssh.org,diffie-hellman-group-exchange-sha256
Ciphers chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes128-gcm@openssh.com,aes256-ctr,aes192-ctr,aes128-ctr
MACs hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512,hmac-sha2-256,umac-128@openssh.com rc-update add sshd default
pico /etc/locale.gen
emerge -av app-eselect/eselect-repository eselect repository add odroidc4 git https://github.com/svoop/odroidc4-overlay emerge --sync
emerge -av sys-fs/btrfs-progs blkid # Get ROOT_UUID and BOOT_UUID pico /etc/fstab # Must not have an empty line at the end UUID={ROOT_UUID} / btrfs defaults,subvol=@,noatime,compress=lzo,autodefrag 0 1 UUID={ROOT_UUID} /swap btrfs defaults,subvol=@swap,noatime 0 0 /swap/swapfile none swap sw 0 0 UUID={BOOT_UUID} /boot ext4 defaults,noatime 0 2
setenv bootlabel "Gentoo Linux"
setenv fk_kvers "5.11.18-odroidc4"
setenv root_uuid "{ROOT_UUID}" setenv root_flags "defaults,subvol=@,noatime,compress=lzo,autodefrag" setenv bootargs " ${bootargs} root=UUID=${root_uuid} rootflags=${root_flags}"
setenv fdtfile "meson64_odroidc4.dtb" setenv overlays "spi0 pcf8563"
setenv bootargs "${bootargs} console=tty1 cma=800M clk_ignore_unused" setenv bootargs "${bootargs} console=ttyAML0,115200n8"
setenv fdt_addr_r "0x20000000" setenv dtbo_addr_r "0x21000000" setenv zimage_addr_r ${ramdisk_addr_r}
load ${devtype} ${devnum}:${partition} ${fdt_addr_r} ${prefix}dtbs/${fk_kvers}/amlogic/${fdtfile}
if test -n "${overlays}"; then
fdt addr ${fdt_addr_r}
fdt resize 16384
setenv overlay_path ${prefix}dtbs/${fk_kvers}/amlogic/overlays/odroid${variant}
for overlay in ${overlays}; do
load ${devtype} ${devnum}:${partition} ${dtbo_addr_r} ${overlay_path}/${overlay}.dtbo
&& fdt apply ${dtbo_addr_r}
done
fi
load ${devtype} ${devnum}:${partition} ${zimage_addr_r} ${prefix}vmlinuz-${fk_kvers}
&& unzip ${zimage_addr_r} ${kernel_addr_r}
&& load ${devtype} ${devnum}:${partition} ${fdt_addr_r} ${prefix}dtb-${fk_kvers}
&& load ${devtype} ${devnum}:${partition} ${ramdisk_addr_r} ${prefix}initramfs-${fk_kvers}.img
&& echo "Booting ${bootlabel} ${fk_kvers} from ${devtype} ${devnum}:${partition}..."
&& booti ${kernel_addr_r} ${ramdisk_addr_r}:${filesize} ${fdt_addr_r}
emerge -av sys-apps/busybox pico /etc/conf.d/hostname
pico /etc/sysctl.conf
emerge -q --sync emerge -a --update --deep --newuse @world emerge -av @world ---> emerge -av --update --deep --newuse @world combine with the above line emerge -a --update --deep --newuse @world dispatch-conf
emerge -av sys-kernel/dracut sys-apps/dtc
emerge -av sys-kernel/odroidc4-sources echo "sys-kernel/odroidc4-sources" >/etc/portage/package.accept_keywords/odroidc4-sources emerge -av odroidc4-sources
cd RELEASE="189" wget https://github.com/hardkernel/u-boot/releases/download/travis%2Fodroidc4-$RELEASE/u-boot-odroidc4-$RELEASE.tar.gz tar xzf u-boot-odroidc4-.tar.gz mv sd_fuse/u-boot.bin /boot chown root:root /boot/u-boot.bin rm -rf sd_fuse u-boot-odroidc4- dd if=/boot/u-boot.bin of=/dev/mmcblk1 conv=fsync,notrunc bs=512 seek=1 sync
umount /boot exit
swapoff /mnt/root/swap/swapfile umount /mnt/root/swap umount -l /mnt/root/dev{/shm,/pts,} umount -R /mnt/root{/sys,/proc} lsof grep /mnt/root # Check if anything is still busy on /mnt/root umount /mnt/root
sync shutdown -r now
emerge -av net-misc/ntp rc-service ntp-client start rc-service ntpd start rc-update add ntpd hwclock -w --utc
emerge -av app-portage/gentoolkit sys-apps/usbutils
ODROIDC4-UBOOT-CONFIG
setenv bootlabel "Gentoo Linux"
setenv fk_kvers "5.11.18-odroidc4"
# setenv fk_kvers "5.11.14-odroidc4"
setenv root_uuid "{ROOT_UUID}"
setenv root_flags "defaults,subvol=@,noatime,compress=lzo,autodefrag"
setenv bootargs " ${bootargs} root=UUID=${root_uuid} rootflags=${root_flags}"
setenv fdtfile "meson64_odroidc4.dtb"
setenv overlays "spi0 pcf8563"
setenv bootargs "${bootargs} console=tty1 cma=800M clk_ignore_unused"
setenv bootargs "${bootargs} console=ttyAML0,115200n8"
setenv fdt_addr_r "0x20000000"
setenv dtbo_addr_r "0x21000000"
setenv zimage_addr_r ${ramdisk_addr_r}
load ${devtype} ${devnum}:${partition} ${fdt_addr_r} ${prefix}dtbs/${fk_kvers}/amlogic/${fdtfile}
if test -n "${overlays}"; then
fdt addr ${fdt_addr_r}
fdt resize 16384
setenv overlay_path ${prefix}dtbs/${fk_kvers}/amlogic/overlays/odroid${variant}
for overlay in ${overlays}; do
load ${devtype} ${devnum}:${partition} ${dtbo_addr_r} ${overlay_path}/${overlay}.dtbo \
&& fdt apply ${dtbo_addr_r}
done
fi
load ${devtype} ${devnum}:${partition} ${zimage_addr_r} ${prefix}vmlinuz-${fk_kvers} \
  && unzip ${zimage_addr_r} ${kernel_addr_r} \
&& load ${devtype} ${devnum}:${partition} ${fdt_addr_r} ${prefix}dtb-${fk_kvers} \
&& load ${devtype} ${devnum}:${partition} ${ramdisk_addr_r} ${prefix}initramfs-${fk_kvers}.img \
&& echo "Booting ${bootlabel} ${fk_kvers} from ${devtype} ${devnum}:${partition}..." \
&& booti ${kernel_addr_r} ${ramdisk_addr_r}:${filesize} ${fdt_addr_r}
Return to Top