LinuxQuestions.org
Review your favorite Linux distribution.
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, 11: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, 03:19 PM   #2
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: CentOS 6 (pre-systemd)
Posts: 2,665

Rep: Reputation: 710Reputation: 710Reputation: 710Reputation: 710Reputation: 710Reputation: 710Reputation: 710
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


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 02:19 PM
Allow user to open serial port/change settings? funkymunky Linux - General 1 07-30-2009 01:29 PM
Need to Change Serial Port Settings... mwnhoby220 Linux - Hardware 1 03-18-2009 02:47 PM
change serial port IO addresses by command line powah Linux - Hardware 1 08-01-2006 08:55 AM
using Stty to change serial port settings dkarnad Linux - General 1 12-21-2004 08:47 AM


All times are GMT -5. The time now is 11:29 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration