Download presentation
Presentation is loading. Please wait.
Published byJob Jenkins Modified over 8 years ago
1
Embedded Software Design Week II Linux Intro Linux Kernel
2
How an embedded system is booted? HDD? BIOS? RAM? OS? CPU/GPU?
3
Embedded System
4
Embedded Linux development setup
5
Booting kernel Bootloader loads and executes OS image Device tree is loaded - memory size, clock speeds, onboard devices, buses, and Flash layout Transfer control to kernel
6
Bootloader Initializes critical hardware components, such as the SDRAM controller, I/O controllers, and graphics controllers. Initializes system memory in preparation for passing control to the operating system. Allocates system resources such as memory and interrupt circuits to peripheral controllers, as necessary. Provides a mechanism for locating and loading your operating system image. Loads and passes control to the operating system, passing any required startup information.
7
Boot Overview Kernel Initialization - Mounting a file system First User Space Process: init Kernel context vs User space context Virtual memory space Storage Considerations Storage limit Flash memories ( block sizes, 100K write life time) Wear level algorithms (increase lifetime)
8
Boot Overview Memory space Memory Management Unit (MMU) Hardware engine Works with OS Access rights & memory translation
9
Boot Overview Execution Contexts Kernel symbols addresses : 0xC0XX… Context switch Kernel context User space context Async hw call & blocking user call Two kernel context modes Process context Interrupt context
10
Boot Overview Process Virtual Memory See sample code Handicaps of swapping pages Overhead Shortens life time of flash drive Cross-Development gcc -Wall -o hello hello.c Including headers (where is stdio.h) Linking libraries (external symbol printf()! which libc-*?) Find correct version?
11
Linux Commands Check commands at this site; http://www.codingbyte.com/30-most-frequently-used-linux-commands-with- examples/ http://www.codingbyte.com/30-most-frequently-used-linux-commands-with- examples/ Plus this site http://www.tecmint.com/useful-linux-commands-for-newbies/
12
Raspberry Pi – OS Survey Moving Files Around Graphically Use File Manager
13
Raspberry Pi – OS Survey Starting a Terminal Session
14
Raspberry Pi – OS Survey Navigating the Filesystem Using a Terminal $ cd $ pwd $ cd.. $ cd ~ $ cd / $ ls $ ls f* $ ls –a
15
File commands Copying a File or Folder Use the cp command to copy files and directories. echo "hello" > myfile.txt cp myfile.txt myfile2.txt cp -r mydirectory mydirectory2 Renaming a File or Folder mv my_file.txt my_file.rtf
16
File operations Use the editor nano included with most Raspberry Pi distributions. If you are a Linux fan, try “vi” or “emacs” Use the cat or more commands to view the file. Creating a File Without Using an Editor echo "file contents here" > test.txt touch
17
Directory operations To create a directory, use the mkdir command The rm (remove) command will delete a file or directory and its contents. $ rm my_file.txt $ rm my_file.* $ rm * $ rm -r mydir
18
Privileges, Access Rights The sudo (superuser do) command allows you to perform actions with superuser privileges. Just prefix the command with sudo. $ sudo apt-get update To see the permissions and ownership information relating to files and directories, use the ls command with the option -l. “d” for directory
19
Permissions The command chmod is used to modify file permissions. chmod …. +, -, = for add, remove, or set, respectively permission for currnet user(u), group (g), other users(o) chmod u+x file2.txt The command chown (change owner) is used to modify the ownership of a file or directory. sudo chown root:root file2.txt
20
Making a Screen Capture Install and use the delightfully named scrot screen capture software. sudo apt-get install scrot $ scrot $ scrot –d 5 $ man scrot
21
Installing / Removing Software with apt- get The most used tool for installing software from a Terminal session is apt-get. $ sudo apt-get update $ sudo apt-cache search $ sudo apt-get install The apt-get utility has an option (remove) that will remove a package, but only packagesthat have been installed with apt-get install. $ sudo apt-get remove $ sudo apt-get autoremove $ sudo apt-get clean
22
Running a Program or Script Automatically on Startup 1. Create an init script 2. Make the init script executable. 3. Tell the system about the new init script $ sudo nano /etc/init.d/my_server $ sudo chmod +x /etc/init.d/my_server $ /etc/init.d/my_server start $ sudo update-rc.d my_server defaults
23
Running a Program or Script Automatically at Regular Intervals Use the Linux crontab command. Raspberry Pi needs to know the time and date, and therefore needs a network connection or a real-time clock. $ crontab –e If there is a * in the digit position, that means every; if there is a number there instead, the script will only be run at that minute/hour/day of the month
24
Finding Things Use the Linux find command.
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.