How To Use the Serial Card as a Console on the MPC5125 Tower Board
By default, the serial console MPC5125 Tower board is provided by the USB mini-B port on the processor module. However, it is possible to use the Tower Serial (TWR-SER) module instead. This guide lists the steps to do this.
It is recommended that you have a running system using the USB serial port before using this guide.
Prerequisites
- Desktop Factory build for MPC5125 Tower Board
Overview
There are three places that the new serial port must be specified:
- U-Boot Console — specified at U-Boot build time
- Kernel Console — specified at kernel boot time, via the kernel command line
- Userspace Console — specified at boot time, via the ttyDefault file
Setting the U-Boot console
Setting the U-Boot to use the other serial requires a reconfiguration and rebuild/reflash it.
- Go to the root of your Desktop Factory directory.
- Run make menuconfig.
- Change the option Target Software->Bootloader->u-boot->u-boot Configuration target to ads5125_nand_serial_card.
- Exit the menuconfig interface, and save the new configuration.
- Reconfigure u-boot using make u-boot-reconfigure.
- Run make.
- Once the build completes, update U-Boot. See the following document for detailed instructions: HOWTO Install U-Boot on the MPC5125 Tower Board.
- After the update, the U-Boot console will now be on the serial card module.
Setting the Kernel console
Setting the kernel console is much easier, and does not require a rebuild. You simply pass a different console argument on the kernel command line.
- Open a serial console to U-Boot on your board, as per the Getting Started Guide.
- Modify the bootargs environment variable to use ttyPSC1. If you are booting using TFTP and NFS, it will look like the following:
setenv bootargs console=ttyPSC1,115200 ip=dhcp root=/dev/nfs rw
Setting the Userspace console
In a Factory build, the console is spawned on the serial port pointed to by the symlink /dev/ttyDefault. You will need to modify this symlink in order to get a console.
There are a number of ways to accomplish this task, depending on your goals.
Simple method
If you are running over NFS, you can simply change the /dev/ttyDefault symlink to point to the other serial device. NOTE: You will need to do this each time you install a new RFS.
- On your host system, navigate to the /dev directory of your NFS root:
cd /path/to/rfs/dev
- Overwrite the symlink, making it point to /dev/ttyPSC1. You must be superuser to do this.
sudo ln -sfT ttyPSC1 ttyDefault
Permanent method
If you are using a flash image, or would like to have the change persist between RFS builds, you must modify a configuration file in Factory itself. The device table contains a list of device nodes that are created when the RFS is built. You can create a custom file, make the change, and point the Factory workorder to use this new file.
- Navigate to the top level of your Factory directory.
- Create a new directory for your custom board. In this example, we simply call it "custom":
mkdir target/configs/device_table/custom/
- Copy the existing device table for the mpc5125_twr board to the new directory:
cp target/configs/device_table/mpc5125_twr/device_table target/configs/device_table/custom/
- Open the new device file for editing:
vi target/configs/device_table/custom/device_table
- Modify the line for ttyDefault so that it points to ttyPSC1 rather than ttyPSC0:
/dev/ttyDefault s ttyPSC1 - - - - - - -
- Save and close the file.
- Run make menuconfig.
- Change the option Target Configuration->Build RFS->Device Table Location to file://$(BASE_DIR)/target/configs/device_table/custom/device_table.
- Exit the menuconfig interface, and save the new configuration.
- Run make rfs-distclean to clean out your RFS directory.
- Run make to rebuild the RFS.