####### Note Ubuntu18-ARM default systemd already has serial-getty, so no need to do a customized getty@ttyAMA0 like Ubuntu16.
For ubuntu-base-16.04-core-armhf enable systemctl/systemd/dev-ttyAMA0
1. buildroot/lfs 可以不使用systemd,
2. Ubuntu/Debian 依赖systemd . 内核编译需要CONFIG_FHANDLE
Refer to https://github.com/systemd/systemd/blob/master/README
REQUIREMENTS: Linux kernel >= 3.13 Linux kernel >= 4.2 for unified cgroup hierarchy support
Kernel Config Options: CONFIG_DEVTMPFS CONFIG_CGROUPS (it is OK to disable all controllers) CONFIG_INOTIFY_USER CONFIG_SIGNALFD CONFIG_TIMERFD CONFIG_EPOLL CONFIG_NET CONFIG_SYSFS CONFIG_PROC_FS CONFIG_FHANDLE (libudev, mount and bind mount handling)
Kernel crypto/hash API CONFIG_CRYPTO_USER_API_HASH CONFIG_CRYPTO_HMAC CONFIG_CRYPTO_SHA256
udev will fail to work with the legacy sysfs layout: CONFIG_SYSFS_DEPRECATED=n
3. 默认Ubuntu 启动 tty1/console
4. ARM 默认 ttyAMA0串口需要
[ TIME ] Timed out waiting for device dev-ttyAMA0.device. [DEPEND] Dependency failed for Serial Getty on ttyAMA0.
lake@localhost:~/local/lfs/ubuntu-base-16.04-core-armhf$ ls -l etc/systemd/system/getty.target.wants/ total 0 lrwxrwxrwx 1 root root 34 Apr 21 2016 getty@tty1.service -> /lib/systemd/system/getty@.service lake@localhost:~/local/lfs/ubuntu-base-16.04-core-armhf$ cd etc/systemd/system/getty.target.wants/ lake@localhost:~/local/lfs/ubuntu-base-16.04-core-armhf/etc/systemd/system/getty.target.wants$ ls getty@tty1.service lake@localhost:~/local/lfs/ubuntu-base-16.04-core-armhf/etc/systemd/system/getty.target.wants$ ls -l total 0 lrwxrwxrwx 1 root root 34 Apr 21 2016 getty@tty1.service -> /lib/systemd/system/getty@.service
lake@localhost:~/local/lfs/ubuntu-base-16.04-core-armhf/etc/systemd/system/getty.target.wants$ sudo mv getty@tty1.service getty@ttyAMA0.service lake@localhost:~/local/lfs/ubuntu-base-16.04-core-armhf/etc/systemd/system/getty.target.wants$
~/local/lfs/ubuntu-base-16.04-core-armhf$ ls -l etc/systemd/system/getty.target.wants total 0 lrwxrwxrwx 1 root root 34 Apr 21 2016 getty@ttyAMA0.service -> /lib/systemd/system/getty@.service
## Enable both ttyAMA0 and default tty1
$ubuntu-base-16.04-core-armhf/etc/systemd/system/getty.target.wants$ sudo ln -s /lib/systemd/system/getty@.service getty@tty1.service
ln -s lib/systemd/system/getty@.service etc/systemd/system/getty.target.wants/getty@ttyAMA0.service
ubuntu-base-16.04-core-armhf/etc/systemd/system/getty.target.wants$ ls -l total 0 lrwxrwxrwx 1 root root 34 Apr 21 2016 getty@tty1.service -> /lib/systemd/system/getty@.service lrwxrwxrwx 1 root root 34 Dec 31 01:03 getty@ttyAMA0.service -> /lib/systemd/system/getty@.service
[ OK ] Started /etc/rc.local Compatibility. [ OK ] Started Permit User Sessions. [ OK ] Started LSB: Set the CPU Frequency Scaling governor to "ondemand". [ OK ] Started Getty on tty5. [ OK ] Started Getty on tty4. [ OK ] Started Getty on tty3. [ OK ] Started Getty on tty2. [ OK ] Started Getty on ttyAMA0. [ OK ] Started Getty on tty6. [ OK ] Started getty on tty2-tty6 if dbus and logind are not available.
Ubuntu 16.04 LTS localhost.localdomain ttyAMA0
localhost login: root Password:
root@armUbuntu16:/# apt list --installed |grep systemd
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
libsystemd0/xenial,now 229-4ubuntu4 armhf [installed] systemd/xenial,now 229-4ubuntu4 armhf [installed] systemd-sysv/xenial,now 229-4ubuntu4 armhf [installed] root@armUbuntu16:$
|