Skip to content

Commit

Permalink
hikey: inittab: spawn login shell only on ${CFG_NW_CONSOLE_UART}
Browse files Browse the repository at this point in the history
Currently, etc/inittab-hikey tries to spawn a login shell on both
ttyAMA0 and ttyAMA3 which doesn't work well when secure world and
normal world are configured to use different UARTs (in this case,
secure world won't log any more output as soon as Linux has booted).
This patch generates an inittab file with a single login shell  entry,
based on the value of $CFG_NW_CONSOLE_UART. If not set, ttyAMA3 is
used which is UART1 on the low-speed expension connector.

Fixes: OP-TEE/optee_os#1483
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Acked-by: Joakim Bech <joakim.bech@linaro.org>
  • Loading branch information
jforissier committed Jun 2, 2017
1 parent 404b590 commit cb8c773
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
4 changes: 1 addition & 3 deletions etc/inittab-hikey
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
# /etc/inittab
#
::sysinit:/etc/init.d/rc.init
# HiKey defaults to UART3 but can also use UART0
ttyAMA0::askfirst:/bin/sh -sc ". /etc/profile"
ttyAMA3::askfirst:/bin/sh -sc ". /etc/profile"
ttyAMA${CFG_NW_CONSOLE_UART}::askfirst:/bin/sh -sc ". /etc/profile"
::ctrlaltdel:/sbin/poweroff
::shutdown:/etc/init.d/rc.shutdown
::restart:/sbin/init
10 changes: 9 additions & 1 deletion generate-cpio-rootfs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,13 @@ arm-linux-gnueabihf)
;;
esac

function generate_inittab()
{
# Expand variables ${...} taking value from the environment
# http://superuser.com/a/302847
cat $1 | awk '{while(match($0,"[$]{[^}]*}")) {var=substr($0,RSTART+2,RLENGTH -3);gsub("[$]{"var"}",ENVIRON[var])}}1'>$2
}

case $1 in
"vexpress")
CFLAGS=${CFLAGS-"-Wno-strict-aliasing -Wno-unused-result -marm -mabi=aapcs-linux -mthumb -mthumb-interwork -mcpu=cortex-a15"}
Expand All @@ -88,7 +95,8 @@ case $1 in

"hikey")
echo "Building HiKey root filesystem"
cp etc/inittab-hikey etc/inittab
export CFG_NW_CONSOLE_UART=${CFG_NW_CONSOLE_UART:-3}
generate_inittab etc/inittab-hikey etc/inittab
echo "HiKey" > etc/hostname
;;

Expand Down

0 comments on commit cb8c773

Please sign in to comment.