User Tools

Site Tools


samsung_chromebook_plus_xe513c24

This is an old revision of the document!


Samsung Chromebook Plus XE513C24

Developer Mode

  • Turn off the laptop.
  • To invoke Recovery mode, you hold down the ESC and Refresh keys and poke the Power button.
  • At the Recovery screen press Ctrl-D (there's no prompt - you have to know to do it).
  • Confirm switching to developer mode by pressing enter, and the laptop will reboot and reset the system. This takes about 10-15 minutes.

Note: After enabling developer mode, you will need to press Ctrl-D each time you boot, or wait 30 seconds to continue booting.

Enable booting from external storage

  • After booting into developer mode, hold Ctrl and Alt and poke the T key. This will open up the crosh shell.
  • Type shell to get into a bash shell.
  • Type sudo -i to become root. (sudo su doesn't seem to be available and this is functionally the same)
  • Then type this to enable USB booting:
crossystem dev_boot_usb=1 dev_boot_signed_only=0
  • Reboot the system to allow the change to take effect.

First Attempt Gentoo SD Image

Note: I'm doing the build from my Orange Pi 800 with the same RK3399 so no cross compile environment is required.

Preparing SD Card

Install the required tools onto the build system:

emerge --ask dev-embedded/u-boot-tools sys-apps/dtc sys-block/parted sys-boot/vboot-utils

Partion the sd card.

root #parted /dev/sdc mklabel gpt
root #parted -a optimal /dev/sdc unit mib mkpart Kernel 1 65
root #parted -a optimal /dev/sdc unit mib mkpart Root 65 100%

Depthcharge requires some specific parameters to be set. These signal the bootloader the presence of a valid kernel partition:

root #cgpt add -i 1 -t kernel -S 1 -T 5 -P 15 /dev/sdc

Create a filesystem on the root partition and mount it:

root #mkfs.ext4 /dev/sdc2
root #mount /dev/sdc2 /mnt/sdcard

Grabbed latest arm64 stage3 and extracted to /mnt/sdcard: https://distfiles.gentoo.org/releases/arm64/autobuilds/20240128T234815Z/stage3-arm64-openrc-20240128T234815Z.tar.xz

Also grabbed the latest portage snapshot as it doesn't appear its in the stage 3 and extracted to /var/db/repos/gentoo: https://distfiles.gentoo.org/snapshots/portage-latest.tar.bz2

I copied my make.conf from my Orange Pi 800 as they both have the same rk3399 SOC.

# These settings were set by the catalyst build script that automatically
# built this stage.
# Please consult /usr/share/portage/config/make.conf.example for a more
# detailed example.
COMMON_FLAGS="-march=armv8-a+crc+crypto -mtune=cortex-a72.cortex-a53 -mfix-cortex-a53-835769 -mfix-cortex-a53-843419"
CFLAGS="${COMMON_FLAGS}"
CXXFLAGS="${COMMON_FLAGS}"
FCFLAGS="${COMMON_FLAGS}"
FFLAGS="${COMMON_FLAGS}"

# WARNING: Changing your CHOST is not something that should be done lightly.
# Please consult https://wiki.gentoo.org/wiki/Changing_the_CHOST_variable before changing.
CHOST="aarch64-unknown-linux-gnu"

# NOTE: This stage was built with the bindist Use flag enabled

# This sets the language of build output to English.
# Please keep this setting intact when reporting bugs.
LC_MESSAGES=C.utf8
USE="-X gpm alsa -udev pulseaudio"
ACCEPT_LICENSE="-* @FREE @BINARY-REDISTRIBUTABLE"
LLVM_TARGETS="AArch64"
VIDEO_CARDS="panfrost"
Getting ready to Chroot

Copy over resolv.conf:

cp --dereference /etc/resolv.conf /mnt/sdcard/etc/

Setup binds:

root #mount --types proc /proc /mnt/sdcard/proc
root #mount --rbind /sys /mnt/sdcard/sys
root #mount --make-rslave /mnt/sdcard/sys
root #mount --rbind /dev /mnt/sdcard/dev
root #mount --make-rslave /mnt/sdcard/dev
root #mount --bind /run /mnt/sdcard/run
root #mount --make-slave /mnt/sdcard/run

Chroot in:

root #chroot /mnt/sdcard /bin/bash
root #source /etc/profile
root #export PS1="(chroot) ${PS1}"
Get sources and configure kernel
emerge --ask gentoo-sources

I stole the config from https://git.alpinelinux.org/aports/plain/testing/linux-gru/config I edited the config text and added the gentoo specific options required:

< # Linux/arm64 6.6.2 Kernel Configuration
---
> # Linux/arm64 6.6.13-gentoo Kernel Configuration
5c5
< CONFIG_CC_VERSION_TEXT="gcc (Alpine 13.2.1_git20231014) 13.2.1 20231014"
---
> CONFIG_CC_VERSION_TEXT="gcc (Gentoo 13.2.1_p20240113-r1 p12) 13.2.1 20240113"
7294a7295,7312
> 
> #
> # Gentoo Linux
> #
> CONFIG_GENTOO_LINUX=y
> CONFIG_GENTOO_LINUX_UDEV=y
> CONFIG_GENTOO_LINUX_PORTAGE=y
> 
> #
> # Support for init systems, system and service managers
> #
> CONFIG_GENTOO_LINUX_INIT_SCRIPT=y
> # CONFIG_GENTOO_LINUX_INIT_SYSTEMD is not set
> # end of Support for init systems, system and service managers
> 
> # CONFIG_GENTOO_KERNEL_SELF_PROTECTION is not set
> CONFIG_GENTOO_PRINT_FIRMWARE_INFO=y
> # end of Gentoo Linux

I manually applied both patch files found here: https://git.alpinelinux.org/aports/tree/testing/linux-gru/

Compiling the kernel:

make
make dtbs

Set the root password with passwd.

Set the timezone:

root #echo "America/Detroit" > /etc/timezone
root #emerge --config sys-libs/timezone-data

Setup locale:

vim /etc/locale.gen
locale-gen
eselect locale list
eselect locale set

Install some system tools and firmware (required for wireless):

emerge --ask linux-firmware wpa_supplicant dhcpcd syslog-ng cronie chrony e2fsprogs
rc-update add dhcpcd default
rc-update add syslog-ng default
rc-update add cronie default
rc-update add sshd default
rc-update add chronyd default

Configure hostname:

echo "hostname" > /etc/hostname
vim /etc/hosts
127.0.0.1     hostname.localdomain.lan hostname localhost
::1           hostname.localdomain.lan hostname localhost  

Set clock=“local” if your hardware clock is localtime

Setup a normal user:

useradd -m -G users,wheel,audio -s /bin/bash johndoe
passwd johndoe

Exit the chroot.

Create a swapfile (ensure you've exited the chroot):

fallocate -l 4G /mnt/sdcard/swapfile
mkswap /mnt/sdcard/swapfile

Use blkid to get UUID of the sdcard root partition. Configure fstab:

vim /mnt/sdcard/etc/fstab
UUID="c47efd86-d6df-4c76-a4e9-2e8207d28710"     /       ext4    defaults        0 1
/swapfile       swap    swap    defaults 0 0

Create /mnt/sdcard/usr/src/linux/gentoo.its:

/dts-v1/;

/ {
    description = "Chrome OS kernel image with one or more FDT blobs";
    images {
        kernel-1{
            description = "kernel";
            data = /incbin/("arch/arm64/boot/Image");
            type = "kernel_noload";
            arch = "arm64";
            os = "linux";
            compression = "none";
            load = <0>;
            entry = <0>;
        };
        fdt-1{
            description = "rk3399-gru-kevin.dtb";
            data = /incbin/("arch/arm64/boot/dts/rockchip/rk3399-gru-kevin.dtb");
            type = "flat_dt";
            arch = "arm64";
            compression = "none";
            hash-1{
                algo = "sha1";
            };
        };
    };
    configurations {
        default = "conf-1";
        conf-1{
            kernel = "kernel-1";
            fdt = "fdt-1";
        };
    };
};

Refrences

samsung_chromebook_plus_xe513c24.1706881549.txt.gz · Last modified: 2024/09/22 22:08 (external edit)