...
 
Commits (3)
......@@ -82,14 +82,18 @@ IMAGE_CMD_sunxi-sdimg () {
done
fi
if [ -e "${DEPLOY_DIR_IMAGE}/fex.bin" ]
then
if [ -e "${DEPLOY_DIR_IMAGE}/fex.bin" ]; then
mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/fex.bin ::script.bin
fi
if [ -e "${DEPLOY_DIR_IMAGE}/boot.scr" ]
then
if [ -e "${DEPLOY_DIR_IMAGE}/boot.scr" ]; then
mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/boot.scr ::boot.scr
fi
if [ -e "${DEPLOY_DIR_IMAGE}/fixup.scr" ]; then
mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/fixup.scr ::fixup.scr
fi
if [ -e "${DEPLOY_DIR_IMAGE}/allwinnerEnv.txt" ]; then
mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/allwinnerEnv.txt ::allwinnerEnv.txt
fi
# Add stamp file
......
......@@ -13,9 +13,11 @@ XSERVER = "xserver-xorg \
xf86-input-mouse \
xf86-input-keyboard"
PREFERRED_PROVIDER_virtual/kernel ?= "linux-mainline"
PREFERRED_PROVIDER_virtual/kernel ?= "linux-stable"
PREFERRED_VERSION_linux-stable ?= "4.14%"
PREFERRED_PROVIDER_u-boot ?= "u-boot"
PREFERRED_PROVIDER_virtual/bootloader ?= "u-boot"
PREFERRED_VERSION_u-boot ?= "v2018.05%"
KERNEL_IMAGETYPE ?= "zImage"
......@@ -38,7 +40,7 @@ SERIAL_CONSOLE ?= "115200 ttyS0"
MACHINE_FEATURES ?= "alsa apm keyboard rtc serial screen usbgadget usbhost vfat"
PREFERRED_VERSION_u-boot ?= "v2018.05%"
PREFERRED_PROVIDER_virtual/kernel ?= "linux-stable-rt"
PREFERRED_VERSION_linux-stable-rt ?= "4.14%"
PREFERRED_PROVIDER_virtual/kernel ?= "linux-stable"
PREFERRED_VERSION_linux-stable ?= "4.14%"
KERNEL_DEVICETREE ?= "${SUNXI_OVERLAYS} ${SUNXI_KERNEL_DEVICETREE}"
\ No newline at end of file
......@@ -2,9 +2,18 @@ SOC_FAMILY ??= ""
include conf/machine/include/soc-family.inc
require allwinner-overlays.inc
PREFERRED_PROVIDER_virtual/kernel ?= "linux-mainline"
PREFERRED_PROVIDER_virtual/xserver = "xserver-xorg"
XSERVER = "xserver-xorg \
xf86-video-fbturbo \
xf86-input-evdev \
xf86-input-mouse \
xf86-input-keyboard"
PREFERRED_PROVIDER_virtual/kernel ?= "linux-stable"
PREFERRED_VERSION_linux-stable ?= "4.14%"
PREFERRED_PROVIDER_u-boot ?= "u-boot"
PREFERRED_PROVIDER_virtual/bootloader ?= "u-boot"
PREFERRED_VERSION_u-boot ?= "v2018.05%"
KERNEL_IMAGETYPE ?= "Image"
......
Boot scripts
----
There are two different boot scripts for the sunxi and sunxi64.
* The `fixup.scr` file for sunxi is copied from the `sun8i-h3-fixup.scr-cmd`
file in the armbian distro.
* The `fixup.scr` file for sunxi64 is copied from the `sun50i-h5-fixup.scr-cmd`
file in the armbian distro.
extra_bootargs=
rootfstype=ext4
# verbocity levels: 0,1,2,3,4,5,6,7,d (see: https://elinux.org/Debugging_by_printing)
verbosity=d
#!/bin/bash
# This patch code is striped from the armbian distro as
# also the patches for the allwinner H2,H3,H5
patch()
{
......@@ -52,4 +54,4 @@ process_patch_file()
fi
}
patch $1
\ No newline at end of file
patch $1
# Default to (primary) SD
setenv load_addr "0x44000000"
setenv docker_optimizations "on"
rootdev=mmcblk0p2
if itest.b *0x28 == 0x02 ; then
# U-Boot loaded from eMMC or secondary SD so use it for rootfs too
echo "U-boot loaded from eMMC or secondary SD"
rootdev=mmcblk1p2
fi
setenv bootargs console=${console} console=ttyS0,115200 root=/dev/${rootdev} rootwait panic=10 nohf=off ${extra}
load mmc 0:1 ${fdt_addr_r} ${fdtfile} || load mmc 0:1 ${fdt_addr_r} boot/${fdtfile}
load mmc 0:1 ${kernel_addr_r} zImage || load mmc 0:1 ${kernel_addr_r} boot/zImage || load mmc 0:1 ${kernel_addr_r} uImage || load mmc 0:1 ${kernel_addr_r} boot/uImage
bootz ${kernel_addr_r} - ${fdt_addr_r} || bootm ${kernel_addr_r} - ${fdt_addr_r}
\ No newline at end of file
if test -e mmc 0:1 allwinnerEnv.txt; then
load mmc 0:1 ${load_addr} allwinnerEnv.txt
env import -t ${load_addr} ${filesize}
fi
load mmc 0:1 ${kernel_addr_r} zImage || load mmc 0:1 ${kernel_addr_r} uImage
load mmc 0:1 ${fdt_addr_r} ${fdtfile}
fdt addr ${fdt_addr_r}
fdt resize 65536
# Load environment file
for overlay_file in ${overlays}; do
if load mmc 0:1 ${load_addr} overlay/${overlay_file}.dtbo; then
echo "Applying kernel provided DT overlay ${overlay_file}.dtbo"
fdt apply ${load_addr} || setenv overlay_error "true"
fi
done
if test "${overlay_error}" = "true"; then
echo "Error applying DT overlays, restoring original DT"
load mmc 0:1 ${fdt_addr_r} ${fdtfile}
else
if test -e mmc 0:1 fixup.scr; then
load mmc 0:1 ${load_addr} fixup.scr
echo "Applying user provided fixup script (fixup.scr)"
source ${load_addr}
fi
fi
setenv bootargs "console=${console} root=/dev/${rootdev} rootwait rootfstype=${rootfstype} ${extra_bootargs} loglevel=${verbosity} panic=10"
bootz ${kernel_addr_r} - ${fdt_addr_r} || bootm ${kernel_addr_r} - ${fdt_addr_r}
# overlays fixup script
# implements (or rather substitutes) overlay arguments functionality
# using u-boot scripting, environment variables and "fdt" command
# setexpr test_var ${tmp_bank} - A
# works only for hex numbers (A-F)
setenv decompose_pin 'setexpr tmp_bank sub "P(A|C|D|G)\\d+" "\\1";
setexpr tmp_pin sub "P\\S(\\d+)" "\\1";
test "${tmp_bank}" = "A" && setenv tmp_bank 0;
test "${tmp_bank}" = "C" && setenv tmp_bank 2;
test "${tmp_bank}" = "D" && setenv tmp_bank 3;
test "${tmp_bank}" = "G" && setenv tmp_bank 6'
if test -n "${param_spinor_spi_bus}"; then
test "${param_spinor_spi_bus}" = "0" && setenv tmp_spi_path "spi@01c68000"
test "${param_spinor_spi_bus}" = "1" && setenv tmp_spi_path "spi@01c69000"
fdt set /soc/${tmp_spi_path} status "okay"
fdt set /soc/${tmp_spi_path}/spiflash status "okay"
if test -n "${param_spinor_max_freq}"; then
fdt set /soc/${tmp_spi_path}/spiflash spi-max-frequency "<${param_spinor_max_freq}>"
fi
if test "${param_spinor_spi_cs}" = "1"; then
fdt set /soc/${tmp_spi_path}/spiflash reg "<1>"
fi
env delete tmp_spi_path
fi
if test -n "${param_spidev_spi_bus}"; then
test "${param_spidev_spi_bus}" = "0" && setenv tmp_spi_path "spi@01c68000"
test "${param_spidev_spi_bus}" = "1" && setenv tmp_spi_path "spi@01c69000"
fdt set /soc/${tmp_spi_path} status "okay"
fdt set /soc/${tmp_spi_path}/spidev status "okay"
if test -n "${param_spidev_max_freq}"; then
fdt set /soc/${tmp_spi_path}/spidev spi-max-frequency "<${param_spidev_max_freq}>"
fi
if test "${param_spidev_spi_cs}" = "1"; then
fdt set /soc/${tmp_spi_path}/spidev reg "<1>"
fi
env delete tmp_spi_path
fi
if test -n "${param_pps_pin}"; then
setenv tmp_bank "${param_pps_pin}"
setenv tmp_pin "${param_pps_pin}"
run decompose_pin
fdt set /soc/pinctrl@01c20800/pps_pins pins "${param_pps_pin}"
fdt get value tmp_phandle /soc/pinctrl@01c20800 phandle
fdt set /pps@0 gpios "<${tmp_phandle} ${tmp_bank} ${tmp_pin} 0>"
env delete tmp_pin tmp_bank tmp_phandle
fi
if test "${param_pps_falling_edge}" = "1"; then
fdt set /pps@0 assert-falling-edge
fi
for f in ${overlays}; do
if test "${f}" = "pwm"; then
setenv bootargs_new ""
for arg in ${bootargs}; do
if test "${arg}" = "console=ttyS0,115200"; then
echo "Warning: Disabling ttyS0 console due to enabled PWM overlay"
else
setenv bootargs_new "${bootargs_new} ${arg}"
fi
done
setenv bootargs "${bootargs_new}"
fi
done
if test -n "${param_w1_pin}"; then
setenv tmp_bank "${param_w1_pin}"
setenv tmp_pin "${param_w1_pin}"
run decompose_pin
fdt set /soc/pinctrl@01c20800/w1_pins pins "${param_w1_pin}"
fdt get value tmp_phandle /soc/pinctrl@01c20800 phandle
fdt set /onewire@0 gpios "<${tmp_phandle} ${tmp_bank} ${tmp_pin} 0>"
env delete tmp_pin tmp_bank tmp_phandle
fi
if test "${param_w1_pin_int_pullup}" = "1"; then
fdt set /soc/pinctrl@01c20800/w1_pins bias-pull-up
fi
if test "${param_uart1_rtscts}" = "1"; then
fdt get value tmp_phandle1 /soc/pinctrl@01c20800/uart1 phandle
fdt get value tmp_phandle2 /soc/pinctrl@01c20800/uart1_rts_cts phandle
fdt set /soc/serial@01c28400 pinctrl-names "default" "default"
fdt set /soc/serial@01c28400 pinctrl-0 "<${tmp_phandle1}>"
fdt set /soc/serial@01c28400 pinctrl-1 "<${tmp_phandle2}>"
env delete tmp_phandle1 tmp_phandle2
fi
if test "${param_uart2_rtscts}" = "1"; then
fdt get value tmp_phandle1 /soc/pinctrl@01c20800/uart2 phandle
fdt get value tmp_phandle2 /soc/pinctrl@01c20800/uart2_rts_cts phandle
fdt set /soc/serial@01c28800 pinctrl-names "default" "default"
fdt set /soc/serial@01c28800 pinctrl-0 "<${tmp_phandle1}>"
fdt set /soc/serial@01c28800 pinctrl-1 "<${tmp_phandle2}>"
env delete tmp_phandle1 tmp_phandle2
fi
if test "${param_uart3_rtscts}" = "1"; then
fdt get value tmp_phandle1 /soc/pinctrl@01c20800/uart3 phandle
fdt get value tmp_phandle2 /soc/pinctrl@01c20800/uart3_rts_cts phandle
fdt set /soc/serial@01c28c00 pinctrl-names "default" "default"
fdt set /soc/serial@01c28c00 pinctrl-0 "<${tmp_phandle1}>"
fdt set /soc/serial@01c28c00 pinctrl-1 "<${tmp_phandle2}>"
env delete tmp_phandle1 tmp_phandle2
fi
# Default to (primary) SD
setenv load_addr "0x44000000"
setenv rootdev "mmcblk0p2"
setenv docker_optimizations "on"
rootdev=mmcblk0p2
if itest.b *0x28 == 0x02 ; then
# U-Boot loaded from eMMC or secondary SD so use it for rootfs too
echo "U-boot loaded from eMMC or secondary SD"
rootdev=mmcblk1p2
fi
setenv bootargs console=${console} console=ttyS0,115200 root=/dev/${rootdev} rootwait panic=10 ${extra}
load mmc 0:1 ${fdt_addr_r} ${fdtfile}
if test -e mmc 0:1 allwinnerEnv.txt; then
load mmc 0:1 ${load_addr} allwinnerEnv.txt
env import -t ${load_addr} ${filesize}
fi
load mmc 0:1 ${kernel_addr_r} Image
load mmc 0:1 ${fdt_addr_r} ${fdtfile}
fdt addr ${fdt_addr_r}
fdt resize 65536
# Load environment file
for overlay_file in ${overlays}; do
if load mmc 0:1 ${load_addr} overlay/${overlay_file}.dtbo; then
echo "Applying kernel provided DT overlay ${overlay_file}.dtbo"
fdt apply ${load_addr} || setenv overlay_error "true"
fi
done
if test "${overlay_error}" = "true"; then
echo "Error applying DT overlays, restoring original DT"
load mmc 0:1 ${fdt_addr_r} ${fdtfile}
else
if test -e mmc 0:1 fixup.scr; then
load mmc 0:1 ${load_addr} fixup.scr
echo "Applying user provided fixup script (fixup.scr)"
source ${load_addr}
fi
fi
setenv bootargs "console=${console} root=/dev/${rootdev} rootwait rootfstype=${rootfstype} ${extra_bootargs} loglevel=${verbosity} panic=10"
booti ${kernel_addr_r} - ${fdt_addr_r}
\ No newline at end of file
# overlays fixup script
# implements (or rather substitutes) overlay arguments functionality
# using u-boot scripting, environment variables and "fdt" command
# setexpr test_var ${tmp_bank} - A
# works only for hex numbers (A-F)
setenv decompose_pin 'setexpr tmp_bank sub "P(A|C|D|G)\\d+" "\\1";
setexpr tmp_pin sub "P\\S(\\d+)" "\\1";
test "${tmp_bank}" = "A" && setenv tmp_bank 0;
test "${tmp_bank}" = "C" && setenv tmp_bank 2;
test "${tmp_bank}" = "D" && setenv tmp_bank 3;
test "${tmp_bank}" = "G" && setenv tmp_bank 6'
if test -n "${param_spinor_spi_bus}"; then
test "${param_spinor_spi_bus}" = "0" && setenv tmp_spi_path "spi@01c68000"
test "${param_spinor_spi_bus}" = "1" && setenv tmp_spi_path "spi@01c69000"
fdt set /soc/${tmp_spi_path} status "okay"
fdt set /soc/${tmp_spi_path}/spiflash status "okay"
if test -n "${param_spinor_max_freq}"; then
fdt set /soc/${tmp_spi_path}/spiflash spi-max-frequency "<${param_spinor_max_freq}>"
fi
if test "${param_spinor_spi_cs}" = "1"; then
fdt set /soc/${tmp_spi_path}/spiflash reg "<1>"
fi
env delete tmp_spi_path
fi
if test -n "${param_spidev_spi_bus}"; then
test "${param_spidev_spi_bus}" = "0" && setenv tmp_spi_path "spi@01c68000"
test "${param_spidev_spi_bus}" = "1" && setenv tmp_spi_path "spi@01c69000"
fdt set /soc/${tmp_spi_path} status "okay"
fdt set /soc/${tmp_spi_path}/spidev status "okay"
if test -n "${param_spidev_max_freq}"; then
fdt set /soc/${tmp_spi_path}/spidev spi-max-frequency "<${param_spidev_max_freq}>"
fi
if test "${param_spidev_spi_cs}" = "1"; then
fdt set /soc/${tmp_spi_path}/spidev reg "<1>"
fi
env delete tmp_spi_path
fi
if test -n "${param_pps_pin}"; then
setenv tmp_bank "${param_pps_pin}"
setenv tmp_pin "${param_pps_pin}"
run decompose_pin
fdt set /soc/pinctrl@01c20800/pps_pins pins "${param_pps_pin}"
fdt get value tmp_phandle /soc/pinctrl@01c20800 phandle
fdt set /pps@0 gpios "<${tmp_phandle} ${tmp_bank} ${tmp_pin} 0>"
env delete tmp_pin tmp_bank tmp_phandle
fi
if test "${param_pps_falling_edge}" = "1"; then
fdt set /pps@0 assert-falling-edge
fi
for f in ${overlays}; do
if test "${f}" = "pwm"; then
setenv bootargs_new ""
for arg in ${bootargs}; do
if test "${arg}" = "console=ttyS0,115200"; then
echo "Warning: Disabling ttyS0 console due to enabled PWM overlay"
else
setenv bootargs_new "${bootargs_new} ${arg}"
fi
done
setenv bootargs "${bootargs_new}"
fi
done
if test -n "${param_w1_pin}"; then
setenv tmp_bank "${param_w1_pin}"
setenv tmp_pin "${param_w1_pin}"
run decompose_pin
fdt set /soc/pinctrl@01c20800/w1_pins pins "${param_w1_pin}"
fdt get value tmp_phandle /soc/pinctrl@01c20800 phandle
fdt set /onewire@0 gpios "<${tmp_phandle} ${tmp_bank} ${tmp_pin} 0>"
env delete tmp_pin tmp_bank tmp_phandle
fi
if test "${param_w1_pin_int_pullup}" = "1"; then
fdt set /soc/pinctrl@01c20800/w1_pins bias-pull-up
fi
if test "${param_uart1_rtscts}" = "1"; then
fdt get value tmp_phandle1 /soc/pinctrl@01c20800/uart1 phandle
fdt get value tmp_phandle2 /soc/pinctrl@01c20800/uart1_rts_cts phandle
fdt set /soc/serial@01c28400 pinctrl-names "default" "default"
fdt set /soc/serial@01c28400 pinctrl-0 "<${tmp_phandle1}>"
fdt set /soc/serial@01c28400 pinctrl-1 "<${tmp_phandle2}>"
env delete tmp_phandle1 tmp_phandle2
fi
if test "${param_uart2_rtscts}" = "1"; then
fdt get value tmp_phandle1 /soc/pinctrl@01c20800/uart2 phandle
fdt get value tmp_phandle2 /soc/pinctrl@01c20800/uart2_rts_cts phandle
fdt set /soc/serial@01c28800 pinctrl-names "default" "default"
fdt set /soc/serial@01c28800 pinctrl-0 "<${tmp_phandle1}>"
fdt set /soc/serial@01c28800 pinctrl-1 "<${tmp_phandle2}>"
env delete tmp_phandle1 tmp_phandle2
fi
if test "${param_uart3_rtscts}" = "1"; then
fdt get value tmp_phandle1 /soc/pinctrl@01c20800/uart3 phandle
fdt get value tmp_phandle2 /soc/pinctrl@01c20800/uart3_rts_cts phandle
fdt set /soc/serial@01c28c00 pinctrl-names "default" "default"
fdt set /soc/serial@01c28c00 pinctrl-0 "<${tmp_phandle1}>"
fdt set /soc/serial@01c28c00 pinctrl-1 "<${tmp_phandle2}>"
env delete tmp_phandle1 tmp_phandle2
fi
......@@ -16,8 +16,10 @@ DEFAULT_PREFERENCE_sun50i="1"
SRC_URI = "git://git.denx.de/u-boot.git;branch=master \
file://u-boot-pylibfdt-native-build.patch \
file://${ARMBIAN_DEFCONFIG}-boot/boot.cmd \
file://${ARMBIAN_DEFCONFIG}-boot/fixup.cmd \
file://do_patch.sh \
file://patches \
file://allwinnerEnv.txt \
"
SRCREV = "890e79f2b1c26c5ba1a86d179706348aec7feef7"
......@@ -29,6 +31,7 @@ S = "${WORKDIR}/git"
UBOOT_ENV_SUFFIX = "scr"
UBOOT_ENV = "boot"
UBOOT_FIXUP_BINARY = "fixup.scr"
EXTRA_OEMAKE += ' HOSTLDSHARED="${BUILD_CC} -shared ${BUILD_LDFLAGS} ${BUILD_CFLAGS}" '
EXTRA_OEMAKE_append_sun50i = " BL31=${DEPLOY_DIR_IMAGE}/bl31.bin "
......@@ -38,9 +41,18 @@ do_compile_sun50i[depends] += "atf-sunxi:do_deploy"
do_compile_append() {
cp ${WORKDIR}/${ARMBIAN_DEFCONFIG}-boot/boot.cmd ${WORKDIR}/boot.cmd
${B}/tools/mkimage -C none -A arm -T script -d ${WORKDIR}/boot.cmd ${WORKDIR}/${UBOOT_ENV_BINARY}
cp ${WORKDIR}/${ARMBIAN_DEFCONFIG}-boot/fixup.cmd ${WORKDIR}/fixup.cmd
${B}/tools/mkimage -C none -A arm -T script -d ${WORKDIR}/fixup.cmd ${WORKDIR}/${UBOOT_FIXUP_BINARY}
}
do_configure_prepend() {
cd ${S}
${WORKDIR}/do_patch.sh ${WORKDIR}/patches
}
do_deploy_append() {
# Copy also the fixup script to the deploy dir
install -m 644 ${WORKDIR}/${UBOOT_FIXUP_BINARY} ${DEPLOYDIR}/${UBOOT_FIXUP_BINARY}
install -m 644 ${WORKDIR}/allwinnerEnv.txt ${DEPLOYDIR}/allwinnerEnv.txt
}
\ No newline at end of file
......@@ -67,7 +67,7 @@ index 0000000..b8e5ca9
+
+/ {
+ model = "Xunlong Orange Pi Zero Plus";
+ compatible = "xunlong,orangepi-pc2", "allwinner,sun50i-h5";
+ compatible = "xunlong,orangepi-zero-plus", "allwinner,sun50i-h5";
+
+ reg_vcc3v3: vcc3v3 {
+ compatible = "regulator-fixed";
......