From a82dc77aee0c286de600192365922dc74741185f Mon Sep 17 00:00:00 2001 From: Guillaume Romagny Date: Tue, 4 Oct 2016 10:40:04 +0200 Subject: [PATCH] XU4 next: single partition boot (no headache version) (#486) --- config/bootscripts/boot-odroid-xu4-next.cmd | 97 ++------- config/bootscripts/boot-odroid-xu4-next.ini | 201 ------------------ config/sources/odroidxu4.conf | 47 ++-- .../u-boot-odroidxu-next/xu4_sd_fusing.patch | 78 +++++++ 4 files changed, 109 insertions(+), 314 deletions(-) delete mode 100644 config/bootscripts/boot-odroid-xu4-next.ini create mode 100644 patch/u-boot/u-boot-odroidxu-next/xu4_sd_fusing.patch diff --git a/config/bootscripts/boot-odroid-xu4-next.cmd b/config/bootscripts/boot-odroid-xu4-next.cmd index d843320aad..46dd77a7e6 100644 --- a/config/bootscripts/boot-odroid-xu4-next.cmd +++ b/config/bootscripts/boot-odroid-xu4-next.cmd @@ -1,93 +1,24 @@ -# This is an example file to generate boot.scr - a boot script for U-Boot -# Generate boot.scr: -# ./tools/mkimage -c none -A arm -T script -d autoboot.cmd boot.scr +# a boot script for U-Boot / Odroid XU4 # -# It requires a list of environment variables to be defined before load: +# It requires a list of environment variables to be defined before load (in includes files uboot/.../exy*.h): # platform dependent: boardname, fdtfile, console # system dependent: mmcbootdev, mmcbootpart, mmcrootdev, mmcrootpart, rootfstype # -setenv fdtaddr "40800000" -setenv initrdname "uInitrd" -setenv initrdaddr "42000000" -setenv mmcrootdev "1" -setenv loaddtb "load mmc ${mmcbootdev}:${mmcbootpart} ${fdtaddr} ${fdtfile}" -setenv loadinitrd "load mmc ${mmcbootdev}:${mmcbootpart} ${initrdaddr} ${initrdname}" -setenv loadkernel "load mmc ${mmcbootdev}:${mmcbootpart} '${kerneladdr}' '${kernelname}'" -setenv kernel_args "setenv bootargs ${console} root=/dev/mmcblk${mmcrootdev}p${mmcrootpart} rootfstype=${rootfstype} rootwait earlyprintk ${opts}" -#### Routine: check_dtb - check that target.dtb exists on boot partition -setenv check_dtb " -if test -e mmc '${mmcbootdev}':'${mmcbootpart}' '${fdtfile}'; then - run loaddtb; - setenv fdt_addr ${fdtaddr}; -else - echo Warning! Booting without DTB: '${fdtfile}'!; - setenv fdt_addr; -fi;" +setenv kerneladdr 0x40800000 +setenv initrdaddr 0x42000000 +setenv ftdaddr 0x44000000 -#### Routine: check_ramdisk - check that uInitrd exists on boot partition -setenv check_ramdisk " -if test -e mmc '${mmcbootdev}':'${mmcbootpart}' '${initrdname}'; then - echo "Found ramdisk image."; - run loadinitrd; - setenv initrd_addr ${initrdaddr}; -else - echo Warning! Booting without RAMDISK: '${initrdname}'!; - setenv initrd_addr -; -fi;" +setenv consolecfg "console=tty1 console=ttySAC2,115200n8" -#### Routine: boot_fit - check that env $boardname is set and boot proper config of ITB image -setenv setboot_fit " -if test -e '${boardname}'; then - setenv fdt_addr ; - setenv initrd_addr ; - setenv kerneladdr 0x42000000; - setenv kernelname Image.itb; - setenv itbcfg "\"#${boardname}\""; - setenv imgbootcmd bootm; -else - echo Warning! Variable: \$boardname is undefined!; -fi" +setenv rootfs "/dev/mmcblk1p1" -#### Routine: setboot_uimg - prepare env to boot uImage -setenv setboot_uimg " - setenv kerneladdr 0x40007FC0; - setenv kernelname uImage; - setenv itbcfg ; - setenv imgbootcmd bootm; - run check_dtb; - run check_ramdisk;" +setenv bootargs "${consolecfg} root=${rootfs} rootfstype=${rootfstype} rootwait rw earlyprintk ${opts}"; +load mmc ${mmcbootdev}:${mmcbootpart} ${kerneladdr} /boot/zImage; +load mmc ${mmcbootdev}:${mmcbootpart} ${initrdaddr} /boot/uInitrd; +load mmc ${mmcbootdev}:${mmcbootpart} ${ftdaddr} /boot/dtb/exynos5422-odroidxu4.dtb; -#### Routine: setboot_zimg - prepare env to boot zImage -setenv setboot_zimg " - setenv kerneladdr 0x40007FC0; - setenv kernelname zImage; - setenv itbcfg ; - setenv imgbootcmd bootz; - run check_dtb; - run check_ramdisk;" +bootz ${kerneladdr} ${initrdaddr} ${ftdaddr}; -#### Routine: boot_img - boot the kernel after env setup -setenv boot_img " - run loadkernel; - run kernel_args; - '${imgbootcmd}' '${kerneladdr}${itbcfg}' '${initrd_addr}' '${fdt_addr}';" - -#### Routine: autoboot - choose proper boot path -setenv autoboot " -if test -e mmc 0:${mmcbootpart} Image.itb; then - echo Found kernel image: Image.itb; - run setboot_fit; - run boot_img; -elif test -e mmc 0:${mmcbootpart} zImage; then - echo Found kernel image: zImage; - run setboot_zimg; - run boot_img; -elif test -e mmc 0:${mmcbootpart} uImage; then - echo Found kernel image: uImage; - run setboot_uimg; - run boot_img; -fi;" - -#### Execute the defined autoboot macro -run autoboot +# Generate boot.scr: +# mkimage -c none -A arm -T script -d boot.cmd boot.scr \ No newline at end of file diff --git a/config/bootscripts/boot-odroid-xu4-next.ini b/config/bootscripts/boot-odroid-xu4-next.ini deleted file mode 100644 index 1217b65ecb..0000000000 --- a/config/bootscripts/boot-odroid-xu4-next.ini +++ /dev/null @@ -1,201 +0,0 @@ -ODROIDXU-UBOOT-CONFIG - -# U-Boot Parameters -setenv initrd_high "0xffffffff" -setenv fdt_high "0xffffffff" - -# Mac address configuration -setenv macaddr "00:1e:06:61:7a:55 - -#------------------------------------------------------------------------------------------------------ -# Basic Ubuntu Setup. Don't touch unless you know what you are doing. -# -------------------------------- - -#setenv bootrootfs "console=tty1 console=ttySAC2,115200n8 loglevel=1 root=/dev/mmcblk0p2 rootwait ro fsck.repair=yes" -setenv bootrootfs "console=tty1 console=ttySAC2,115200n8 loglevel=1 root=/dev/mmcblk1p2 rootwait ro fsck.repair=yes" - -# boot parameter for serial console -# console=ttySAC2,115200n8 - -# boot commands -setenv bootcmd "fatload mmc 0:1 0x40008000 zImage; fatload mmc 0:1 0x42000000 uInitrd; fatload mmc 0:1 0x44000000 dtb/exynos5422-odroidxu4.dtb; bootz 0x40008000 0x42000000 0x44000000" - -# --- Screen Configuration for HDMI --- # -# --------------------------------------- -# Uncomment only ONE line! Leave all commented for automatic selection. -# Uncomment only the setenv line! -# --------------------------------------- -# ODROID-VU forced resolution -# setenv videoconfig "video=HDMI-A-1:1280x800@60" -# ----------------------------------------------- -# ODROID-VU forced EDID -# setenv videoconfig "drm_kms_helper.edid_firmware=edid/1280x800.bin" -# ----------------------------------------------- -# 1920x1080 (1080P) with monitor provided EDID information. (1080p-edid) -# setenv videoconfig "video=HDMI-A-1:1920x1080@60" -# ----------------------------------------------- -# 1920x1080 (1080P) without monitor data using generic information (1080p-noedid) -# setenv videoconfig "drm_kms_helper.edid_firmware=edid/1920x1080.bin" -# ----------------------------------------------- -# 1920x1080 50hz (1080P) with monitor provided EDID information. (1080p 50hz-edid) -# setenv videoconfig "video=HDMI-A-1:1920x1080@50" -# ----------------------------------------------- -# 1920x1080 50hz (1080P) without monitor data using generic information (1080p 50hz-noedid) -# setenv videoconfig "drm_kms_helper.edid_firmware=edid/1920x1080_50hz.bin" -# ----------------------------------------------- -# 1440x900 with monitor provided EDID information. -# setenv videoconfig "video=HDMI-A-1:1440x900@60" -# ----------------------------------------------- -# 1440x900 without monitor data using generic information -# setenv videoconfig "drm_kms_helper.edid_firmware=edid/1440x900.bin" -# ----------------------------------------------- -# 1280x720 (720P) with monitor provided EDID information. (720p-edid) -# setenv videoconfig "video=HDMI-A-1:1280x720@60" -# ----------------------------------------------- -# 1280x720 (720P) without monitor data using generic information (720p-noedid) -# setenv videoconfig "drm_kms_helper.edid_firmware=edid/1280x720.bin" -# ----------------------------------------------- -# 1024x768 without monitor data using generic information -# setenv videoconfig "drm_kms_helper.edid_firmware=edid/1024x768.bin" -# ----------------------------------------------- -# 800x600 without monitor data using generic information -# setenv videoconfig "drm_kms_helper.edid_firmware=edid/800x600.bin" -# ----------------------------------------------- -# 800x480 without monitor data using generic information (ODROID 7") -# setenv videoconfig "drm_kms_helper.edid_firmware=edid/800x480.bin" -# ----------------------------------------------- -# 720x576 without monitor data using generic information -# setenv videoconfig "drm_kms_helper.edid_firmware=edid/720x576.bin" -# ----------------------------------------------- -# 720x480 without monitor data using generic information -# setenv videoconfig "drm_kms_helper.edid_firmware=edid/720x480.bin" -# ----------------------------------------------- -# 640x480 without monitor data using generic information -# setenv videoconfig "drm_kms_helper.edid_firmware=edid/640x480.bin" - - -# --- HDMI / DVI Mode Selection --- -# ------------------------------------------ -# - HDMI Mode -setenv vout "hdmi" -# - DVI Mode (disables sound over HDMI as per DVI compat) -# setenv vout "dvi" - - -# --- CPU Governor Setup --- -# Uncomment only one line. New governor is set after 90secs after boot. -# ------------------------------------------ -# - Performance (Keep all the CPU's at Maximum frequency) -# setenv governor "performance" -# ------------------------------------------ -# - Ondemand -# setenv governor "ondemand" -# ------------------------------------------ -# - Interactive (Pretty much just like ondemand with more possible customization via sysfs.) -# setenv governor "interactive" -# ------------------------------------------ -# - Conservative (Like ondemand, but do the frequency transitions more slowly, great for battery powered applications) -setenv governor "conservative" -# ------------------------------------------ -# - Powersave (Keeps the CPU's to the lowest possible temps) -# setenv governor "powersave" - - -#------------------------------------------------------------------------------ -# -# HDMI-PHY Parameter Control -# -#------------------------------------------------------------------------------ -#------------------------------------------------------------------------------ -# -# HDMI Hot Plug detection -# -#------------------------------------------------------------------------------ -# -# Forces the HDMI subsystem to ignore the check if the cable is connected or -# not. -# false : disable the detection and force it as connected. -# true : let cable, board and monitor decide the connection status. -# -# default: true -# -#------------------------------------------------------------------------------ -setenv HPD "true" - -#------------------------------------------------------------------------------ -# -# TMDS data amplitude control. -# -#------------------------------------------------------------------------------ -# -# 1LSB corresponds to 20 mVdiff amplitude level. -# tx_amp_lvl : 0 = 760 mVdiff(Min), 31 = 1380 mVdiff(Max) -# -# Hardkernel default hdmi_tx_amp_lvl = 31(1380 mVdiff); -#------------------------------------------------------------------------------ -setenv hdmi_tx_amp_lvl "31" - -#------------------------------------------------------------------------------ -# -# TMDS data amplitude fine control for each channel. -# -#------------------------------------------------------------------------------ -# -# 1LSB corresponds to 20 mVdiff amplitude level. -# tx_lvl : 0 = 0 mVdiff(Min), 3 = 60 mVdiff(Max) -# -# Hardkernel default -# hdmi_tx_lvl_ch0 = 3, hdmi_tx_lvl_ch1 = 3, hdmi_tx_lvl_ch2 = 3, -#------------------------------------------------------------------------------ -setenv hdmi_tx_lvl_ch0 "3" -setenv hdmi_tx_lvl_ch1 "3" -setenv hdmi_tx_lvl_ch2 "3" - -#------------------------------------------------------------------------------ -# -# TMDS data pre-emphasis level control. -# -#------------------------------------------------------------------------------ -# -# 1LSB corresponds to -0.45dB emphasis level except for 1 -# tx_emp_lvl : 0 = 0 db(Min), 1 = -0.25 db, 2 = 0.7 db, 15 = -7.45 db(Max) -# -# Hardkernel default hdmi_tx_emp_lvl = 6 (-2.50 db); -#------------------------------------------------------------------------------ -setenv hdmi_tx_emp_lvl "6" - -#------------------------------------------------------------------------------ -# -# TMDS clock amplitude control. -# -#------------------------------------------------------------------------------ -# -# 1LSB corresponds to 20 mVdiff amplitude level. -# clk_amp_lvl : 0 = 790 mVdiff(Min), 31 = 1410 mVdiff(Max) -# -# Hardkernel default hdmi_clk_amp_lvl = 31 (1410 mVdiff) -#------------------------------------------------------------------------------ -setenv hdmi_clk_amp_lvl "31" - -#------------------------------------------------------------------------------ -# -# TMDS data source termination resistor control. -# -#------------------------------------------------------------------------------ -# -# tx_res : -# 0 = Source Termination OFF(Min), 1 = 200 ohm, 2 = 300 ohm, 3 = 120 ohm(Max) -# -# Hardkernrel default hdmi_tx_res = 0 (Source Termination OFF) -#------------------------------------------------------------------------------ -setenv hdmi_tx_res "0" - -#------------------------------------------------------------------------------ - -setenv hdmi_phy_control "hdmi_tx_amp_lvl=${hdmi_tx_amp_lvl} hdmi_tx_lvl_ch0=${hdmi_tx_lvl_ch0} hdmi_tx_lvl_ch1=${hdmi_tx_lvl_ch1} hdmi_tx_lvl_ch2=${hdmi_tx_lvl_ch2} hdmi_tx_emp_lvl=${hdmi_tx_emp_lvl} hdmi_clk_amp_lvl=${hdmi_clk_amp_lvl} hdmi_tx_res=${hdmi_tx_res} HPD=${HPD} vout=${vout}" - -# final boot args -setenv bootargs "${bootrootfs} ${videoconfig} smsc95xx.macaddr=${macaddr} governor=${governor} ${hdmi_phy_control}" -# drm.debug=0xff -# Boot the board -boot diff --git a/config/sources/odroidxu4.conf b/config/sources/odroidxu4.conf index 5c2fc0481d..bac4951ff5 100644 --- a/config/sources/odroidxu4.conf +++ b/config/sources/odroidxu4.conf @@ -1,11 +1,12 @@ BOOTDIR='u-boot-odroidxu' -BOOTSIZE=64 OFFSET=4 case $BRANCH in default) + BOOTSIZE=64 + BOOTSOURCE='https://github.com/hardkernel/u-boot.git' BOOTBRANCH='branch:odroidxu3-v2012.07' @@ -18,8 +19,10 @@ case $BRANCH in next) + BOOTSIZE=0 + BOOTSOURCE=$MAINLINE_UBOOT_SOURCE - BOOTBRANCH='tag:v2016.05' # $MAINLINE_UBOOT_BRANCH + BOOTBRANCH='tag:v2016.05' BOOTCONFIG=odroid-xu4_defconfig @@ -30,13 +33,13 @@ case $BRANCH in esac CPUMIN=600000 -CPUMAX=1600000 +CPUMAX=1800000 SERIALCON=ttySAC2 if [[ $BRANCH == next ]] ; then - UBOOT_FILES="xu4_blobs/bl1.bin.hardkernel xu4_blobs/bl2.bin.hardkernel.1mb_uboot u-boot-dtb.bin xu4_blobs/tzsw.bin.hardkernel" -else + UBOOT_FILES="sd_fusing.sh xu4_blobs/bl1.bin.hardkernel xu4_blobs/bl2.bin.hardkernel.1mb_uboot u-boot-dtb.bin xu4_blobs/tzsw.bin.hardkernel" +else # legacy UBOOT_FILES="sd_fuse/hardkernel/bl1.bin.hardkernel sd_fuse/hardkernel/bl2.bin.hardkernel u-boot.bin sd_fuse/hardkernel/tzsw.bin.hardkernel" fi @@ -44,26 +47,16 @@ write_uboot_platform() { if [[ $BRANCH == next ]] ; then - #if [ -n "$emmc" ]; then # offset for emmc - # signed_bl1_position=0 - # bl2_position=30 - # uboot_position=62 - # tzsw_position=2110 - # device=$1boot0 - #else # offset for sdcard - - signed_bl1_position=1 + # for sdcard (note: assuming emmc offset would be 0/30/62/2110 & device is mmcblk0boot0) + bl1_position=1 bl2_position=31 uboot_position=63 tzsw_position=2111 - device=$1 - #fi - - dd if=$1/bl1.bin.hardkernel of=$2 seek=$signed_bl1_position conv=fsync | tee -a $DEST/debug/output.log 2>&1 - dd if=$1/bl2.bin.hardkernel.1mb_uboot of=$2 seek=$bl2_position conv=fsync | tee -a $DEST/debug/output.log 2>&1 - dd if=$1/u-boot-dtb.bin of=$2 bs=512 seek=$uboot_position conv=fsync | tee -a $DEST/debug/output.log 2>&1 - dd if=$1/tzsw.bin.hardkernel of=$2 seek=$tzsw_position conv=fsync | tee -a $DEST/debug/output.log 2>&1 + dd if=$1/bl1.bin.hardkernel of=$2 seek=$bl1_position conv=fsync >/dev/null 2>&1 + dd if=$1/bl2.bin.hardkernel.1mb_uboot of=$2 seek=$bl2_position conv=fsync >/dev/null 2>&1 + dd if=$1/u-boot-dtb.bin of=$2 bs=512 seek=$uboot_position conv=fsync >/dev/null 2>&1 + dd if=$1/tzsw.bin.hardkernel of=$2 seek=$tzsw_position conv=fsync >/dev/null 2>&1 else dd if=$1/bl1.bin.hardkernel of=$2 seek=1 conv=fsync > /dev/null 2>&1 dd if=$1/bl2.bin.hardkernel of=$2 seek=31 conv=fsync > /dev/null 2>&1 @@ -79,19 +72,13 @@ family_tweaks() echo "blacklist ina231_sensor" > $CACHEDIR/sdcard/etc/modprobe.d/blacklist-odroid.conf chroot $CACHEDIR/sdcard /bin/bash -c "apt-get -y -qq remove --auto-remove lirc >/dev/null 2>&1" - if [[ $BRANCH == next ]] ; then - sed -e 's/mmcblk0/mmcblk1/g' -i $CACHEDIR/sdcard/etc/fstab | tee -a $DEST/debug/output.log 2>&1 - cp $CACHEDIR/sdcard/boot/dtb/exynos5422-odroidxu4.dtb $CACHEDIR/sdcard/boot/exynos5422-odroidxu4.dtb | tee -a $DEST/debug/output.log 2>&1 - fi - - } install_boot_script() { if [[ $BRANCH == next ]] ; then - cp $SRC/lib/config/bootscripts/boot-odroid-xu4-${BRANCH}.cmd $CACHEDIR/sdcard/boot/boot.cmd | tee -a $DEST/debug/output.log 2>&1 + cp $SRC/lib/config/bootscripts/boot-odroid-xu4-${BRANCH}.cmd $CACHEDIR/sdcard/boot/boot.cmd >/dev/null 2>&1 else - cp $SRC/lib/config/bootscripts/boot-odroid-xu4-${BRANCH}.ini $CACHEDIR/sdcard/boot/boot.ini + cp $SRC/lib/config/bootscripts/boot-odroid-xu4-${BRANCH}.ini $CACHEDIR/sdcard/boot/boot.ini >/dev/null 2>&1 fi -} +} \ No newline at end of file diff --git a/patch/u-boot/u-boot-odroidxu-next/xu4_sd_fusing.patch b/patch/u-boot/u-boot-odroidxu-next/xu4_sd_fusing.patch new file mode 100644 index 0000000000..c1981860a6 --- /dev/null +++ b/patch/u-boot/u-boot-odroidxu-next/xu4_sd_fusing.patch @@ -0,0 +1,78 @@ +--- /dev/null 2016-10-01 00:33:00.772000000 +0200 ++++ test/sd_fusing.sh 2016-10-01 00:38:22.888250020 +0200 +@@ -0,0 +1,75 @@ ++#!/bin/bash ++#################################### ++# ++# Copyright (C) 2011 Samsung Electronics Co., Ltd. ++# http://www.samsung.com/ ++# ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License version 2 as ++# published by the Free Software Foundation. ++# ++#################################### ++# ++# Modified for Arch Linux ARM package uboot-odroid-xu3 ++# ++#################################### ++ ++if [ -z $1 ] ++then ++ echo "usage: ./sd_fusing.sh " ++ exit 0 ++fi ++ ++if [ -b $1 ] ++then ++ echo "$1 reader is identified." ++else ++ echo "$1 is NOT identified." ++ exit 0 ++fi ++ ++if [ -d /sys/block/${1##*/}boot0 ]; then ++ echo "$1 is an eMMC card, disabling ${1##*/}boot0 ro" ++ if ! echo 0 > /sys/block/${1##*/}boot0/force_ro; then ++ echo "Enabling r/w for $1boot0 failed" ++ exit 1 ++ fi ++ emmc=1 ++fi ++ ++#################################### ++# fusing images ++ ++if [ -n "$emmc" ]; then ++ signed_bl1_position=0 ++ bl2_position=30 ++ uboot_position=62 ++ tzsw_position=2110 ++ device=$1boot0 ++else ++ signed_bl1_position=1 ++ bl2_position=31 ++ uboot_position=63 ++ tzsw_position=2111 ++ device=$1 ++fi ++ ++# ++echo "BL1 fusing" ++dd iflag=dsync oflag=dsync if=./bl1.bin.hardkernel of=$device seek=$signed_bl1_position ++ ++# ++echo "BL2 fusing" ++dd iflag=dsync oflag=dsync if=./bl2.bin.hardkernel.1mb_uboot of=$device seek=$bl2_position ++ ++# ++echo "u-boot fusing" ++dd iflag=dsync oflag=dsync if=./u-boot-dtb.bin of=$device seek=$uboot_position ++ ++# ++echo "TrustZone S/W fusing" ++dd iflag=dsync oflag=dsync if=./tzsw.bin.hardkernel of=$device seek=$tzsw_position ++ ++#################################### ++# ++echo "U-boot image is fused successfully."