[PATCH openbmc 9/9] initfs: Use stty to drain output before reboot

Andrew Jeffery andrew at aj.id.au
Thu Feb 25 15:14:12 AEDT 2016


On Wed, 2016-02-24 at 12:40 -0600, OpenBMC Patches wrote:
> From: "Milton D. Miller II" <miltonm at us.ibm.com>
> 
> To see all the messages during shutdown call stty cooked.
> 
> A side effect of setting any mode is it will call ioctl(TIOC_DRAIN)

So due to past indiscretions and increasing my own understanding I
tried to follow this up. Seems that:

* TIOC_DRAIN doesn't appear to be a thing?
* Google knows more about TIOCDRAIN, but not a lot?
* TCSADRAIN might be more useful to mention here?

If I were to follow it up the TIOC_DRAIN , where should I look?

Should this part of the commit message be changed?

However, I've followed the busybox stty implementation to the point of
calling tcsetattr(..., TCSADRAIN, ...), so the change looks like it
should do what we want. Also you've documented testing it below, so
that helps :)

> to drain the buffers first without regard to any change in the mode.
> 
> Shutdown and flash update now show the final ouptut

typo: output

Otherwise,

Acked-by: Andrew Jeffery <andrew at aj.id.au>

>  and "Rebooting"
> message before the reboot system call.
> 
> Before:
> + set +x
> Remaining mounts:
> tmpfs / tmpfs rw,nosuid,nodev,mode=755 0 0
> dev /dev devtmpfs rw,relatime,size=126384k,nr_inodes=31596,mode=755 0 0
> proc /proc proc rw,relatime 0 0
> sys /s
> 
> U-Boot 2013.07 (Feb 23 2016 - 10:21:23)
> 
> After:
> + set +x
> Remaining mounts:
> tmpfs / tmpfs rw,nosuid,nodev,mode=755 0 0
> dev /dev devtmpfs rw,relatime,size=126384k,nr_inodes=31596,mode=755 0 0
> proc /proc proc rw,relatime 0 0
> sys /sys sysfs rw,relatime 0 0
> tmpfs /run tmpfs rw,nosuid,nodev,mode=755 0 0
> reboot: Restarting system
> 
> U-Boot 2013.07 (Feb 23 2016 - 10:21:23)
> 
> Signed-off-by: Milton Miller <miltonm at us.ibm.com>
> ---
>  .../common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-shutdown.sh | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-shutdown.sh b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-shutdown.sh
> index 3eff1ea..fc359c5 100644
> --- a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-shutdown.sh
> +++ b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-shutdown.sh
> @@ -47,6 +47,8 @@ cat /proc/mounts
>  
>  test "umount_proc" && umount /proc && rmdir /proc
>  
> +# ioctl(TIOC_DRAIN) to drain tty messages to console
> +test -t 1 && stty cooked 0<&1
>  
>  # Execute the command systemd told us to ...
>  if test -d /oldroot  && test "$1"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <http://lists.ozlabs.org/pipermail/openbmc/attachments/20160225/c5804da8/attachment.sig>


More information about the openbmc mailing list