Embedded-Linux-4D-Slides.Pdf
Total Page:16
File Type:pdf, Size:1020Kb
Embedded Linux system development Embedded Linux system development © Copyright 2004-2021, Bootlin. Creative Commons BY-SA 3.0 license. Latest update: October 10, 2021. Document updates and sources: https://bootlin.com/doc/training/embedded-linux Corrections, suggestions, contributions and translations are welcome! embedded Linux and kernel engineering Send them to [email protected] - Kernel, drivers and embedded Linux - Development, consulting, training and support - https://bootlin.com 1/400 Rights to copy © Copyright 2004-2021, Bootlin License: Creative Commons Attribution - Share Alike 3.0 https://creativecommons.org/licenses/by-sa/3.0/legalcode You are free: I to copy, distribute, display, and perform the work I to make derivative works I to make commercial use of the work Under the following conditions: I Attribution. You must give the original author credit. I Share Alike. If you alter, transform, or build upon this work, you may distribute the resulting work only under a license identical to this one. I For any reuse or distribution, you must make clear to others the license terms of this work. I Any of these conditions can be waived if you get permission from the copyright holder. Your fair use and other rights are in no way affected by the above. Document sources: https://github.com/bootlin/training-materials/ - Kernel, drivers and embedded Linux - Development, consulting, training and support - https://bootlin.com 2/400 Hyperlinks in the document There are many hyperlinks in the document I Regular hyperlinks: https://kernel.org/ I Kernel documentation links: dev-tools/kasan I Links to kernel source files and directories: drivers/input/ include/linux/fb.h I Links to the declarations, definitions and instances of kernel symbols (functions, types, data, structures): platform_get_irq() GFP_KERNEL struct file_operations - Kernel, drivers and embedded Linux - Development, consulting, training and support - https://bootlin.com 3/400 Company at a glance I Engineering company created in 2004, named ”Free Electrons” until Feb. 2018. I Locations: Orange, Toulouse, Lyon (France) I Serving customers all around the world I Head count: 13 - Only Free Software enthusiasts! I Focus: Embedded Linux, Linux kernel, build systems and low level Free and Open Source Software for embedded and real-time systems. I Feb. 2021: Bootlin is the 20th all-time Linux kernel contributor I Activities: development, training, consulting, technical support. I Added value: get the best of the user and development community and the resources it offers. Top Linux contributors since git (2005) - Kernel, drivers and embedded Linux - Development, consulting, training and support - https://bootlin.com 4/400 Bootlin on-line resources I All our training materials and technical presentations: https://bootlin.com/docs/ I Technical blog: https://bootlin.com/ I Quick news (Mastodon): https://fosstodon.org/@bootlin I Quick news (Twitter): https://twitter.com/bootlincom I Quick news (LinkedIn): Mastodon is a free and decentralized https: social network created in the best //www.linkedin.com/company/bootlin interests of its users. I Elixir - browse Linux kernel sources on-line: Image credits: Jin Nguyen - https://frama.link/bQwcWHTP https://elixir.bootlin.com - Kernel, drivers and embedded Linux - Development, consulting, training and support - https://bootlin.com 5/400 Generic course information Generic course information embedded Linux and kernel engineering © Copyright 2004-2021, Bootlin. Creative Commons BY-SA 3.0 license. Corrections, suggestions, contributions and translations are welcome! - Kernel, drivers and embedded Linux - Development, consulting, training and support - https://bootlin.com 6/400 Supported hardware STMicroelectronics STM32MP157D-DK1 Discovery board I STM32MP157D (Dual Cortex-A7 + Cortex-M4) CPU from STMicroelectronics I 512 MB DDR3L RAM I Gigabit Ethernet port I 4 USB 2.0 host ports I 1 USB-C OTG port I 1 Micro SD slot I On-board ST-LINK/V2-1 debugger I Misc: buttons, LEDs, Audio codec I Currently sold at 65 EUR + VAT at Mouser Board and CPU documentation, design files, software: https://www.st.com/en/evaluation-tools/stm32mp157a-dk1.html - Kernel, drivers and embedded Linux - Development, consulting, training and support - https://bootlin.com 7/400 Shopping list: hardware for this course I STMicroelectronics STM32MP157D-DK1 Discovery kit - Available from Mouser (65 EUR + VAT) I USB-C Cable I Micro USB Cable I A standard USB audio headset. We’re using Logitech USB H340 (https://support.logitech.com/en_us/product/usb-headset-h340) I A micro SD card with at least 128 MB of capacity - Kernel, drivers and embedded Linux - Development, consulting, training and support - https://bootlin.com 8/400 Labs proposed on another platform After this course, you can also run all labs on the Microchip SAMA5D3 Xplained ARM board. In addition, you will also have real-time and NAND flash labs! Lab instructions available on https://bootlin.com/doc/training/embedded-linux/ - Kernel, drivers and embedded Linux - Development, consulting, training and support - https://bootlin.com 9/400 Labs proposed on another platform After this course, you can also run most labs on the QEMU emulated ARM Versatile Express Cortex A9 board EMU Lab instructions available on https://bootlin.com/doc/training/embedded-linux-qemu/ - Kernel, drivers and embedded Linux - Development, consulting, training and support - https://bootlin.com 10/400 Participate! During the lectures... I Don’t hesitate to ask questions. Other people in the audience may have similar questions too. I This helps the trainer to detect any explanation that wasn’t clear or detailed enough. I Don’t hesitate to share your experience, for example to compare Linux with other operating systems used in your company. I Your point of view is most valuable, because it can be similar to your colleagues’ and different from the trainer’s. I Your participation can make our session more interactive and make the topics easier to learn. - Kernel, drivers and embedded Linux - Development, consulting, training and support - https://bootlin.com 11/400 Practical lab guidelines During practical labs... I We cannot support more than 8 workstations at once (each with its board and equipment). Having more would make the whole class progress slower, compromising the coverage of the whole training agenda (exception for public sessions: up to 10 people). I So, if you are more than 8 participants, please form up to 8 working groups. I Open the electronic copy of your lecture materials, and use it throughout the practical labs to find the slides you need again. I Don’t hesitate to copy and paste commands from the PDF slides and labs. - Kernel, drivers and embedded Linux - Development, consulting, training and support - https://bootlin.com 12/400 Advise: write down your commands! During practical labs, write down all your commands in a text file. I You can save a lot of time re-using commands Lab commands in later labs. Cross-compiling kernel: export ARCH=arm I This helps to replay your work if you make export CROSS_COMPILE=arm-linux- make sama5_defconfig significant mistakes. Booting kernel through tftp: I You build a reference to remember commands setenv bootargs console=ttyS0 root=/dev/nfs setenv bootcmd tftp 0x21000000 zImage; tftp 0x22000000 dtb; bootz 0x21000000 - 0x2200... in the long run. I That’s particular useful to keep kernel Making ubifs images: mkfs.ubifs -d rootfs -o root.ubifs -e 124KiB command line settings that you used earlier. -m 2048 -c 1024 I Also useful to get help from the instructor, Encountered issues: Restart NFS server after editing /etc/exports! showing the commands that you run. gedit ~/lab-history.txt - Kernel, drivers and embedded Linux - Development, consulting, training and support - https://bootlin.com 13/400 Cooperate! As in the Free Software and Open Source community, cooperation during practical labs is valuable in this training session: I Use the dedicated Matrix channel for this session I If you complete your labs before other people, don’t hesitate to help them and investigate the issues they face. The faster we progress as a group, the more time we have to explore extra topics. I Explain what you understood to other participants when needed. It also helps to consolidate your knowledge. I Don’t hesitate to report potential bugs to your instructor. I Don’t hesitate to look for solutions on the Internet as well. - Kernel, drivers and embedded Linux - Development, consulting, training and support - https://bootlin.com 14/400 Introduction to Embedded Linux Introduction to Embedded Linux embedded Linux and kernel engineering © Copyright 2004-2021, Bootlin. Creative Commons BY-SA 3.0 license. Corrections, suggestions, contributions and translations are welcome! - Kernel, drivers and embedded Linux - Development, consulting, training and support - https://bootlin.com 15/400 Birth of Free Software I 1983, Richard Stallman, GNU project and the free software concept. Beginning of the development of gcc, gdb, glibc and other important tools I 1991, Linus Torvalds, Linux kernel project, a UNIX-like operating system kernel. Together with GNU software and many other open-source components: a completely free operating system, GNU/Linux I 1995, Linux is more and more popular on server systems I 2000, Linux is more and more popular on embedded systems I 2008, Linux is more and more popular on mobile devices Richard Stallman in 2019 Image credits (Wikipedia): and phones https://frama.link/qC73jkk4 I 2012, Linux is