Xilinx zynq 自動登陸

原理

查看/etc/inittab文件

# /etc/inittab: init(8) configuration.
# $Id: inittab,v 1.91 2002/01/25 13:35:21 miquels Exp $

# The default runlevel.
id:5:initdefault:

# Boot-time system configuration/initialization script.
# This is run first except when booting in emergency (-b) mode.
si::sysinit:/etc/init.d/rcS

# What to do in single-user mode.
~~:S:wait:/sbin/sulogin

# /etc/init.d executes the S and K scripts upon change
# of runlevel.
#
# Runlevel 0 is halt.
# Runlevel 1 is single-user.
# Runlevels 2-5 are multi-user.
# Runlevel 6 is reboot.

l0:0:wait:/etc/init.d/rc 0
l1:1:wait:/etc/init.d/rc 1
l2:2:wait:/etc/init.d/rc 2
l3:3:wait:/etc/init.d/rc 3
l4:4:wait:/etc/init.d/rc 4
l5:5:wait:/etc/init.d/rc 5
l6:6:wait:/etc/init.d/rc 6
# Normally not reached, but fallthrough in case of emergency.
z6:6:respawn:/sbin/sulogin
PS0:12345:respawn:/bin/start_getty 115200 ttyPS0
hvc0:12345:respawn:/bin/start_getty 115200 hvc0
# /sbin/getty invocations for the runlevels.
#
# The "id" field MUST be the same as the last
# characters of the device (after "tty").
#
# Format:
#  <id>:<runlevels>:<action>:<process>
#

1:12345:respawn:/sbin/getty 38400 tty1

注意其中的PS0:12345:respawn:/bin/start_getty 115200 ttyPS0,調用的是bin目錄的start_getty,start_getty是一個腳本,內容如下:

#!/bin/sh
if [ -f /bin/autologin ] && [ -c /dev/$2 ]
then
    /sbin/getty -l /bin/autologin -n -L $1 $2
elif [ -c /dev/$2 ]
then
    /sbin/getty -L $1 $2
fi

可以看到如果存在autologin程序,則調用autologin,這和petalinux2015.2中已經不一樣了,2015.2還需要手動自啓動autologin,在17.4裏已經不需要了,直接把autologin放入bin目錄即可。autologin內容如下,

#include <stdio.h>
#include <unistd.h>

int main(int argc, char *argv[])
{
    execlp("login", "login", "-f", "root", 0);
    return 0;
}

用2015.2的自啓動方式,會輸出如下錯誤信息:

-sh: cannot set terminal process group (2019): Inappropriate ioctl for device
-sh: no job control in this shell
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章