[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: odroid hc1 on debian?



I got my odroid-hc1 boards working, with these caveats:
* after inserting an sd card into a desktop with debian, gnome file explorer or whatever pops up, if there are filesystems on the partition. Close those and unmount the partition first.
* I have to configure a password (TODO: at least force a password change on first login)
* wait a second between parted and mkfs to allow udev to catch up.
* mkfs wants a confirmation, if the sd card had a filesystem before.
* with /etc/network/interfaces I try to configure dhcp on eth0. Actually the interface gets renamed based on the MAC - how do I configure that? Does /etc/network/interface allow "*" pattern or similar?
* For my own use case using the whole size of the SD card is proper, thus I use parted with 100% setting. For creating a downloadable image it would be better to configure it as small as possible, then have code in place to resize the partition and filesystem at the first boot.
* The package list for multistrap is a mix of my personal preferences and technically required packages.

A current bug in dash causes dash&bash packages not to be configured with DEBIAN_FRONTEND=noninteractive. dpkg --configure -a without that option works, but creates an interactive dialog step.


That said, except for the required arm cpu firmware blobs from hardkernel, everything is installed from debian, no patching needed. Good job!

So how can we go forward here? I had to reach out to the wiki team to create/enable an account, so can't edit it right now.

Also the wiki looks like a wild mixed bag of current and really old pages with lots of content linked from third party sources. My preferred end result would be a Debian run and supported installation method or image, where it is entirely clear where each bit came from and what modifications were made, and where patches, if required, are pushed to upstream to improve the ecosystem for everyone. How can we get there? Is debian-installer the only route, or is some team/group/... also covering the typical SBC use case of ready-installed images?

It is a shame how much fine tuning gets reinvented in this space all the time, I guess all items from my laundry list above have been found and fixed by others in some way many times already. Any Debian forum for consolidating such work and creating debian images? 

And while "Debian" in the strict sense means "main" repo only, I'm aware of the non-free blob situation and thus likely targetting something like https://cdimage.debian.org/cdimage/unofficial/non-free/images-including-firmware/ - i.e. a Debian hosted and run and maintained result including non-free bits are required by the hardware plattform.

Thanks, Andreas

# Installing Debian on Odroid-HC1

Debian does not support installation on the device as of today (Oct 2017).
Installing requires U-Boot and several firmware BLOB from Hardkernel/Samsung.

Creating an SD Card based on the daily Debian Installer worked fine, however
after boot the kernel did not recognize the USB Host controller it seemed -
neither the network card not the USB2Sata bridge were found. The root cause
for this is not known.

## Manual installation

Lets install straight to a SD Card. This procedure can be done on a normal
desktop or laptop computer, the SD Card will contain a ready Debian
Installation.

## First step: Partitioning

The SD Card must be set up to contain 2MB of unused space at the start,
then a boot partition (readable by U-Boot), then the root filesystem.

I used a 16GB SD card and chose 400MB for the /boot partition.


SDCARD=/dev/sdd
parted --script ${SDCARD} \
  mklabel msdos \
  mkpart primary 2MiB 412MiB \
  mkpart primary 412MiB 100%

mkfs.ext4 ${SDCARD}1 -E discard
mkfs.ext4 ${SDCARD}2 -E discard

mount ${SDCARD}2 /mnt/
mkdir /mnt/boot /mnt/dev /mnt/proc /mnt/sys
mount ${SDCARD}1 /mnt/boot


## Second step: Bootstrapping

multistrap is a new tool similar to debootstrap, but without using a tar.gz
file. It fits the purpose nicely.

apt install multistrap apt-transport-https qemu binfmt-support qemu-user-static

cat <<EOF > debian-odroid-hc1-multistrap.conf
[General]
arch=armhf
directory=/mnt/
# same as --tidy-up option if set to true
cleanup=true
# same as --no-auth option if set to true
# keyring packages listed in each bootstrap will
# still be installed.
noauth=false
# extract all downloaded archives (default is true)
unpack=true
# enable MultiArch for the specified architectures
# default is empty
#multiarch=
# aptsources is a list of sections to be used for downloading packages
# and lists and placed in the /etc/apt/sources.list.d/multistrap.sources.list
# of the target. Order is not important
aptsources=Debian
# the order of sections is not important.
# the bootstrap option determines which repository
# is used to calculate the list of Priority: required packages.
bootstrap=Debian

[Debian]
packages=task-ssh-server u-boot-exynos u-boot u-boot-tools linux-image-armmp-lpae firmware-linux firmware-linux-nonfree sudo vim less systemd systemd-sysv iproute2 isc-dhcp-client ca-certificates iputils-ping net-tools iperf3 man-db ifupdown
source=https://deb.debian.org/debian/
keyring=debian-archive-keyring
suite=buster
components=main contrib non-free
addimportant=false

EOF

multistrap -f debian-odroid-hc1-multistrap.conf

cp /usr/bin/qemu-arm-static  /mnt/usr/bin/

mount --bind /dev /mnt/dev
mount --bind /proc /mnt/proc

chroot /mnt/ bash -c "DEBIAN_FRONTEND=noninteractive dpkg --configure -a"

chroot /mnt/ bash -c "dpkg --configure -a"

The last command is required if the previous had an error related to dash and bash.

## Third step: General system config

chroot /mnt passwd root
chroot /mnt bash -c 'systemctl enable serial-getty@ttySAC2.service'

echo debian-odroid-h1 > /mnt/etc/hostname
echo 127.0.0.1 debian-odroid-hc1 localhost > /mnt/etc/hosts

cat << EOF > /mnt/etc/network/interfaces
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp
EOF

sed -e "s/^#PermitRootLogin.*/PermitRootLogin Yes/g" -i /mnt/etc/ssh/sshd_config


## Fourth step: Boot loader, including Vendor firmware (BLOB)

BOOT_UUID="$(lsblk -n -o UUID ${SDCARD}1)"
ROOT_UUID="$(lsblk -n -o UUID ${SDCARD}2)"

chroot /mnt rm /vmlinuz /vmlinuz.old /initrd.img /initrd.img.old
chroot /mnt bash -c 'cd /boot; ln -s $(ls vmlinuz*|tail -n1) vmlinuz; ln -s $(ls initrd*|tail -n1) initrd'

cat << EOF > /mnt/etc/fstab
proc              /proc   proc    defaults
UUID=${ROOT_UUID} /       ext4    noatime,errors=remount-ro,discard
UUID=${BOOT_UUID} /boot   ext4    defaults,discard
EOF

cp /mnt/usr/lib/linux-image-*/exynos5422-odroidxu4.dtb /mnt/boot/

cat << EOF > /mnt/boot/boot.ini
setenv initrd_high "0xffffffff"
setenv fdt_high "0xffffffff"
setenv rootdev "UUID=${ROOT_UUID}"
setenv rootfstype "ext4"
setenv console "both"
setenv verbosity "8"
if ext4load mmc 0:1 0x44000000 /bootenv.txt; then env import -t 0x44000000 \${filesize}; fi
setenv consoleargs "\${consoleargs} console=ttySAC2,115200n8"
setenv bootrootfs "\${consoleargs} consoleblank=0 loglevel=\${verbosity} root=\${rootdev} rootfstype=\${rootfstype} rootwait rw"
setenv HPD "true"
ext4load mmc 0:1 0x40008000 /vmlinuz
ext4load mmc 0:1 0x42000000 /initrd.ub
ext4load mmc 0:1 0x44000000 /exynos5422-odroidxu4.dtb
fdt addr 0x44000000
if test "\${cecenable}" = "false"; then fdt rm /cec@101B0000; fi
setenv bootargs "\${bootrootfs} governor=performance \${extraargs}"
dmc 825
bootz 0x40008000 0x42000000 0x44000000
EOF

chroot /mnt mkimage -A arm -O linux -T script -C none -a 0 -e 0 -n 'boot.ini as u-boot script' -d /boot/boot.ini /boot/boot.scr
chroot /mnt mkimage -A arm -O linux -T ramdisk -C none -a 0 -e 0 -n image -d /boot/initrd /boot/initrd.ub

git clone https://github.com/hardkernel/u-boot -b odroidxu4-v2017.05

mkdir /mnt/boot/hardkernel/
cp u-boot/sd_fuse/{bl1.bin.hardkernel,bl2.bin.hardkernel.720k_uboot,sd_fusing.sh,tzsw.bin.hardkernel} /mnt/boot/hardkernel/
cp /mnt/usr/lib/u-boot/odroid-xu3/u-boot.bin /mnt/boot/hardkernel/

chroot /mnt bash -c "cd /boot/hardkernel; ./sd_fusing.sh ${SDCARD}"

umount /mnt/boot
umount /mnt/dev
umount /mnt/proc
umount /mnt
sync

All done - remove the SD Card, plug into the Odroid HC1 and start using it.


2017-10-12 21:11 GMT+02:00 Harri Haataja <harri.haataja@iki.fi>:
I wonder if a neat set of notes for these efforts could be put on
https://wiki.debian.org/InstallingDebianOn ?



Reply to: