Tiny Core Linux
Tiny Core Base => Raspberry Pi => Topic started by: M-H on June 08, 2017, 06:46:19 PM
-
For off grid debugging I need serial access to my pi without relying on networks.
I got myself a ttl serial to USB converter that allows me to plug into the pi directly ( and powering it with 1 extra wire )
In :
Linux piCorePlayer320-128 4.9.21-pcpCore #1 Thu Apr 13 19:26:09 EDT 2017 armv6l GNU/LinuxI added
/sbin/getty -L ttyAMA0 115200 vt100 &in the start of in /opt/bootlocal.sh
to enable a console before lots of other things are started , and all that works.
But I can not see any ( regular) boot output stating info before the bootlocal.sh is executed.
Can someone enlighten me with the missing part ?
Is it perhaps the picoreplayer kernel ?
Thanks M-H
-
To get that, you have to add the proper console= bootcode.
-
Thank you for the reply curaga,
Would this be a part of cmdline.txt in /mnt/mmcblk0p1 ?
And if so, where can I find more info on those options / syntax etc ?
Greetz M-H
-
Would this be a part of cmdline3.txt in /mnt/mmcblk0p1 ?
Or cmdline.txt for RPi3, depending on RPi board you are using.
-
I believe bmarkus meant to say
cmdline3.txt for RPi3 ...
-
Would this be a part of cmdline.txt in /mnt/mmcblk0p1 ?
Or cmdline.txt for RPi3, depending on RPi board you are using.
Yes, corrected. Thanks!
-
https://www.mjmwired.net/kernel/Documentation/kernel-parameters.txt
-
Thanks guys,
As a write-up:
Add
console=ttyAMA0,115200to /mnt/mmcblk0p1/cmdline.txt
to enable the boot output over GPIO UART on a pi zero.
In my situation I had to remove other console= statements to get it working properly.
Greetz M-H
-
Also you can read this, to config the console uart. in the config.txt.
https://www.raspberrypi.org/documentation/configuration/uart.md
-
Thanks Patrickg.
Good reading stuff.
I did not realise we had 2 uarts and they swap task based on the Bluetooth usage in the pi3 /zero-W , until now.
For the piCore cracks; please state if the info in https://www.raspberrypi.org/documentation/configuration/uart.md
is fully valid for the piCore versions.
Regards M-H
-
Hi folks;
I'm trying to get serial communications working with my RasPi-zero and having mixed results.
I looked in cmdline.txt and found that in the current TC, the bootcode for the console is already there. I then inserted the /sbin/getty line at tthe end of the bootlocal.sh file, as described earlier in the thread.
I connected a USB-serial adapter from a netbook running Win7 and TeraTerm-Pro to the RasPi-zero. Upon booting I see the various boot messages (good sign), then nothing. Then, when I press keys on the netbook, the characters are echoed back. I double-checked that the local-echo feature is disabled, so it appears that the RasPi-zero is echoing characters back.
Please, any ideas?
-
Hi folks, I went back and rechecked prior notes. Jefferee mentioned in a thread started on August 16, 2017, that in the bootlocal.sh file he commented out the stock serial terminal startup and on a machine he's using as a server, that he added a line to start an external script
/opt/serialtty.sh &
I typed in his script but also inserted at the top an echo command (echo "Hello from serialtty.sh") to verify that the script actually starts. Then I used chmod +x to make the script executable.
So, now when the RasPi boots, I can see from the serial terminal that the serialtty.sh script is executed, but again, once the system is booted, all I'm seeing is characters being echoed back... I'm still stuck.
-
Just made progress... In digging about I found a comment about ttyAMA0 versus ttyS0. Apologies, I missed that before... So, to check what device file is in use when the file is booted, I used echo to send a message back from the RasPi-zero. So, the message made it back to the terminal...(yippee).
$ echo "Hello!" > /dev/ttyS0
So, I guessed that in booting, the kernel ignores the named device file. In the cmdline.txt file I changed the console boot code to the following and found that the system boots the same way...
console=ttyS0,115200
Next, I changed in /opt/serialtty.sh the reference to /dev/ttyAMA0 to /dev/ttyS0
So, now when I reboot I see the login prompt. To honor this moment, I went to the screen, keyboard, and mouse, and used sudo passwd tc to assign a new password. The serial port appears to work now...
Yeah! Krista
--------------------- serialtty.sh follows, modified version
#!/bin/sh
echo "serialtty.sh"
# Start serial terminal on Raspberry Pi
while :
do
/sbin/getty -L /dev/ttyS0 115200 vt100
done
-
Yeah and one more thing, you may also do it like the linux way, remove the startserialtty.sh and serialtty.sh
Edit the correct file that start the console terminal... like this threads.
But be careful to edit this files... so you don't cut out your self from console.
http://forum.tinycorelinux.net/index.php/topic,20701.msg129231.html#msg129231
http://forum.tinycorelinux.net/index.php/topic,20831.msg130117.html#msg130117
http://forum.tinycorelinux.net/index.php/topic,19810.msg129729.html#msg129729
-
Hi patrikg, just had my first try and:
- In bootlocal.sh I commented out the call to serialtty.sh
- used sudo editor to edit /etc/inittab
- In /etc/inittab there was already a line for tty1, no idea why that's there
tty1::respawn:/sbin/getty -nl /sbin/autologin 38400 tty1
- I inserted a new line into /etc/inittab
ttyS0::respawn:/sbin/getty -L 115200 /dev/ttyS0 vt100
- added /etc/inittab to the system backup list
- there is a console output line that I don't understand yet
login[1046] : root login on 'tty1'
I'm sure that I'm missing something
-
Can someone fix a note I left, in a few messages back, please... Of course its passwd that's used to change a password, rather than passd
Thanks in advance,
-
Hi kmhill
added /etc/inittab to the system backup list
I think by the time that file is restored it's too late and has already been executed. Also, you know to omit the leading /, right?
-
Hi kmhill
Can someone fix a note I left, in a few messages back, please... Of course its passwd that's used to change a password, rather than passd
Thanks in advance,
Done.
-
Dont know but i think you also need the console command in cmdline that specifies the correct tty. I think the tty1 is for the x11 tty console.
-
Rich, I used the Control Panel's Backup and Restore Lists Maintenance GUI to make that change. In looking back, yes. the list shows that the leading / was removed. I'm still new to all this. I don't know if the inittab file is used before or after the file restore.
Patrikg, I'm not sure how x11 starts, so maybe tty1 is about that...
I have to shift gears and set this aside for now, and get back to this later. Thanks folks.
-
Hi kmhill
From someone who knows:
Backup restore happens way too late for inittab. You need to remaster to edit that.
-
Yes thats right.
I do it like this. This was with version 8.1.5.
Extract the files and edit the file and compact the files again.
1. Extract the files
sudo su
mount /mnt/mmcblk0p1/
mkdir /tmp/extract
cd /tmp/extract
zcat /mnt/mmcblk0p1/8.1.5.gz | cpio -i -H newc -d
2. Edit the file
3. Compact the file
sudo su
mount /mnt/mmcblk0p1/
cd /tmp/extract
find | cpio -o -H newc | gzip -2 > /mnt/mmcblk0p1/8.1.5.gz
-
Hi, I'm looking in /mnt/mmcblk0p1/ and I'm seeing two .gz files... 9.0.3.gz and 9.0.3v7.gz.
I looked in the config.txt file and see that the option [PI0] says to use 9.0.3.gz, so I'll use that one.
-
Here are some preliminary results...
To start fresh, in bootlocal.sh I commented out the call to serialtty.sh and removed the entry for inittab from the backup list. Then I followed the outline from patrikg to edit the inittab file. So, now I can edit the inittab file and I've made a few attempts, but I don't fully understand the format of what's in the inittab file quite yet... I'm going to look back to prior notes again.
-
You have to edit the line to this
ttyAMA0::respawn:/sbin/getty -L 115200 /dev/ttyAMA0 vt100
Or
/dev/ttyS0::respawn:/sbin/getty -L 115200 /dev/ttyS0 vt100
Some hints:
https://github.com/FrankBau/raspi-repo-manifest/wiki/UART
-
And don't forget like M-H says.. that some of the Raspberry PI's have bluetooth usage on the serial port.
http://forum.tinycorelinux.net/index.php/topic,21129.msg132018.html#msg132018
So you have to disable that in config.txt like this link.
https://openenergymonitor.org/forum-archive/node/12311.html
Include the disable device-tree overlay file pi3-disable-bt
And could be read more at this link.
https://www.raspberrypi.org/documentation/configuration/uart.md
-
Hello folks;
I've settled on the following final edit to the inittab file. I inserted into the section that configures the tty's, the line for ttyS0. To better describe the system I'm using, its a RasPi-zero-W.
# /sbin/getty respawn shell invocations for selected ttys.
tty1::respawn:/sbin/getty -nl /sbin/autologin 38400 tty1
ttyS0::respawn:/sbin/getty -L 115200 /dev/ttyS0 vt100
While I haven't mastered all the content yet, I've learned much along the way, I'm satisfied with what I have so far. I like seeing in a serial terminal the start-up and shut-down system messages, I don't mind typing in the user name tc and a password, the command line works, I've been able to use the nano text editor to do some simple edits. Perhaps a text oriented game would be fun to do.
Thanks again folks. I appreciate your comments and support.