Skip to content

Instantly share code, notes, and snippets.

@b23prodtm
Last active July 22, 2019 21:23
Show Gist options
  • Save b23prodtm/730cdd69b587961dcdfe5115c7b877f0 to your computer and use it in GitHub Desktop.
Save b23prodtm/730cdd69b587961dcdfe5115c7b877f0 to your computer and use it in GitHub Desktop.
Inflate in /boot/firmware. Place the MicroSD on to the Raspberry Pi 3 and power it on.
#!/bin/bash
WORKDIR=$(pwd)
[ -z $1 ] && echo "Usage: $0 <system-boot-folder>" && exit 0
cd $1
echo "//config.txt
# Serial console output!
enable_uart=1
# 64bit-mode
# arm_control=0x200 is deprecated https://www.raspberrypi.org/documentation/configuration/config-txt/misc.md
arm_64bit=1
# Uncomment below to use your custom named kernel
#kernel=your-kernel.img
device_tree=bcm2710-rpi-3-b-plus.dtb
overlay_prefix=overlays
# For i2c & spi
dtparam=i2c_arm=on
dtparam=spi=on
# Enable audio (loads snd_bcm2835)
dtparam=audio=on
" > ${WORKDIR}/boot-firmware-rpi3-b-config.txt
echo "//cmdline.txt
net.ifnames=0 dwc_otg.lpm_enable=0 console=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait
" > ${WORKDIR}/boot-firmware-rpi3-b-cmdline.txt
GZIP=boot-firmware-rpi3-b.arm64.tar.gz
#//MicroSD card should now contain these files below
tar -cvzf ${WORKDIR}/${GZIP} \
bootcode.bin \
start.elf \
fixup.dat \
kernel8.img \
bcm2710-rpi*.dtb \
-C ${WORKDIR} \
${WORKDIR}/boot-firmware-rpi3-b*.txt
cd ${WORKDIR}
rm boot-firmware-rpi3-b*.txt
echo "Command line
tar -xvf ${GZIP} && mv config.txt config.bak && mv cmdline.txt cmdline.bak
cp boot-firmware-rpi3-b-config.txt config.txt && cp boot-firmware-rpi3-b-cmdline.txt cmdline.txt
from destination directory to inflate kernel boot image and config"
@b23prodtm
Copy link
Author

Copy made of http://cdimage.ubuntu.com/releases/18.04/release/ features the ARM64 system-boot kernel image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment