Optimized U-Boot startup

This commit is contained in:
Michel-FK 2019-12-29 19:14:54 +01:00
parent 25070369fd
commit 483ee02392
6 changed files with 133 additions and 5 deletions

View File

@ -1,4 +1,4 @@
setenv bootargs console=ttyS0,115200 panic=5 rootwait fbcon=map:10 fbcon=font:VGA8x8 root=/dev/mmcblk0p2 earlyprintk rootfstype=ext4 rootflags=commit=120,data=writeback,barrier=0,journal_async_commit rw resume=/dev/mmcblk0p2 resume_offset=88064 hibernate=nocompress
setenv bootargs console=ttyS0,115200 panic=5 rootwait fbcon=map:10 fbcon=font:VGA8x8 root=/dev/mmcblk0p2 rootfstype=ext4 rootflags=commit=120,data=writeback,barrier=0,journal_async_commit rw resume=/dev/mmcblk0p2 resume_offset=88064 hibernate=nocompress quiet
load mmc 0:1 0x41000000 uImage
load mmc 0:1 0x41800000 sun8i-v3s-funkey.dtb
bootm 0x41000000 - 0x41800000

View File

@ -0,0 +1,40 @@
# Configuration file for fw_(printenv/setenv) utility.
# Up to two entries are valid, in this case the redundant
# environment sector is assumed present.
# Notice, that the "Number of sectors" is not required on NOR and SPI-dataflash.
# Futhermore, if the Flash sector size is omitted, this value is assumed to
# be the same as the Environment size, which is valid for NOR and SPI-dataflash
# Device offset must be prefixed with 0x to be parsed as a hexadecimal value.
# NOR example
# MTD device name Device offset Env. size Flash sector size Number of sectors
#/dev/mtd1 0x0000 0x4000 0x4000
#/dev/mtd2 0x0000 0x4000 0x4000
# MTD SPI-dataflash example
# MTD device name Device offset Env. size Flash sector size Number of sectors
#/dev/mtd5 0x4200 0x4200
#/dev/mtd6 0x4200 0x4200
# NAND example
#/dev/mtd0 0x4000 0x4000 0x20000 2
# On a block device a negative offset is treated as a backwards offset from the
# end of the device/partition, rather than a forwards offset from the start.
# Block device example
#/dev/mmcblk0 0xc0000 0x20000
#/dev/mmcblk0 -0x20000 0x20000
/dev/mmcblk0 0x88000 0x20000
# VFAT example
#/boot/uboot.env 0x0000 0x4000
# UBI volume
#/dev/ubi0_0 0x0 0x1f000 0x1f000
#/dev/ubi0_1 0x0 0x1f000 0x1f000
# UBI volume by name
#/dev/ubi0:env 0x0 0x1f000 0x1f000
#/dev/ubi0:env-redund 0x0 0x1f000 0x1f000

View File

@ -0,0 +1,20 @@
arch=arm
args_mmc=setenv bootargs console=ttyS0,115200 panic=5 rootwait fbcon=map:10 fbcon=font:VGA8x8 root=/dev/mmcblk0p2 rootfstype=ext4 rootflags=commit=120,data=writeback,barrier=0,journal_async_commit rw resume=/dev/mmcblk0p2 resume_offset=88064 hibernate=nocompress quiet
baudrate=115200
board=sunxi
board_name=sunxi
bootcmd=run args_mmc; run loadfdt; run loadimage; bootm ${loadaddr} - ${fdtaddr}
bootdelay=0
console=ttyS0,115200
cpu=armv7
fdt_high=0xffffffff
fdtaddr=0x41800000
loadaddr=0x41000000
loadfdt=load mmc 0:1 ${fdtaddr} sun8i-v3s-funkey.dtb
loadimage=load mmc 0:1 ${loadaddr} uImage
serial#=12c000026a14b94a
soc=sunxi
stderr=serial@01c28000
stdin=serial@01c28000
stdout=serial@01c28000
verify=n

View File

@ -0,0 +1,59 @@
#!/bin/bash
# Uncomment the following line to get debug info
set -xv
fw_saveenv () {
# Check arguments
if [ $# -ne 1 ]; then
echo "usage: fw_saveenv filename" >&2 | tee /dev/kmsg
exit 1
fi
# Save the input file name
local input_file=${1}
# Read the fw_env config file
local config=$(sed -e 's/#.*$//' -e '/^$/d' /etc/fw_env.config)
set ${config}
local of=${1}
local seek=$((${2} / 1024))
local count=$((${3} / 1024))
# Create 2 temporary files
local tmp_file=$(mktemp /tmp/fw_saveenv.XXXXXX)
local raw_file=$(mktemp /tmp/fw_saveenv.XXXXXX)
local raw2_file=$(mktemp /tmp/fw_saveenv.XXXXXX)
# Convert provided file to null-terminated string blob
cat ${input_file} | tr '\n' '\0' > ${tmp_file}
# Compute blob length in bytes
local length=$(stat --printf="%s" ${tmp_file})
# Compute the padding size
let length=${count}*1024-4-${length}
# Pad blob with zeros up to the total size
dd if=/dev/zero bs=1 count=${length} >>${tmp_file} 2>/dev/null
# Compute the CRC32 for the padded blob and store it into the final file
cat ${tmp_file} | gzip -1 | tail -c 8 | head -c 4 | \
hexdump -e '1/4 "%08x" "\n"' | xxd -r -p > ${raw_file}
# Convert CRC32 to little endian
tac -rs '.' ${raw_file} ${raw2_file}
# Append the binary blob to the final file
cat ${tmp_file} >> ${raw2_file}
# Write the final file to the raw device
#dd if=${raw2_file} of=${1} bs=1k count=$((${3} / 1024)) seek=$((${2} / 1024))
# Remove the temporay files
rm ${tmp_file} ${raw_file} ${raw2_file}
return 0
}
fw_saveenv $*

View File

@ -1,24 +1,31 @@
CONFIG_ARM=y
CONFIG_ARCH_SUNXI=y
# CONFIG_SPL_LIBDISK_SUPPORT is not set
# CONFIG_SPL_POWER_SUPPORT is not set
# CONFIG_ARMV7_NONSEC is not set
CONFIG_IDENT_STRING=" FunKey"
# CONFIG_PRE_CONSOLE_BUFFER is not set
CONFIG_MACH_SUN8I_V3S=y
CONFIG_DRAM_CLK=360
CONFIG_DRAM_ZQ=14779
# CONFIG_VIDEO is not set
CONFIG_VIDEO_LCD_MODE="x:800,y:480,depth:18,pclk_khz:33000,le:87,ri:40,up:31,lo:13,hs:1,vs:1,sync:3,vmode:0"
CONFIG_VIDEO_LCD_BL_PWM="PB4"
# CONFIG_VIDEO_LCD_BL_PWM_ACTIVE_LOW is not set
CONFIG_DEFAULT_DEVICE_TREE="sun8i-v3s-funkey"
CONFIG_LOCALVERSION="-funkey"
# CONFIG_DISTRO_DEFAULTS is not set
CONFIG_BOOTDELAY=0
# CONFIG_CONSOLE_MUX is not set
CONFIG_SYS_CONSOLE_INFO_QUIET=y
CONFIG_SYS_STDIO_DEREGISTER=y
# CONFIG_DISPLAY_CPUINFO is not set
# CONFIG_DISPLAY_BOARDINFO is not set
CONFIG_SPL=y
CONFIG_HUSH_PARSER=y
CONFIG_CMD_BOOTZ=y
CONFIG_SYS_PROMPT="FunKey> "
# CONFIG_CMD_BOOTD is not set
# CONFIG_CMD_ELF is not set
# CONFIG_CMD_IMLS is not set
# CONFIG_CMD_XIMG is not set
# CONFIG_CMD_FLASH is not set
# CONFIG_CMD_FPGA is not set
# CONFIG_CMD_NET is not set
@ -27,4 +34,4 @@ CONFIG_CMD_EXT2=y
CONFIG_CMD_EXT4=y
CONFIG_CMD_FAT=y
CONFIG_CMD_FS_GENERIC=y
CONFIG_REGEX=y
# CONFIG_EFI_LOADER is not set

View File

@ -58,6 +58,8 @@ BR2_PACKAGE_SDL_MIXER=y
BR2_PACKAGE_SDL_SOUND=y
BR2_PACKAGE_SDL_SOUND_PLAYSOUND=y
BR2_PACKAGE_SDL_TTF=y
BR2_PACKAGE_UBOOT_TOOLS=y
BR2_PACKAGE_UBOOT_TOOLS_MKENVIMAGE=y
BR2_PACKAGE_ZLIB=y
BR2_PACKAGE_DHCPCD=y
BR2_PACKAGE_DROPBEAR=y