Cant boot into home-rolled Arch Linux image
As a learning experience, I've been trying to roll my own Arch Linux image. I've been cobbling together bits and pieces from the following locations while adding some bits of my own:
  1. anarsoul's build scripts
  2. Blutkoete's manual setup
  3. hku2's manual setup
  4. enospc's mostly upstream uboot
Below is a copy of my image building script. My issue is, after writing the image to my SD card and rebooting, my pinebook pro boots into debian on the eMMC. I figure I must be missing some important component to the boot process on ARM but I have no idea what that is. Since the pinebook boots into debian without showing me any sort of error message, I don't know how to debug this. Does anyone see what I am missing, or does anyone know how to get some more info out of the pinebook during boot?

#!/usr/bin/env bash
set -x
set -euo pipefail
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

# Manual Steps
# Install dirmngr
# trust arch linux arm key
# gpg --recv-keys 68B3537F39A313B3E574D06777193F152BDBE6A6

WORKSPACE=$(mktemp -d -t "arch-pinebook-pro-build-XXXXXXX")
cleanup() {
   if [ -d "$MOUNT" ]; then
       umount -R "$MOUNT" || true

   if [ -z "$LOOP_DEVICE" ]; then
       losetup -d "$LOOP_DEVICE"

if [ -d "$WORKSPACE" ]; then
rm -rf "$WORKSPACE"
trap cleanup EXIT

mkdir -p "$DOWNLOADS"
mkdir -p "$ROOT"
mkdir -p "$MOUNT"
IMAGE_SIZE="$(( 1024*1024*1024*6 ))" # bytes

archroot() {
   shift 1
   mount -o bind /tmp "$CHROOT/tmp"
   mount -o bind /dev "$CHROOT/dev"
   chroot "$CHROOT" mount -t proc proc /proc
   chroot "$CHROOT" mount -t sysfs sys /sys
   chroot "$CHROOT" "$CMD"
   chroot "$CHROOT" umount /sys
   chroot "$CHROOT" umount /proc
   umount "$CHROOT/dev"
   umount "$CHROOT/tmp"

wget -O "$DOWNLOADS/base.tar.gz.sig"
wget -O "$DOWNLOADS/base.tar.gz"
gpg --verify "$DOWNLOADS/base.tar.gz.sig" "$DOWNLOADS/base.tar.gz"

# Disk positions (in bytes)
main_start=$((boot_start + boot_size + sector_size))

dd if=/dev/zero of="$IMAGE_FILE" bs=1 count=0 seek=$IMAGE_SIZE

fdisk "$IMAGE_FILE" <<EOF


LOOP_DEVICE=$(losetup -f)

dd if="$DIR/idbloader.img" of=$LOOP_DEVICE seek=64 conv=notrunc
dd if="$DIR/u-boot.itb" of=$LOOP_DEVICE seek=16384 conv=notrunc

mkfs.vfat -n BOOT -F32 ${LOOP_DEVICE}p1
mkfs.ext4 -L ARCH ${LOOP_DEVICE}p2

mount ${LOOP_DEVICE}p2 "$MOUNT"
mkdir "$MOUNT/boot"
mount ${LOOP_DEVICE}p1 "$MOUNT/boot"

# bsdtar too old on base pinebook install
#bsdtar -xpf "$DOWNLOADS/base.tar.gz" -C "$MOUNT"
tar -xpf "$DOWNLOADS/base.tar.gz" -C "$MOUNT"
# no genfstab on base pinebook install, do in chroot instead
# genfstab -U "$MOUNT" >> "$MOUNT/etc/fstab"
mv "$MOUNT/etc/resolv.conf" "$MOUNT/etc/resolv.conf.bak"
cp /etc/resolv.conf "$MOUNT/etc/resolv.conf"

cat > "$MOUNT/chroot_commands" <<EOF
#!/usr/bin/env bash
set -x
set -euo pipefail

pacman-key --init
pacman-key --populate archlinuxarm
killall -KILL gpg-agent
pacman -Syu --noconfirm
# wget to fetch manjaro packages
# arch-install-scripts for genfstab
pacman -S --noconfirm wget arch-install-scripts

mkdir /manjaro_packages
pushd .
cd /manjaro_packages
wget ""
wget ""
wget ""
wget ""

pacman -U linux-pinebookpro-5.5.0-3-aarch64.pkg.tar.xz
pacman -U uboot-pinebookpro-2020.01-4-aarch64.pkg.tar.xz
pacman -U pinebookpro-post-install-20200203-1-any.pkg.tar.xz
pacman -U ap6256-firmware-2020.01-1-aarch64.pkg.tar.xz

genfstab -U / >> /etc/fstab

# clean up
#yes | pacman -Scc
chmod +x "$MOUNT/chroot_commands"
archroot "$MOUNT" "/chroot_commands"
rm "$MOUNT/chroot_commands"
mv "$MOUNT/etc/resolv.conf.bak" "$MOUNT/etc/resolv.conf"

umount -R "$MOUNT"
losetup -d "$LOOP_DEVICE"

cp $IMAGE_FILE "$DIR/archlinux.img"

Its worth noting that when I write the official manjaro image to the SD card, it does boot that successfully.
Anarsoul only release Pinebook build and not aware he has make one for Pinebook Pro. My takes you are using wrong build.
Thanks for replying, but I am not using his image. That list was a set of sources where I'm pulling information from. The image I'm generating is from my own script which I pasted above. In the script, I install the manjaro kernel for the pinebook pro and my uboot image is from a blog post for building uboot specifically for the pinebook pro. Is there another machine-specific part of the boot process that I'm missing?
You have root on a different partition than boot, so you need to modify /boot/boot.txt and run mkscr. You may also need to modify mkinitcpio.conf
This has helped me:
Ah thank you! As a temporary measure to test this, I moved everything down to 1 partition which worked. Now I just need to learn how to properly modify boot.txt for multiple paritions, but now that I have a working state to iterate from, that should be much easier. I'll have a look at that github repo.

Possibly Related Threads…
Thread Author Replies Views Last Post
  Arch ARM iso for Pinebook Pro hanmorten 2 196 07-09-2020, 01:37 AM
Last Post: hanmorten
  Kali Linux for Pinebook Pro Luke 71 9,864 07-03-2020, 08:48 AM
Last Post: Alstroplane
  Manjaro and Arch repository with privacy oriented software as400 23 3,516 07-03-2020, 05:34 AM
Last Post: as400
  CPU Configuration and Status Scripts for PBP/Linux Syonyk 2 171 06-26-2020, 08:53 AM
Last Post: Syonyk
  How to boot from eMMC but have root directory on an NVME? QazTheWsx 7 271 06-26-2020, 08:20 AM
Last Post: QazTheWsx
  Linux 5.7 on Pinebook Pro decisivedove 12 1,179 06-25-2020, 04:02 PM
Last Post: decisivedove
  Can't boot up Manjaro 20.04 eMMc image from SD card... rick1959 25 761 06-23-2020, 07:27 PM
Last Post: nathanielwheeler
  Cannot boot from SD card PineScape 16 755 06-23-2020, 01:59 PM
Last Post: cefre00
  ayufan Ubuntu Mate 0.9.14 black screen boot on new Pinebook Pro EricL 3 355 06-22-2020, 09:45 PM
Last Post: trinapicot
  eMMC frequently not found by Linux kernel (especially on low battery) v-man 7 427 06-21-2020, 04:30 PM
Last Post: Arwen

Forum Jump:

Users browsing this thread: 1 Guest(s)