LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-05-2015, 10:26 AM   #1
david_8274
Member
 
Registered: Jun 2013
Location: California
Distribution: Ubuntu, Fedora
Posts: 75

Rep: Reputation: Disabled
How to change serial port for prinkt


Hi,

In my system I have two serial ports (uart0 & uart1). Currently my printk() function is using uart0. Now I wish to do printk() on uart1, how would I do it? I tried to look for definition of printk() in the kernel source code, but it's rather hidden and complicated(as I am a Linux newbie).

Thanks,
Wei
 
Old 10-06-2015, 02:19 PM   #2
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,149

Rep: Reputation: 1264Reputation: 1264Reputation: 1264Reputation: 1264Reputation: 1264Reputation: 1264Reputation: 1264Reputation: 1264Reputation: 1264
printk writes to consoles which are specified on the kernel command line. The default is usually the first UART and the first tty (text screen) but you can add others. Add the param in /boot/grub/grub.conf for grub1. For grub2 edit /etc/default/grub, and then run update-grub. On the system I'm logged into the consoles are specified as:

Code:
console=tty0 console=ttyS0,115200n8
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Is a USBtty (USB serial port) treated the same as tty (normal serial port) in C? spudgunner Programming 1 11-12-2010 01:19 PM
Allow user to open serial port/change settings? funkymunky Linux - General 1 07-30-2009 12:29 PM
Need to Change Serial Port Settings... mwnhoby220 Linux - Hardware 1 03-18-2009 01:47 PM
change serial port IO addresses by command line powah Linux - Hardware 1 08-01-2006 07:55 AM
using Stty to change serial port settings dkarnad Linux - General 1 12-21-2004 07:47 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:55 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration