Created
September 2, 2019 01:38
-
-
Save muttiopenbts/b3e7f3856e24a08e52d857016436bf06 to your computer and use it in GitHub Desktop.
Boundary device's 6x_bootscript which I used for learning and testing my hab images for imx6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
setenv bootargs '' | |
# setenv kernel_img_name zImage | |
setenv kernel_img_name zImage_signed_10800000 | |
setenv initrd_high 0xffffffff | |
m4='' | |
a_base=0x10000000 | |
if itest.s x51 == "x${cpu}" ; then | |
a_base=0x90000000 | |
elif itest.s x53 == "x${cpu}"; then | |
a_base=0x70000000 | |
elif itest.s x6SX == "x${cpu}" || itest.s x7D == "x${cpu}"; then | |
a_base=0x80000000 | |
if itest.s "x1" == "x$m4enabled" ; then | |
run m4boot; | |
m4='-m4'; | |
fi | |
fi | |
setexpr a_script ${a_base} + 0x00800000 | |
setexpr a_zImage ${a_base} + 0x00800000 | |
setexpr a_fdt ${a_base} + 0x03000000 | |
setexpr a_ramdisk ${a_base} + 0x03800000 | |
setexpr a_initrd ${a_base} + 0x03a00000 | |
setexpr a_reset_cause_marker ${a_base} + 0x80 | |
setexpr a_reset_cause ${a_base} + 0x84 | |
if itest.s "x" == "x${board}" ; then | |
echo "!!!! Error: Your u-boot is outdated. Please upgrade."; | |
exit; | |
fi | |
if itest.s "x" == "x${dtbname}" ; then | |
if itest.s x6SOLO == "x${cpu}" ; then | |
dtbname=imx6dl-${board}.dtb; | |
elif itest.s x6DL == "x${cpu}" ; then | |
dtbname=imx6dl-${board}.dtb; | |
elif itest.s x6QP == "x${cpu}" ; then | |
dtbname=imx6qp-${board}.dtb; | |
elif itest.s x6SX == "x${cpu}" ; then | |
dtbname=imx6sx-${board}${m4}.dtb; | |
elif itest.s x7D == "x${cpu}" ; then | |
dtbname=imx7d-${board}${m4}.dtb; | |
elif itest.s x51 == "x${cpu}" ; then | |
dtbname=imx51-${board}${m4}.dtb; | |
elif itest.s x53 == "x${cpu}" ; then | |
dtbname=imx53-${board}${m4}.dtb; | |
else | |
dtbname=imx6q-${board}.dtb; | |
fi | |
fi | |
if itest.s x${bootpart} == x ; then | |
bootpart=1 | |
fi | |
if load ${dtype} ${disk}:${bootpart} ${a_script} uEnv.txt ; then | |
env import -t ${a_script} ${filesize} | |
fi | |
setenv bootargs ${bootargs} console=${console},115200 vmalloc=400M consoleblank=0 rootwait fixrtc cpu=${cpu} board=${board} | |
if itest.s x == x${bootdir} ; then | |
bootdir=/ | |
fi | |
if load ${dtype} ${disk}:${bootpart} ${a_fdt} ${bootdir}${dtbname} ; then | |
fdt addr ${a_fdt} | |
setenv fdt_high 0xffffffff | |
else | |
echo "!!!! Error loading ${bootdir}${dtbname}"; | |
exit; | |
fi | |
# first enable tfp410 | |
i2c dev 1 | |
i2c mw 38 8.1 bd | |
cmd_xxx_present= | |
fdt resize | |
if itest.s "x" != "x${cmd_custom}" ; then | |
run cmd_custom | |
cmd_xxx_present=1; | |
fi | |
if itest.s "x" != "x${cmd_hdmi}" ; then | |
run cmd_hdmi | |
cmd_xxx_present=1; | |
if itest.s x == x${allow_noncea} ; then | |
setenv bootargs ${bootargs} mxc_hdmi.only_cea=1; | |
echo "only CEA modes allowed on HDMI port"; | |
else | |
setenv bootargs ${bootargs} mxc_hdmi.only_cea=0; | |
echo "non-CEA modes allowed on HDMI, audio may be affected"; | |
fi | |
fi | |
if itest.s "x" != "x${cmd_lcd}" ; then | |
run cmd_lcd | |
cmd_xxx_present=1; | |
fi | |
if itest.s "x" != "x${cmd_lcd2}" ; then | |
run cmd_lcd2 | |
cmd_xxx_present=1; | |
fi | |
if itest.s "x" != "x${cmd_lvds}" ; then | |
run cmd_lvds | |
cmd_xxx_present=1; | |
fi | |
if itest.s "x" != "x${cmd_lvds2}" ; then | |
run cmd_lvds2 | |
cmd_xxx_present=1; | |
fi | |
if itest.s "x" == "x${cmd_xxx_present}" ; then | |
echo "!!!!!!!!!!!!!!!!" | |
echo "warning: your u-boot may be outdated, please upgrade" | |
echo "!!!!!!!!!!!!!!!!" | |
fi | |
bpart=2 | |
if test "sata" = "${dtype}" ; then | |
setenv bootargs "${bootargs} root=/dev/sda${bpart}" ; | |
elif test "usb" = "${dtype}" ; then | |
setenv bootargs "${bootargs} root=/dev/sda${bpart}" ; | |
else | |
setenv bootargs "${bootargs} root=/dev/mmcblk${disk}p${bpart}" | |
fi | |
if itest.s "x" != "x${disable_msi}" ; then | |
setenv bootargs ${bootargs} pci=nomsi | |
fi; | |
if test "hannstar" = "${fb_lvds}" || test "hannstar" = "${fb_lvds2}" ; then | |
setenv bootargs ${bootargs} ft5x06_ts.screenres=1024,600 | |
elif test "hannstar7" = "${fb_lvds}" || test "hannstar7" = "${fb_lvds2}" ; then | |
setenv bootargs ${bootargs} ft5x06_ts.screenres=1280,800 | |
fi | |
if itest.s "x" != "x${disable_giga}" ; then | |
setenv bootargs ${bootargs} fec.disable_giga=1 | |
fi | |
if itest.s "x" != "x${wlmac}" ; then | |
setenv bootargs ${bootargs} wlcore.mac=${wlmac} | |
fi | |
if itest.s "x" != "x${bd_addr}" ; then | |
setenv bootargs ${bootargs} bd_addr=${bd_addr} | |
fi | |
if itest.s "x" != "x${gpumem}" ; then | |
setenv bootargs ${bootargs} galcore.contiguousSize=${gpumem} | |
fi | |
if itest.s "x" != "x${cma}" ; then | |
setenv bootargs ${bootargs} cma=${cma} | |
fi | |
if itest.s "x" != "x${loglevel}" ; then | |
setenv bootargs ${bootargs} loglevel=${loglevel} | |
fi | |
if itest *${a_reset_cause_marker} == 12345678 ; then | |
setexpr.l reset_cause *${a_reset_cause} | |
setenv bootargs $bootargs reset_cause=0x${reset_cause} | |
fi | |
if itest.s "x" != "x${show_fdt}" ; then | |
fdt print / | |
fi | |
if itest.s "x" != "x${show_env}" ; then | |
printenv | |
fi | |
# Boot kernel | |
# =========== | |
# TODO: Add check to ensure secure boot OTP fuse enabled | |
# location offset of ivt within img | |
ivt_offset=619000 | |
# image_hex_len = includes kernel + padding + ivt + csf | |
image_hex_len=61a970 | |
# TODO: verify possible bug. image_hex_len=619068 also passes hab_auth_img | |
if load ${dtype} ${disk}:${bootpart} ${a_zImage} /${kernel_img_name} ; then | |
if hab_auth_img ${a_zImage} ${image_hex_len} ${ivt_offset}; then | |
echo "Kernel signature verified."; | |
bootz ${a_zImage} - ${a_fdt} | |
else | |
echo "Kernel signature failed."; | |
fi | |
fi | |
echo "Error loading kernel image" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment