Skip to content

Instantly share code, notes, and snippets.

@eramax
Forked from hangst/compile_kernel.sh
Created October 21, 2023 14:40
Show Gist options
  • Save eramax/916626cd96f86363d3cb4c1ecfd25c28 to your computer and use it in GitHub Desktop.
Save eramax/916626cd96f86363d3cb4c1ecfd25c28 to your computer and use it in GitHub Desktop.
Compile mainline Linux kernel and boot on Amlogic Meson S905 through USB
# linux-meson.com/doku.php#howto
make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- defconfig
make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- Image dtbs
mkimage -A arm64 -O linux -T kernel -C none -a 0x1080000 -e 0x1080000 -n linux-next -d arch/arm64/boot/Image ../uImage
cp arch/arm64/boot/dts/amlogic/meson-gxbb-wetek-play2.dtb ../uImage BOOT_PARTITION
# ROOTFS_PARTITION can be any arm64 Linux root filesystem
setenv preboot run factory_reset_poweroff_protect;run upgrade_check;run bootmode_check;run init_display;run storeargs;run update_key;run irremote_update;run user_start;run switch_bootmode;
setenv user_start 'usb start && fatload usb 0 0x1080000 uImage && fatload usb 0 $dtb_mem_addr meson-gxbb-wetek-play2.dtb && setenv bootargs rootwait root=/dev/sda2 && bootm 0x1080000 - $dtb_mem_addr'
saveenv
reboot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment