Author: Sam Protsenko <semen.protsenko at linaro dot org>
Date: 02 May 2018
Booting Debian rootfs on AM57x EVM / BeagleBoard X15 boards
Below are commands I used to replace kernel files in Debian rootfs. Not sure that everything I did is recommended way by Debian, but it's the most familiar way of doing such things for me. Also, it's probably quite manual approach, but I don't know what is commonly used way in BeagleBoard Debian for this case.
Obtain and build all needed software
1.1 Download and build upstream U-Boot for am57xx_evm_defconfig (using 7.2.1 arm-eabi- toolchain)
1.2 Download Debian rootfs image from , use "Stretch for BeagleBoard-X15 via microSD card" link.
1.3 Unpack downloaded image and extract rootfs ext4 image from downloaded image, mount it:
$ unxz bbx15-debian-9.3-lxqt-armhf-2018-01-28-4gb.img.xz $ sudo fdisk -u -l bbx15-debian-9.3-lxqt-armhf-2018-01-28-4gb.img $ dd if=bbx15-debian-9.3-lxqt-armhf-2018-01-28-4gb.img of=rootfs.img bs=512 skip=8192 count=6955008 $ file rootfs.img $ sudo mkdir /mnt/tmp $ sudo mount -o loop rootfs.img /mnt/tmp/
1.4 Download mainline Linux kernel and build it using config file from Debian rootfs (with 7.2.1 arm-eabi- toolchain). Sed commands is a fix for kernel build errors with Debian kernel config:
$ cp /mnt/tmp/boot/config-4.9.78-ti-r94 .config $ sed -i '/CONFIG_EXTRA_FIRMWARE/d' .config $ sed -i '1s/^/KBUILD_CFLAGS += -D__linux__\n/' arch/arm/Makefile $ make olddefconfig $ make -j4 zImage modules am57xx-beagle-x15-revc.dtb
1.5 Prepare rootfs:
$ sudo -s # cd /mnt/tmp/boot # rm -rf * # cd /mnt/tmp/lib # rm -rf modules
1.6 Copy all needed kernel files to rootfs:
$ sudo -s # export INSTALL_MOD_PATH=/mnt/tmp # export ARCH=arm # make modules_install # cp arch/arm/boot/zImage /mnt/tmp/boot/ # cp arch/arm/boot/dts/am57xx-beagle-x15-revc.dtb /mnt/tmp/boot/ # cp .config /mnt/tmp/boot/config # cp System.map /mnt/tmp/boot/ # sync # umount /mnt/tmp
1.7 Make Sparse image for fastboot:
$ ext2simg rootfs.img rootfs_sparse.img
2.1 Flash MLO and u-boot.img (that you built in 1.1) to eMMC:
$ fastboot flash xloader MLO $ fastboot flash bootloader u-boot.img
2.2 Reboot the board and run next commands:
=> env default -f -a => env save => fastboot 1
2.3 Format eMMC with partition table for regular Linux boot:
$ fastboot oem format
2.4 Flash rootfs
$ fastboot flash rootfs rootfs_sparse.img $ fastboot reboot
Everything should work fine. I'm seeing nice graphical environment on my HDMI monitor connected to the board:
and I'm able to use my X15 just like PC, with mouse and keyboard connected.
You can notice some systemd errors, but I guess those are harmless. Don't want to investigate systemd related stuff anyway... If you want to, you can start with looking in /var/log/daemon.log.
SD card boot
If you want to run Debian from SD card, you can use next instructions (didn't test it, but it's quite generic, so it should work)
3.1 Format SD card with my script: 
3.2 Write MLO and u-boot.img files to 1st partition of SD card
3.3 Mount rootfs.img to /mnt/tmp and copy all files from there to 2nd partition of SD card (cp -R)
3.4 Unmount SD card partitions, insert it into the board and run U-Boot from it
3.5 Set default U-Boot environment:
=> env default -f -a => env save
3.6 Restart the board; Debian rootfs should run fine now
Again, I didn't test SD card boot, but it should work.
Boards/BeagleBoard-X15-Debian (last modified 2018-05-02 18:46:31)