[MUSIC PLAYING] Hello, and welcome to Module 8 of the Linux Board Porting Online Series. This is the first in the final set of three modules where we will be debugging the Linux kernel inside CCS using JTAG. In this first module, we're going to install the SDK, which will also be installing minicom and the TFTP server. And once that's done, we will rebuild the Linux kernel, being sure to include all of the debugging symbols that we'll need in order to do a JTAG debug.
Before we rebuild the Linux kernel, there's a couple of utilities that we're going to need in order to debug the kernel using JTAG. We're going to want minicom, which is a serial terminal utility. And we're going to want TFTP server running on Ubuntu. Both of these can be installed using the installation script of the Software Development Kit.
Open a terminal with Control-Alt-T, change into the SDK directory. And you'll notice that there's a script called setup.sh. Before I run this script, I want to do an apt get update. This will update the aptitude package manager. So this setup script is going to use the aptitude package manager to install minicom and the TFTP.
Then you can run this with sudo actually, because it's going to be installing components on the system. Change the user name to user-- that's the user name on this system. It's only because I ran under sudo that it pulled up root. Here, it's going to give us NFS target file system, which is fine. I'll accept the default.
It says, make sure you have sudo access, which we do. That was how we ran it. So I'll press Return to continue. Once it's done, it just gives a little bit of information. Press Return to continue.
This is setting up the NFS server and changing /etc/exports to make the newly created directory available over NFS. So that's fine. Let's press Return. And it's actually restarted the NFS server.
Now, here you can see, this is an important step for us. It's going to set up a TFTP server. And it's going to make the default directory, which is the directory that files are pulled out of, /tftpboot. So that's important information. I'll press Enter to accept that default.
And then we do have sudo access. So I'll press Enter to continue. And then here, it's going to set up minicom. Actually, on our system, the serial port that we want to use is ttyusb0.
So this is because I'm going to use a BeagleBoard that does serial over USB. And it shows up on the device node dev/ttyusb0. You'll want to check depending on the system you're on which is the correct device node for you.
Here, this is the IP address that I have on my system. But I'm going to change the system to use a static address after we're done with this install. So I'm going to put 192.168.1.1, that's what we're going to set the IP address to as a static IP address. So I'm going to enter that instead.
And we're going to set it up to do a TFTP boot. So I'll select 1. The root file system, I'm going to put that on the SD card, because we're not modifying it. You could do it via NFS, but it's just an unnecessary complication.
So what we're going to do is put our SPL and U-Boot on the SD card along with the root file system. And then we'll boot the kernel over TFTP only because we're going to be modifying it assumably if we're doing a debug step. So I'll put in a 2 here.
This is the name. I'm going to put in uimage. uimage is, when we rebuild, what will use. So it'll automatically boot uimage from the card. And I'm not going to bother with the minicom script. I'll show you how to do that by hand.
So once we're done with that, we can change the settings on the system from a DHCP, which is what I was using to do this setup and pull of the correct packages off the internet, to a static setup. So I'm going to use a crossover cable between the computer and the development board. So if I do sudo gedit /etc/network/interfaces, we can see that eth0 is set up with dhcp. Instead, I'm going to move that to static, give it 192.168.1.1 and the proper net mask.
Now, we will have to either reboot or do an ifup ifdown. So right now, if I do ifconfig, you can see here, it's got an IP address that it's gotten off of the network. But I can do a sudo ifdown-- oops-- eth0. And here, you can see that the address has changed to 192.168.1.1, which is what we'll be using from here on out.
The next step, now that we have all those packages installed, is to rebuild the Linux kernel. So I'm in the SDK. There's two things that are important. The linux-devkit, you'll notice it has these sysroots-- one for the ARM and one for the x86 computer or 686 computer. Our cross compiled tools are located in this i686 sysroot.
So under linux-devkit/sysroots user bin, you see here the names of the cross-compile tools. Now, you could copy this sysroot. If you wanted, you could do sudo copy recursive linux-devkit/sysroots i686 asterisk into slash. And what that'll do is it'll copy all of this into your system.
You can do that, but it may overwrite some tools that you're already using. And it may create conflicts. So what I'm going to do instead is keep these where they are inside the SDK. And you'll see that when we rebuild the Linux kernel, we'll just update our path information. But that's where those are located.
And then if I go into board support, this is where the U-Boot source code, the Linux kernel source code, et cetera is. And here is the Linux kernel. Now, I've taken the liberty already of creating a file called build.sh. So let's take a look at that.
Here's build.sh. And I'm going to comment out these last few lines and go ahead and put these first two in. So the first thing we do in this script is we update the path variable. And this, you may recall, is the location of those cross-compile tools.
Then I'm creating an architecture environment variable and a cross-compile environment variable. This prepended arm-linux-gnueabihf, if we scroll back up to our cross-compile tools, that's the name of the cross-compile tools, as you see here-- everything that comes before the ar or cpp or g++ or gcc, et cetera.
And then mrproper is a clean command. What mrproper will do is any intermediate files in the Linux source code which are .o files or any executables that were built, anything that's not source, will be removed or cleaned out. Then we're going to load the default configuration for the am335x-evm and then do make menu config. And I'll show you what make menu config is. But make menu config is going to allow us to embed the debug information into the kernel when it builds.
One last thing here with this tisdk evm_defconfig, how would we know the name of that if it wasn't given to you? Well, let's take a look here and just do a list, arch/arm/configs. So under arch/arm/configs, there's a whole bunch of different configurations.
These are all the different devices or boards that are based on the ARM that the Linux kernel somebody has submitted a default configuration for it. One of those is the tisdk_am355x-evm_defconfig. So that's where that comes from.
And now we're ready to build.sh. And what this is going to do is it's going to clean everything out. And then it's going to load up the default configuration and finally bring us into menu config.
This is what menu config looks like. It's a graphical tool that you can use to load various modules into the Linux kernel. So let's start by going down to kernel hacking. You can press either Enter or space bar to go into the sub menu.
And then we're going to look for a couple of items here. The first is kernel debugging. Again Enter or space bar will build the kernel debugging feature in.
I can then scroll down to Compile the kernel with debug info, select that. And finally, we're going to go to Enable stack unwinding support, which is down here, and select that-- so those three items that we've selected in the kernel hacking subdirectory. Then I'll just press Exit with Enter.
And then one last thing that we need to check-- it's actually already configured for us. But under General Setup, make sure that this Prompt for development and/or incomplete code in drivers is selected, which it is. Then I'll Exit. And when I Exit again, it'll ask if I want to save this new configuration. Obviously, we want to do Yes in order to save that.
Notice here that it tells us configuration was written to .config. This is a hidden file in the current directory. In Linux, anything that begins with a period won't be listed unless you either ask for it by name or you do an ls with dash a. But you'll notice that there is a hidden file here called .config.
Now, the last step I'm going to do is, remember how our default configurations are in that arch/arm/configs directory. What I'm going to do is copy our config into arch/arm/configs/am335x-evm_debug_defconfig. You can name it whatever you want, but it has to end in _defconfig. So I'll take the modified version that has this debug information built into it, create a new default configuration from it.
Now I can go to gedit our build shell script. And I'm going to take out the default configuration and menu config and add in these last three. So we start by, instead of loading the default configuration for the SDK, we're going to load this new configuration that we just created by adding the debug information in. Then I'll just say, make uimage.
And it actually will be placed into arch/arm/boot/uimage. And I'm going to copy that into the tftpboot directory. Remember, the tftp boot directory is the default tftp directory that was just created when we ran the setup script from the SDK. I'll Save that.
Then we'll run build.sh. This will rebuild the Linux kernel with that default configuration. One thing that's nice about having created this new default configuration, if you wanted to, you could actually import the entire Linux kernel code into Code Composer Studio and just turn these steps that I put into build.sh into build steps inside a CCS.
I'm not going to record-- it will take about 10 minutes for it to do all this. So I'll pause the recording. And then we'll come back at the end.
Assuming that you get a successful build, this is more or less what you should see at the end. You see it says arch/arm/boot/uimage is ready, meaning it had built correctly. And we see that it's been copied into tftpboot. As a matter of fact, that uimage am335x-evm.bin, that was installed by the SDK, but I'm going to just remove it, so that we don't have any confusion.
This concludes Module 8 of the Linux Board Port Online Series. Please proceed to Module 9, where I'll show you how to set up a BeagleBone board to boot from an SD or multimedia card using U-Boot and the SPL from the multimedia card but booting the Linux kernel using TFTP.
[MUSIC PLAYING]

Module 4 - Linux/U-boot Source Code Structure: Overview of the layered organization of the source code files for both Linux and U-boot, focusing on those files which are most pertinent to a typical board porting effort.

Module 5 - Installing Code Composer Studio: This first lab exercise of the series is a recording of the presenter installing Code Composer Studio. In particular, installation of the proper JTAG drivers and a valid CCS license are required to debug U-boot. This is the first of three lab exercises centered around debugging U-boot using JTAG.

Module 6 - Building U-boot in CCS: This lab exercise shows the user how to set up a makefile-based project in Code Composer Studio in order to rebuild u-boot from source code.

Module 7 - Debugging U-boot with JTAG in CCS: This module is a recording of the presenter using Code Composer Studio and an xds560 emulator to debug U-boot on the Beaglebone Black platform.

Module 8 - Installing SDK and Building Kernel with Debug Symbols: This module is a recording of the presenter installing the Sitara Software Development Kit (SDK) and rebuilding the Linux Kernel with Debugging Symbols. It is the first of three modules demonstrating the debugging of the Linux Kernel in Code Composer Studio using JTAG.

Module 9 - Booting Linux from MMC/SD Card and TFTP: This module is a recording of the presenter using the SDK utility to build a bootable MMC/SD card for the AM335x starter kit and modifying the card to load the Linux Kernel from a TFTP server.

Module 10 - Debugging Linux Kernel with JTAG in CCS: This module is a recording of the presenter configuring JTAG debugging of the Linux Kernel using Code Composer Studio. It is the final in a ten-part series.