Commit ed62df2f authored by Vladimir Bashkirtsev's avatar Vladimir Bashkirtsev

Added support for AmLogic Meson GXL S905X

parent 38baad41
...@@ -329,3 +329,99 @@ dtparam=spi=on ...@@ -329,3 +329,99 @@ dtparam=spi=on
avoid_warnings=1 avoid_warnings=1
endef endef
export RPI3CONFIG_MENDER export RPI3CONFIG_MENDER
amlogics905x: amlogics905x-boot-cmd amlogics905x-fw_env.config
tar xf u-boot-2019.04.tar.bz2
$(MAKE) -C u-boot-2019.04 p212_defconfig
$(MAKE) -C u-boot-2019.04
tar xf amlogics905x-firmware.tar.xz -C u-boot-2019.04
cp u-boot-2019.04/u-boot.bin u-boot-2019.04/fip/bl33.bin
cd u-boot-2019.04 && ./blx_fix.sh fip/bl30.bin fip/zero_tmp fip/bl30_zero.bin fip/bl301.bin fip/bl301_zero.bin fip/bl30_new.bin bl30
cd u-boot-2019.04 && ./acs_tool.py fip/bl2.bin fip/bl2_acs.bin fip/acs.bin 0
cd u-boot-2019.04 && ./blx_fix.sh fip/bl2_acs.bin fip/zero_tmp fip/bl2_zero.bin fip/bl21.bin fip/bl21_zero.bin fip/bl2_new.bin bl2
$(MAKE) -C u-boot-2019.04/gxlimg
cd u-boot-2019.04 && gxlimg/gxlimg -t bl2 -s fip/bl2_new.bin fip/bl2.bin.enc
cd u-boot-2019.04 && gxlimg/gxlimg -t bl3x -c fip/bl30_new.bin fip/bl30_new.bin.enc
cd u-boot-2019.04 && gxlimg/gxlimg -t bl3x -c fip/bl31.img fip/bl31.img.enc
cd u-boot-2019.04 && gxlimg/gxlimg -t bl3x -c fip/bl33.bin fip/bl33.bin.enc
cd u-boot-2019.04 && gxlimg/gxlimg -t fip --bl2 fip/bl2.bin.enc --bl30 fip/bl30_new.bin.enc --bl31 fip/bl31.img.enc --bl33 fip/bl33.bin.enc fip/u-boot.bin
mkdir /uboot
mkfs -t vfat -n UBOOT /dev/$(DISK)1
sed -i '/\/dev\/root/a \/dev\/disk\/by-label\/UBOOT \/uboot vfat defaults,sync,auto 0 0' /etc/fstab
mount /dev/$(DISK)1 /uboot
dd if=u-boot-2019.04/fip/u-boot.bin of=/dev/$(ROOT_DEVICE) conv=fsync,notrunc bs=512 skip=1
@echo "$$BOOTCMD_AMLOGICS905X" > u-boot-2019.04/boot.cmd
u-boot-2019.04/tools/mkimage -C none -A arm -T script -d u-boot-2019.04/boot.cmd /uboot/boot.scr
$(MAKE) -C u-boot-2019.04 envtools
cp u-boot-2019.04/tools/env/fw_printenv /sbin/fw_printenv
ln -sf /sbin/fw_printenv /sbin/fw_setenv
@echo "$$FW_ENV_AMLOGICS905X" > /etc/fw_env.config
dd if=/dev/zero of=/uboot/uboot.env bs=1024 count=16
/sbin/fw_setenv reset
umount /dev/$(DISK)1
rm -rf u-boot-2019.04
amlogics905x-boot-cmd:
define BOOTCMD_AMLOGICS905X
load mmc 1:2 $${kernel_addr_r} boot/Image
load mmc 1:2 $${fdt_addr_r} boot/machine.dtb
setenv bootargs console=tty1 root=/dev/$(DISK)2 rootfstype=ext4 rootflags=discard rw rootwait elevator=noop quiet loglevel=3 systemd.show_status=1
booti $${kernel_addr_r} - $${fdt_addr_r}
endef
export BOOTCMD_AMLOGICS905X
amlogics905x-fw_env.config:
define FW_ENV_AMLOGICS905X
/uboot/uboot.env 0x00000 0x04000
endef
export FW_ENV_AMLOGICS905X
amlogics905x-mender: amlogics905x-boot-cmd-mender amlogics905x-fw_env.config-mender
tar xf u-boot-2019.04.tar.bz2
patch -Np1 -d u-boot-2019.04 < u-boot-2019.04-mender.patch
patch -Np1 -d u-boot-2019.04 < u-boot-2019.04-boot_from_mmc1.patch
$(MAKE) -C u-boot-2019.04 p212_defconfig
@echo "CONFIG_ENV_IS_IN_MMC=y" >> u-boot-2019.04/.config
$(MAKE) -C u-boot-2019.04 oldconfig
$(MAKE) -C u-boot-2019.04
tar xf amlogics905x-firmware.tar.xz -C u-boot-2019.04
cp u-boot-2019.04/u-boot.bin u-boot-2019.04/fip/bl33.bin
cd u-boot-2019.04 && ./blx_fix.sh fip/bl30.bin fip/zero_tmp fip/bl30_zero.bin fip/bl301.bin fip/bl301_zero.bin fip/bl30_new.bin bl30
cd u-boot-2019.04 && ./acs_tool.py fip/bl2.bin fip/bl2_acs.bin fip/acs.bin 0
cd u-boot-2019.04 && ./blx_fix.sh fip/bl2_acs.bin fip/zero_tmp fip/bl2_zero.bin fip/bl21.bin fip/bl21_zero.bin fip/bl2_new.bin bl2
$(MAKE) -C u-boot-2019.04/gxlimg
cd u-boot-2019.04 && gxlimg/gxlimg -t bl2 -s fip/bl2_new.bin fip/bl2.bin.enc
cd u-boot-2019.04 && gxlimg/gxlimg -t bl3x -c fip/bl30_new.bin fip/bl30_new.bin.enc
cd u-boot-2019.04 && gxlimg/gxlimg -t bl3x -c fip/bl31.img fip/bl31.img.enc
cd u-boot-2019.04 && gxlimg/gxlimg -t bl3x -c fip/bl33.bin fip/bl33.bin.enc
cd u-boot-2019.04 && gxlimg/gxlimg -t fip --bl2 fip/bl2.bin.enc --bl30 fip/bl30_new.bin.enc --bl31 fip/bl31.img.enc --bl33 fip/bl33.bin.enc fip/u-boot.bin
mount /dev/$(DISK)1 /uboot
dd if=/dev/zero of=/dev/$(ROOT_DEVICE) bs=512 seek=1 count=49151
dd if=u-boot-2019.04/fip/u-boot.bin of=/dev/$(ROOT_DEVICE) conv=fsync,notrunc bs=512 skip=1
@echo "$$BOOTCMD_AMLOGICS905X_MENDER" > u-boot-2019.04/boot.cmd
u-boot-2019.04/tools/mkimage -C none -A arm -T script -d u-boot-2019.04/boot.cmd /uboot/boot.scr
$(MAKE) -C u-boot-2019.04 envtools
cp u-boot-2019.04/tools/env/fw_printenv /sbin/fw_printenv
ln -svf /sbin/fw_printenv /sbin/fw_setenv
@echo "$$FW_ENV_AMLOGICS905X_MENDER" > /etc/fw_env.config
/sbin/fw_setenv reset
umount /dev/$(DISK)1
rm -rf u-boot-2019.04
amlogics905x-boot-cmd-mender:
define BOOTCMD_AMLOGICS905X_MENDER
run mender_setup
load $${mender_uboot_root} $${kernel_addr_r} boot/Image
load $${mender_uboot_root} $${fdt_addr_r} boot/machine.dtb
setenv bootargs console=tty1 panic=10 panic_on_oops=1 root=$${mender_kernel_root} rootfstype=ext4 ro rootwait elevator=noop quiet loglevel=3 systemd.show_status=1
booti $${kernel_addr_r} - $${fdt_addr_r}
run mender_try_to_recover
endef
export BOOTCMD_AMLOGICS905X_MENDER
amlogics905X-fw_env.config-mender:
define FW_ENV_AMLOGICS905X_MENDER
/dev/$(ROOT_DEVICE) 0x400000 0x20000
/dev/$(ROOT_DEVICE) 0x800000 0x20000
endef
export FW_ENV_AMLOICS905X_MENDER
diff -uNr u-boot-2019.04/include/config_mender_defines.h u-boot-2019.04-boot_from_mmc1/include/config_mender_defines.h
--- u-boot-2019.04/include/config_mender_defines.h 2020-03-05 13:35:37.709211780 +1030
+++ u-boot-2019.04-boot_from_mmc1/include/config_mender_defines.h 2020-03-05 13:39:02.755576198 +1030
@@ -3,7 +3,7 @@
#define MENDER_ROOTFS_PART_A_NUMBER 2
#define MENDER_ROOTFS_PART_B_NUMBER 3
#define MENDER_UBOOT_STORAGE_INTERFACE "mmc"
-#define MENDER_UBOOT_STORAGE_DEVICE 0
+#define MENDER_UBOOT_STORAGE_DEVICE 1
/* BB variables. */
#define MENDER_STORAGE_DEVICE_BASE "/dev/mmcblk0p"
bin
/sbin/.*
/var/lock/.*
etc
/etc/.*
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment