Tiny Core Linux

Tiny Core Base => Micro Core => Topic started by: Ali Demir on May 19, 2023, 02:20:21 AM

Title: Serail Console
Post by: Ali Demir on May 19, 2023, 02:20:21 AM
Hi,

I'm trying to contact Serial0. When I try the following settings, the entries appear but I cannot get the outputs:

Code: (bash) [Select]
linux /boot/vmlinuz loglevel=3 user=tc console=tty0 console=ttyS0,115200 noembed nomodeset tce=sda1 opt=sda1 home=sda1 restore=sda1
Code: (bash) [Select]
echo "console=ttyS0,115200" >> /mnt/sda1/boot/cmdline.txt
sudo sh -c 'echo "enable_uart=1" >> /mnt/sda1/boot/config.txt

This is what it looks like when I send data:
"pwd\n"

Code: (bash) [Select]
pwd
The output I expected:
"pwd\n"

Code: (bash) [Select]
/home/tc
tc@box:~$

I may not have been able to fully explain. I want to contact serial0 without UI.
Title: Re: Serail Console
Post by: Juanito on May 19, 2023, 02:42:47 AM
What version of tinycore are you using and on which architecture?
Title: Re: Serail Console
Post by: Ali Demir on May 19, 2023, 04:42:41 AM
Tiny Core Version: 13.1
Linux box 5.15.10-tinycore #622 SMP Tue Dec 21 16:51:09 UTC 2021 i686 GNU/Linux


I added an attachment for the example, the serial console stops responding when the boot process is finished. I can enter data into the Serial console, but these won't run.
Title: Re: Serail Console
Post by: curaga on May 19, 2023, 08:33:34 AM
I think this has been covered on the forum before, you need to edit inittab to launch a login shell on the serial console. Search for inittab.
Title: Re: Serail Console
Post by: Ali Demir on May 19, 2023, 12:48:25 PM
I found edits about inittab, but what I did is not permanent. I make the changes and try reboot then the edits are lost.

I also tried something with grub but I can't edit it.

Code: (shell) [Select]
sudo cp /etc/inittab /mnt/sda1/etc/inittab
sudo sh -c 'echo "ttyS0::respawn:/sbin/getty -L 115200 /dev/ttyS0 vt100" >> /mnt/sda1/etc/inittab
Title: Re: Serail Console
Post by: Rich on May 19, 2023, 01:21:22 PM
Hi myfree.1
You need to modify the initrd (core.gz) for this.
First unpack it:
Code: [Select]
tc@E310:~/core$ mkdir initrd
tc@E310:~/core$ cd initrd/
tc@E310:~/core/initrd$ zcat /mnt/sda1/boot/core.gz | sudo cpio -i
26057 blocks
tc@E310:~/core/initrd$ cd etc/
tc@E310:~/core/initrd/etc$

Make your changes to  inittab.

Now pack it up to a new name so you know it's a modified version:
Code: [Select]
tc@E310:~/core/initrd/etc$ cd ..
tc@E310:~/core/initrd$ sudo find . | sudo cpio -o -H newc | gzip > ../newcore.gz
tc@E310:~/core/initrd$ cd ..
tc@E310:~/core$ ls -l
total 9064
drwxr-sr-x 17 tc staff    4096 May 19 16:15 initrd/
-rw-r--r--  1 tc staff 9275687 May 19 16:15 newcore.gz
tc@E310:~/core$

Copy  newcore.gz  where grub can find it and create a new grub entry for it.
Title: Re: Serail Console
Post by: Ali Demir on May 19, 2023, 02:01:42 PM
Thanks, it worked.  :)
Title: Re: Serail Console
Post by: Rich on May 19, 2023, 02:07:54 PM
Hi myfree.1
You are welcome. Thank you for reporting your success.