schmadde
Posts: 10
Joined: Thu Aug 28, 2014 4:00 pm

How to shut up bootloader on serial Port ttyAMA0

Thu Aug 28, 2014 4:15 pm

I want to monitor and control an external device over an RS232 Interface from my Raspberry Pi. I found out that there is only one UART at one time available and this is exposed as /dev/ttyAMA0 by default. This Interface, however is apparently being used by raspbian to output bootloader and kernel Messages and a getty is listening there.

I got rid of ther kernel messages and the getty by editing cmdline.txt and inittab. But it still displays the message
"Uncompressing Linux... done, booting the kernel.". I am not quite sure where this message comes from - is this from the bootloader? How can I get rid of it?

User avatar
joan
Posts: 14960
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: How to shut up bootloader on serial Port ttyAMA0

Thu Aug 28, 2014 5:37 pm

Build your own kernel but don't compress the image.

schmadde
Posts: 10
Joined: Thu Aug 28, 2014 4:00 pm

Re: How to shut up bootloader on serial Port ttyAMA0

Sat Aug 30, 2014 9:02 am

joan wrote:Build your own kernel
I would like to avoid this, since there is a lot of time involved (either by setting up a cross compile environment or compiling the kernel on the pi itself). But more importantly, I need to do this for every kernel upgrade and if I forget about it I end up with the output again.

I dug around a bit and found out the message comes from the kernel, more specifically from arch/arm/boot/compressed/misc.c and is hardcoded there without conditionals. the asm instructions are:
mrc p14, 0, %0, c0, c1, 0
mcr p14, 0, %0, c0, c5, 0

I know nothing about arm assembler, but docs in arm.com suggest that these are instructions for "coprocessor register 14" which control host-to-target data transfer.

Now my questions:

1) is it somehow configurable where the output occurs or is this always on UART0?
2) is there something to be gained by using UART1 which apparently shadows UART0? How is UART 1 exposed to Linux? ist this ttAMA1?

User avatar
joan
Posts: 14960
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: How to shut up bootloader on serial Port ttyAMA0

Sat Aug 30, 2014 9:18 am

The serial link(s) are only exposed on gpios 14/15 as far as the user is concerned. Unless you change the start-up software gpios 14/15 will be switched into mode ALT0 and display that message.

danjperron
Posts: 3508
Joined: Thu Dec 27, 2012 4:05 am
Location: Québec, Canada

Re: How to shut up bootloader on serial Port ttyAMA0

Sat Aug 30, 2014 11:18 am

It is possible to simply add an "or gate" to disable the transmit at start .

One input at the TX and the other at another gpio with a pull up resistor. To enable the transmission, simply put the gpio to 0.

This way you don't need to do anything to the boot loader.

http://www.ti.com/lit/ds/symlink/sn74lvc1g32.pdf

Daniel

schmadde
Posts: 10
Joined: Thu Aug 28, 2014 4:00 pm

Re: How to shut up bootloader on serial Port ttyAMA0

Sat Aug 30, 2014 12:45 pm

Thanks, this looks interesting. In Case I go for the recompile, can anyone point me to the config the raspbian Kernel uses? I could not find it and only want to modify CONFIG_DEBUG_ICEDCC

User avatar
joan
Posts: 14960
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: How to shut up bootloader on serial Port ttyAMA0

Sat Aug 30, 2014 1:16 pm

If you look on your Pi it should be in /proc/config.gz

DocBrown
Posts: 1
Joined: Thu Sep 04, 2014 10:49 pm

Re: How to shut up bootloader on serial Port ttyAMA0

Thu Sep 04, 2014 11:02 pm

One way is to 'patch' the strings in the kernel image so nothing is output.
This works for me.
Open the kernel image in vi as super user:
$ sudo vi /boot/kernel.img
find the string in the image:
type: /Uncompress<Enter>
You should see something like "^@^@Uncompressing Linux...^@" on the screen
Place the cursor on the 'U' and then replace the 'U' with <nul> character by typing: r <ctrl-V> <ctrl-2>
Find the second string " done, booting up the kernel." and replace the first ' ' with <nul> character as above.
Save the file by typing 'zz'.
That's it.

schmadde
Posts: 10
Joined: Thu Aug 28, 2014 4:00 pm

Re: How to shut up bootloader on serial Port ttyAMA0

Fri Sep 05, 2014 8:24 am

Now thats a really good Idea. I thought about binary patching the string, but not of the obvious solution to patch a null byte into it.

Meanwhile I have recompiled the kernel (took less than 12 hours on the pi) and solved my problem this way

Return to “Raspberry Pi OS”