Odroid-C2

From Alpine Linux
Revision as of 10:30, 19 March 2022 by Yuu (talk | contribs)
This material needs wiki syntax or style improvements ...

Please feel free to help us clean it up.

(Parts of this page are WIP, still incomplete and some might be incorrect.)

Introduction

The Odroid-C2 single board computer is not very well supported by Alpine/Linux. However the "Generic ARM (aarch64)" build contains almost everything we need !


What do we need ?

  • kernel : provided kernel by the Alpine team does not boot
  • u-boot : provided u-boot does not autoboot without serial
  • system files : everything is okay


On the hardware side:

  • Odroid-C2
  • Official PSU or just a micro-SD cable (notes : the barrel plug (inner(positive) diameter 0.8mm and outer(negative) diameter 2.5mm) is recommended, without the J1 jumper)
  • micro-SD (or eMMC)
  • USB to TTL (official or CP2102 chipset or an old rpi)


Required environement and toolchain

Using GNU/Linux is recommended and this guide and here are the required dependencies: Example on debian :

apt install bc bison flex make gcc gcc-aarch64-linux-gnu libncurses-dev git

Environement variables

export ARCH=arm64
export CROSS_COMPILE=aarch64-linux-gnu

Build u-boot from source

git clone --depth 1 https://source.denx.de/u-boot/u-boot.git -b v2022.01 u-boot-denx.de
cd u-boot-denx.de
export ARCH=arm64 && export CROSS_COMPILE=aarch64-linux-gnu-
make mrproper && make odroid-c2_defconfig

Change boot options: TODO : remove lines < # CONFIG_AUTOBOOT_KEYED is not set < # CONFIG_AUTOBOOT_USE_MENUKEY is not set

Patch default configuration:

sed -i -e 's/.*CONFIG_SD_BOOT.*/CONFIG_SD_BOOT=y/' .config
echo "CONFIG_AUTOBOOT_KEYED=y" >> .config
echo "CONFIG_AUTOBOOT_FLUSH_STDIN=y" >> .config
echo "CONFIG_AUTOBOOT_PROMPT="Press quickly 'Enter' twice to stop autoboot: %d\n"" >> .config
echo "# CONFIG_AUTOBOOT_ENCRYPTION is not set" >> .config
echo "CONFIG_AUTOBOOT_DELAY_STR=""" >> .config
echo "CONFIG_AUTOBOOT_STOP_STR="\xd\xd"" >> .config
echo "CONFIG_AUTOBOOT_KEYED_CTRLC=y" >> .config

Build time:

time make -j$(nproc)


Build the latest LTS kernel from source

git clone --depth 1 git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git -b linux-5.154.y linux-stable
cd linux-stable
make mrproper && make defconfig

We need to adapt the default arm64 generated by defconfig

sed -i -e 's/.*CONFIG_SQUASHFS_XZ.*/CONFIG_SQUASHFS_XZ=y/' .config
sed -i -e 's/.*CONFIG_UEVENT_HELPER.*/CONFIG_UEVENT_HELPER=y/' .config
sed -i -e 's/.*CONFIG_BLK_DEV_RAM.*/CONFIG_BLK_DEV_RAM=y/' .config
echo CONFIG_UEVENT_HELPER_PATH=\"/sbin/hotplug\" >> .config
echo CONFIG_BLK_DEV_RAM_COUNT=16 >> .config
echo CONFIG_BLK_DEV_RAM_SIZE=4096 >> .config

Build the kernel:

time make -j$(nproc) Image dtbs modules

Create modloop:

rm -rf installed-modules && mkdir installed-modules
INSTALL_MOD_PATH=installed-modules make modules_install
find installed-modules -type l -delete
rm -f modloop
mksquashfs installed-modules/lib/ modloop -b 1048576 -comp xz -Xdict-size 100% -all-root
rm -rf installed-modules


Assembly

Work in progress


Booting

Work in progress


Troubleshooting

Work in progress