Embedded Linux Introduction #01

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
so this is the first lesson in our course about embedded Linux using C ok in this course you're going to learn from the basis to put lyrics working in outside work up to developing the vibe at the realm of device drivers ok so we create an IP core and then we create a device driver that control these IP core to another app in the the user mode to access it and do something ok we're going to learn how to debug apps that that are working mins and and by the way the first question why we should use Linux in our method systems ok hope you guys enjoyed the this portion can be a little bit long because they are so much topics that we need to see but it's going to be fun I promise ok so I hope you guys enjoyed if you liked give me the thumbs up we're going to be born now to explain the basics on what we're going to do in this lesson ok which is basically put the looks to boot on the Zen board ok so check out and let's salad so guys those are the topics that you're going to learn in this course today which is embedded Linux on this on the set board ok we're going to start with Catalina's but later we're going to build our own Linux without any tools just just restarted easy ok so here what we will turn first of all why is OK why we choose to use wheels in our data project today then I'm going to learn how to create a moot a project on soon ok how to create an app in group in the Winterfest quickly to learn what process of the best way device drivers okay so we're going to create some somatic course that is are going to be included in our now if I deployed then we're going to create driver set that are going to expose the functionality to the user space okay then I'm going to learn probably not in this order we want to learn how to label you know and something about network network sorry not networking so let's start from the first box probably those two here and let to probably hear those those three let's see what we can do in a short video okay so okay so lots of device drivers okay one is means by using the UNIX you don't need for instance to rewrite a USB stack okay the Linux through heaven filled it so also you don't need to write an IP square library to to actually access some some I see in your work use also support and actually thousand of other device drivers that are that are there that you can just use another one for instance GPRS models okay so this is actually a really important part there is a lot of support or a lot of armor okay network in file system support okay network just means it by using minutes you already have a tcp/ip stack for you so you don't need to write a tcp/ip stack or UDP on your own okay and file system support in this is the X 4 or X 3 this is also really important because it's going to allow your system to use for instance an SD card or USB stick and you'll be able to use it without no problem okay memory management means that a different process okay can share can share and use the same resources a memory to be more specific inter process communication which means one or more crosses and exchange data with each other in a safe manner okay Porto this is furnaces Linux works on Android devices on on x86 computers and in your bed season which is composed by line it also micro days is supported by Linux so just a simple system with enough room around the 48 megabytes of RAM can already running and is free and open source okay he looks has a large in huge community where you can get information learn how how they actually do some of these features and how so can that I can join this community so it's really cool it's a really nice way to learn as well about program ok so these are the two topics on why you should use Windows me embedded system ok one downside that finances you could argue ok so what I should use wheels if I can for instance do the job we've ever met or less like three OS okay so if our embedded system is really good simple that you don't need these features you right keep with your bare metal simple flirty OS okay the stops that you're going to see my end but we're going to use patterning so hey Bethany looks is a is a free of charge but commercial if you want some support he looks this solution region okay this can be used to create greater ready to use limits for the micro place or this okay in this tutorial we're going to put more focus on the simpler gate using the set bar but in the end goes are we also going to see how to use these in my progress okay basically the pendulum is going to be responsible to create the following packages that I needed for you to have to have a milks work in your board okay let's just stop a little bit about about something okay first the hood FS which is the hood five season is this guy here who is going to hold all the files all the programs or direct all the directories in your board okay here in the bezel is the type of food FS that you're going to use is the next four okay but you have more than now we're going to talk about sleep you have the advice tree which is a kind of text file describing all the device ended the day there drivers that you have in your season okay so basically the device tree is the one who is going to reform the Linux that you have for instance some IP course that you created in the pay part and the drivers that are going to use to to control them okay the Linux kernel itself which is the main idea of having minutes in your world the first stage bootloader which is the guy that we saw early that is going to be responsible to programmed the PL part and initialize this in processor we actually this is the guy who is first slowly power of the city okay never you would which is the guy who is going to load the Linux kernel itself actually is going to learn to load the Linux kernel and advise tree okay and it is a very long piece of software okay well a lot of people use u-boot embedded boards to login us so I want to switch now to a presentation that I live in PowerPoint to show a little bit more outlooks words I want to show the Commons as well and and then in the ending glad we're going to create a pattern UNIX system a pattern exploited so that's going to be used to roll the network okay yes so this is the presentation that I mention about Zboard in Linux okay this is just an introduction on only UNIX okay for sure there's a lot of books and a lot of more information that is that is available okay this is just to have an overview on what we're going to learn okay anyway this presentation is going also to be available for you guys so I'm going to put that on link okay of the video so why use Linux on your project why be school ok so by using Linux on your system you're going to have for free this items here okay so you're going to have networking file system support we're going to have inter process communication which means two or more programs can exchange data between them okay memory management this means harm a lock function so our our program will be able to ask some memory to the system to do something and then give this memory back toward the resources to other problems to use multi-threading okay we did not mention too much but the zinc has to course it has an arm that has to two CPU cores and the other problems that we use up until now actually didn't use those two course okay so by using Linux you're going to have a mood try the infrastructure that is going to exploit this tube that that two cores for us we have a lot of device drivers which means is a kind of specialized software that is going to make a particular hardware available for your system okay for uses Linux as device drivers for USB cameras GPRS modems really a lot of stuff okay there is a lot of open source code available okay really today the internet you just Google some some projects that use Linux and normally all of them has the source code available okay why is not so cool to use Linux in your embedded projects okay compile porting the kernel and drivers can sometimes be a challenge okay in this training we're going to start to use a to call it petti Linux but in the end we're going to do all this by hand and you guys going to see that sometimes can be tough especially if you're going to port the linux to a hardware that is not so common okay linux is complex it takes times to boot compared to bare metal stuff this is true just by using linux in your system the boot time is long okay normally everything that we did so far in the bare metal without os/2 to manage the system for us we just turn on the board and the decision was already there clicking in doing something okay in the milk is not like that you can lose up to ten seconds just to boot Linux so there you looks kernel components okay the Linux kernel is a Linux is a mono logical operation season which has these components here okay we have a memory management system you have the device drivers actually we are going to work a lot on this area here you have unschedule and task manager okay which means you can have more than one program running on parallel ok and the Linux kernel will be the one responsible to preempting one of other program to make the user feel that you have one or more programs one in peril okay you have a filesystem and drivers for your filesystem in a network stack okay actually we have here this actually a new feature on linux is called device trees okay which which is a set of is actually a text file that is compiled in boot with with the linux that specify which which hardware you have available on your board okay and which device driver is responsible to to control that hardware okay we're going to speak of this more in the future but it's cool to know why the device 3 so 4 so basically the device threes are are the guy responsible to tell to the kernel which hardware you have and which device drivers are needed to handle this Hardware okay so the Linux kernel job ok on a system a lot of programs as are asking for resources at the same time is the job of the kernel to manage all of these domains ok so the kernel as I explained it have Process Management memory management five seasons device control a network and all of and you have like zillions of programs asking for these resources at the same time so is the is the job of the kernel to handle of this all of this ok now let's talk a little bit about hood FS ok on a Linux system several 5 cc's are mounted and create a global hierarchy ok of files and directories of a particular file sitting on the hood file system basically just the is this this the is the mix of all your files all of your directories and everything that you have stored in your system ok we're going to use an SD card ok unless the flash card to boot the our season and majority of the of of the space used by this guy is the hood file system okay you have the bootloader the kernel but a big part is just the files and the device driver is any programs and all of this ok let's not talk about the system code ok the Linux will offer you a set of function is actually something around 3 300 functions ok to the programs which we call user space ok and those libraries are available through the beginners library so for instance imagine that inside your program you call printf ok printf is actually is going to a system call call it right that is made available for you from the kernel okay that is actually going to print something on the screen okay we have really we we cannot talk about all these 330 system calls but basically the idea is that the kernel is going to offer some API to to play with the system to the user program to the user program apps okay so printf exit F open to open files all this is our functions that are going to be given to the to date - you okay - you writing a user space program and this is the job of the kernel to give all this Kiran and user space memory okay why we are doing our programs the s bare-metal okay without lo s all the memory were available for us okay we when we actually access a pointer or pointing to a memory and at a particular address this address is really what you have on the harbor okay is really what you have in the DDR and the own on the Linux is not like that okay the user space have access to a memory called virtual memory okay which is by the way managed as well by the kernel okay which does not mean exactly a physical a physical memory which means for instance if you write something at the at a pointer pointing to address for this does not mean that actually is going to write and address four of the DDR okay is actually the job of the kernel to manage that memory for you to manage where this memory is going to be to be available and what is actually going to be allocated okay so here I am just saying that to Linux the memory is divided in two parts the kernel in the user space and they communicate through system calls is the system closet actually mentioned here okay the job of the kernel is to allow multiple user space programs or process and pretend protection between them which means finances in theory up two different programs have access to all the memory okay and actually the job of the colonel as well to avoid that a program we start to write or read memory from another from a different program okay so this kind of security is is managed by the kernel as well and uses a piece of hardware called M mu which is which means a memory management unit okay which is going to be the guy it is really a piece of hardware is an IP core that if sits on the on grant processor that makes the translation between virtual memory and physical memory okay now device drivers okay only looks sis the hardware okay for instance some IP cores on the PL part is made available to the user space programs for files okay that data normally located in /dev by the way everything on Linux is a file okay so is the job of the device driver to make the user space think that the harder is just a file that is placing on this /dev directory okay so when we start to write device drivers for some IP cores that we're going to write later on the course we're going to create a specialized software call it device driver that is going to initialize and pass parameters and control the this IP core more or less on like the way that we did when we did in the in the in the bare metal IP course that we are doing in previous courses okay the difference is that we are not going to access the the physical memory we are going to ask the kernel to give us a pointer to that physical memory but you're going to see that on the future but now just remember that the job of the device driver is to make the user space think that the hardware is just a file okay is to take out all the complexity of the of a particular hardware okay and make that available to the to the user space programs okay so now is the point that we are going to prepare the our petal UNIX system okay to create a linux to boot on our jet board okay these are the comments here that you guys need to type to install okay before we stopped we stopped at an inn looks okay by the way we're going to use Ubuntu 64-bit the version is 1404 okay so basically we need all these packages that are here before we install Patton Unix so here is the download link that you just click here and and you can download battle unix for you okay we need also to download the board BSP of your board in this case we're going to download the board BSP of the Seaboard okay best Pistons for board support packages okay wish you guys don't wanna know okay then we create a directory on the /o o PT / beta Linux and we'll run this dollar okay this is really simple if you guys need that I can create a video just showing how to stop at a Linux but is really quite simple after that after the PATA Linux is told we need to reconfigure - you just type this common here then you select no then in order to avoid you - all all the time change your path to have the patta Linux commands available we just change your your dot bash RC script to include this this common here source /opt beta Linux settings dot Sh okay so let's create a project in the Z board okay the common to create a project in the board is beta Linux slash create - T project because it's what you want to create now is a project - and the name of the project - s will pass the the location of our BSP okay then you go to this directory and you just type pata Linux build okay this is going to create all the software packages means you boot device three Linux kernel a filesystem all that is needed to boot Linux in your set board okay then you copy the elements of these guys in your slashed FTP boot and then to your SD card okay I'm going to show how to partition also they are SD card to have the to have your SD card prepared to to log Linux basically you just need an SD card to have the to have a fat32 available and that's it you just copy these files there and you'll be ok by the way in the lab are going to do this by hand so you can see exactly what I'm typing okay so then you check the jumpers if you are configured to boot on that stuff for the SD card in your set ball I got I gone also to put an image how they should boot should do and and then you just turn on your board and you're going to see that that Linux will be available ok here are just two comments that you can run petaa Linux emulated okay this is the comment and and how to delete or clean like if you do a make clean to to force to recompile everything from scratch configuring catalinux okay before that let's just go back here you see that you have a dis common here patty Linux slash create now you have the petaline slash config that is going to open this menu here that that you can change it and play it to add or take out some device drivers basically you are configuring your kernel okay it's really cool try to type this common and and change it take some models enable for instance the bug or some stuff like that in the Linux and see the effect of this new system ok sometimes you can break the whole thing and then in this case you run the petaline looks build - x mr proper to clean everything from scratch and start again but it's cool because ii you got to use it on how to play with Linux okay so if you just type at a Linux slash config you're going to open this window here that you can configure the the kernel if you type petal Enoch slash config - see who the FS you're going to open a window like this as well but there you can for instance choose which software you want to include you know who the fess okay so it's going to be available as soon as you boot okay and petaline x / config - the colonel it's going to open this window again so these and these are basically the same okay here is just a common line if you want to create your boot by hand okay this is this is basically useful for instance if you change your your FPGA part and you have another bit stream okay you can use this common here pata Linux - package - - boot - - FS BL and then you pass the your e.l.f image for SPFs BL and then you can pass another bit stream okay again this is useful if you for instance I imagine that you add an IP core okay to the FPGA part and you want to make this available you need to change this to create another boot be okay by the way all the comments in pata Linux if you put - - help you can have a list of detail by the common actually them okay here okay the after you do pet a Linux dot beauty you're going to have a inside your project a directory called image Linux you boot cut off which is the the place actually in the image you have all the the packages already compiled there and you just copy them to your SD card here I'm just showing it to you guys how to enable SSH actually call it drop bare so you'll be able to to see what is going you can actually access your Zboard through the network okay here I'm going to show how to create a simple app actually just a hello world you just use petal Enix - great - tea now instead of project you call it apps - - they played C++ in the name of the project okay this is just going to create a seed program a compiled seed program that is going to be available for you in the hotel fest this is just a just an image that I copied from the from the Sonics website to show is more or less a summary of all the pattern Linux Commons okay here is what you have inside your SD card basically the booted bin you have the sbf SBL the first stage bootloader you boot and in the PL bit string you have the kernel image and the device tree okay again guys now if you I'm going to make this presentation available so you can just read it and do all the things at your own pace here I'm just saying that the partitions that I needed okay basically we need just to actually just won the the factory to that we're going to put the booted up in the device tree and in the kernel image okay and this second is the second partition here you can be used later you can mount in your in your system to program and do whatever you want it's going to be kind of the hard drive of your of your system aku here is I'm just shown what is the minimum system that you need to run Linux okay basically just open V Vado and you put a sink and you don't need a no IP core and by default all this busy processor you'll be ready all ready to use Linux okay okay guys so this is a this is my aunt machine okay we have already betta Linux installed okay all the packages that are need to be installed are already there okay so we just run beta linux create - steve project because the name is the type of the project destroy that you are going to create - end the name of the project let's call it simple project ok man's s there here we pass the our board Support Package in this case is a vennett z board okay we just press Enter so the project has been created we just go to this project okay if we just create the type the tree we have already some stuff created okay now just call pata Linux build okay and we wait the Linux compilation to be done this can take up to five minutes or something like this okay I'm going to pause the video and we we bring back when it's done okay guys so now that the beautifies is done okay we have some stuff data could be interests for us if we go and list our TFT P boot okay you have some guys that has been built for us it's just a matter now to copy those guys to our SD card here the system dot B is the device tree called the compiled device tree and vme Linux and the image are are the Linux boot itself but one is for the image if I remember is for you boot and the VM Linux is just the image plane as it is okay so we have another int interesting directory for us is the pre beaut directory should come here so prob you clinics directory if we do an LS here and go to in sorry we check here that we have the boot cut bin file for us okay so basically what you're going to do - to avoid checking which file we need to put on the SD card we're just going to copy the the content of this director here and the the image that has been created the image that has been created in FTP boot okay so that's it we're just going to copy now these items on the on the SD card and we're going to bring them to to the Zed board and in turn the board on with the with the proper switches off okay okay guys so let's just copy the content of this directory here okay prep Butte Linux images so CP everything to media in my case boot okay the other thing that we need to do is to go to our our image directory and copy all the rest to our SD card as well okay I'm just now going to show the content of the SD card and and how they ask the card is partition okay so guys basically this is the content of our fat32 partition okay in our SD card this is the boot bin which is the one that is is going to have you boot the first stage of bootloader in our bit stream the image is the is the linux image in the format of your boot okay those guys here are basically our Jota fats and here is our device tree compiled okay now we are ready let's just put the SD card on the set board and turn it on okay guys this is the content of of our SD card I more specifically the fat32 partition okay so what we have here that is important for us the boot up bin okay which is the guy who is going to have mix together our first stage boot loader or our bit stream okay and a new boot our device tree and the image which is the linux image but prepare to be loaded from your boot okay those guys here are actually our hotel fats okay and after all this is done and created here in your SD card we are ready to to put this on the on the set board okay so let's just close this and let's jump to the Z okay guys so let's just turn on our Z board okay this is here the configuration of the booty okay which is a is a terminal here we just took mention to you where our board got detected okay if you just type the command image okay you're going to see in our case we have a guy here in TTY ACM zero which is our serial port so we just go come to this guy here and put open okay this is actually now we jump to you boot we we didn't open Linux yet what we can do we just type your help this is the list of comments that you have in your boot it should put also print end is all the environment variables that you have available okay in our case we need to run this common here okay boots boots Cindy okay so let's do one boot CD and now we are just starting our kernel okay so basically that's it is trying to to check the network interface who is logged to logging is username hood password hood okay and we are there this is basically our our hood FS okay now isn't we're going to learn now how to create a simple hello world program and change a little bit the configuration of of Linux okay so if you put your EF config we can see that we don't have yet our our eternity interface turn on but what we can do we just press f9 field e 0 9 2 1 6 8 0 10 4 inches up OK in our in our in our Linux board we just enable this guy as well but in at a different address let's put furnaces 200 and up so probably if we ping now our board she's there okay actually now probably cannot because we don't have the the SSH enable we cannot as well so what we're going to do we're going out we went out to change our our hood FS to have something called drop drop bear or drop the yes draw bear that is going to have the SSH enable for us okay but basically guys this is Linux already okay so let me just reboot okay and I'm going to pause the video and show you how to change the configurations okay okay guys so let's just now configure the kernel okay let's imagine for instance that now we want to for instance enable some debug messages okay just for fun let's check show time information on the print case so it's basically going to show that at work at which point the the current message has been called for instance okay so he asked her to save the configuration he's going to save we also said that we want to enable the drop bear I always confuse with Dropbox but no draw bear so that again is config - see instead of kernel output hood FS and basically what we need is file system packages network drop bear and we enable okay whenever Bo so let's save it now what you need to do after this is done we run a pet a Linux build okay by the way guys notice that our we are here in the in the simple proj directory okay this is needed we need you need to run these comments all in the in the project directory and he's going to do this job let me just why he is doing change the destacar because we need to copy those images again and well it will be fast so he is now creating you boot again and creating the hood FS okay guys so this is our TFTP boot this is after the boob is done so we just copy here we apply this to all the files basically we just copy again all the all the stuff that has been generated okay after this is done we just amount destacar put again in our set board and let's boot okay guys so let's run pulley which are is our console terminal we turn on our set board we load the configuration okay and let's open so we run again put the boot home and now you can see that you have the time information that we enable on the Linux kernel and let's check if the drop bear is installed so basically that if it's okay or look cool so basically we log on as hood hood the F config is disabled so let's enable our network h0 okay Ethernet is there let us check if we have a data net enable in our case we don't so let's enable greater net connection and now let's see if we can ping is okay we can be it let's connect now board okay we have already some configuration let's disable and try again yes and okay now this is our that word okay this is all the comments that we have by the way guys we are in the set board now okay you can see this is the Z board basically the same thing that we have here on Putin okay so now let's learn how to how to add a simple hello world through four petal Linux as well okay and run here in our system so to create a simple app okay we can use a pet a Linux comment as well if we type petaline excrete - t now apps and use template c++ and some project name hello world let's say okay he is going to create something in this directory here components apps hello world so let's go to this guy and see what we have here so we have here apps hello world let's see what you have there VI hello world dot cpp and it's just a simple skeleton of a problem okay so hello linux better world okay more than fine no problem okay so let's go back to our project directory here and let's call let's just check if we do petaline oops config - see who the fest just to verify if the if our sample is in our root of s and is not okay so let's just add okay so exit easy yes and let's then run better Linux build so after you create the app don't forget to configure who the fest - also include this new problem ok so let's do battle in Butte and after this is done same process the the hood FS will be in your inner slash TFTP boot we just copy the the hood FS files okay and put then on the SD card and run and run the run to set board for your pure SD card ok ok now the data Butte is complete let's run put sorry okay one Bootsie Andy okay and if everything is okay our program hello world should be already included in the in the hood file system okay normally if we open here the TFTP directory okay and let me just open here our our hotel fest has the /bin directory our hello world okay so let's lo logon on our set board our bin directory we should have okay hello world is there so let's execute okay cool so it's more or less what you created so let's summarize what you learn so far guys so we learn that by using pata Linux we can create Linux distributions okay that are compatible with the set board or boards that use the Z or microblaze okay what all that you need is a board Support Package but normally what you do is that you create your your custom board with a hardware that is really similar to a reference one let's say that board for instance and with Bethel II looks you can create a hole to hold the hole to chain to build Linux Beauty boot build your first first-stage bootloader it's done for you so let's finish the day okay is a lot of information for you guys to digest and the next video we are going to learn how to create device driver so but before we're going to create problem if you value HLS a simple IP core that is going to be that's going to be added to pet a Linux okay I'm going to show you guys how to do that and create a simple device driver to to control this IP core ok so thanks for watching guys if you like to give me a thumbs up and see you the next video
Info
Channel: The Development Channel
Views: 83,894
Rating: 4.9575701 out of 5
Keywords: Linux On Embedded Systems, GNU/Linux (Operating System), Embedded System (Field Of Study), Software (Industry)
Id: 92-uLpWIRaI
Channel Id: undefined
Length: 46min 27sec (2787 seconds)
Published: Sun Nov 01 2015
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.