Mastering Embedded Linux Programming 学习 (六)在百问网157开发板上,使用TFTP启动Linux内核

Mastering Embedded Linux Programming 学习 (六)在百问网157开发板上,使用TFTP启动Linux内核

一、在ubuntu上安装配置TFTP服务

参考

sudo apt install tftpd-hpa
mkdir -p /home/tao/tftpboot
chmod 777 /home/tao/tftpboot
sudo vim /etc/default/tftpd-hpa

在这里插入图片描述
然后把内核的镜像和设备树拷贝到该目录下
重新启动TFTP服务

sudo service tftpd-hpa restart 

二、设置u-boot启动参数

setenv ipaddr 192.168.123.21
setenv serverip 192.168.123.220
setenv fdtaddr 0xC4000040
setenv bootfile uImage
setenv fdtfile stm32mp157c-myboard.dtb
setenv netloadimage  tftp ${loadaddr} ${bootfile}
setenv netloadfdt tftp ${fdtaddr} ${fdtfile}
setenv netargs "setenv bootargs rootdelay=3 root=/dev/mmcblk0p5"
setenv netboot "echo Booting from network ...\; run netloadimage\; run netloadfdt\; run netargs\; bootm ${loadaddr} - ${fdtaddr}"
setenv bootcmd run netboot
saveenv

三、使用TFTP启动

在u-boot命令行键入${bootcmd}启动
由于当前的Linux内核还没有网卡驱动,无法通过nfs挂载根文件系统

四、快捷命令

tftp 0xC2000040 uImage
tftp 0xC3000040 stm32mp157c-myboard.dtb
bootm 0xC2000040 - 0xC3000040
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Key Features, Create efficient and secure embedded devices using LinuxMinimize project costs by using open source tools and programsExplore each component technology in depth, using sample implementations as a guide, Book Description, Mastering Embedded Linux Programming takes you through the product cycle and gives you an in-depth description of the components and options that are available at each stage. You will begin by learning about toolchains, bootloaders, the Linux kernel, and how to configure a root filesystem to create a basic working device. You will then learn how to use the two most commonly used build systems, Buildroot and Yocto, to speed up and simplify the development process. Building on this solid base, the next section considers how to make best use of raw NAND/NOR flash memory and managed flash eMMC chips, including mechanisms for increasing the lifetime of the devices and to perform reliable in-field updates. Next, you need to consider what techniques are best suited to writing applications for your device. We will then see how functions are split between processes and the usage of POSIX threads, which have a big impact on the responsiveness and performance of the final device The closing sections look at the techniques available to developers for profiling and tracing applications and kernel code using perf and ftrace., What you will learn, Understand the role of the Linux kernel and select an appropriate role for your applicationUse Buildroot and Yocto to create embedded Linux systems quickly and efficientlyCreate customized bootloaders using U-BootEmploy perf and ftrace to identify performance bottlenecksUnderstand device trees and make changes to accommodate new hardware on your deviceWrite applications that interact with Linux device driversDesign and write multi-threaded applications using POSIX threadsMeasure real-time latencies and tune the Linux kernel to minimize them, About the Author, Chris Simmonds is a software consultant and trainer who lives in southern England. He has been using Linux in embedded systems since the late 1990s, during which he has worked on many interesting projects, including a stereoscopic camera, intelligent weighing scales, various set-top boxes and home routers, and even a large walking robot., He is a frequent presenter at open source and embedded conferences, including the Embedded Linux Conference, Embedded World, and the Android Builders' Summit. He has been conducting training courses and workshops in embedded Linux since 2002 and in embedded Android since 2010. He has delivered hundreds of sessions to many well-known companies. You can see some of his work on the 'Inner Penguin' blog at www.2net.co.uk., Table of Contents, Starting OutLearning About ToolchainsAll About BootloadersPorting and Configuring the KernelBuilding a Root FilesystemSelecting a Build SystemCreating a Storage StrategyIntroducing Device DriversStarting up - the init ProgramLearning About Processes and ThreadsManaging MemoryDebugging with GDBProfiling and TracingReal-time Programming
Key Features Create efficient and secure embedded devices using Linux Minimize project costs by using open source tools and programs Explore each component technology in depth, using sample implementations as a guide Book Description Mastering Embedded Linux Programming takes you through the product cycle and gives you an in-depth description of the components and options that are available at each stage. You will begin by learning about toolchains, bootloaders, the Linux kernel, and how to configure a root filesystem to create a basic working device. You will then learn how to use the two most commonly used build systems, Buildroot and Yocto, to speed up and simplify the development process. Building on this solid base, the next section considers how to make best use of raw NAND/NOR flash memory and managed flash eMMC chips, including mechanisms for increasing the lifetime of the devices and to perform reliable in-field updates. Next, you need to consider what techniques are best suited to writing applications for your device. We will then see how functions are split between processes and the usage of POSIX threads, which have a big impact on the responsiveness and performance of the final device The closing sections look at the techniques available to developers for profiling and tracing applications and kernel code using perf and ftrace. What you will learn Understand the role of the Linux kernel and select an appropriate role for your application Use Buildroot and Yocto to create embedded Linux systems quickly and efficiently Create customized bootloaders using U-Boot Employ perf and ftrace to identify performance bottlenecks Understand device trees and make changes to accommodate new hardware on your device Write applications that interact with Linux device drivers Design and write multi-threaded applications using POSIX threads Measure real-time latencies and tune the Linux kernel to minimize them About the Author Chris Simmonds is a software consultant and trainer who lives in southern England. He has been using Linux in embedded systems since the late 1990s, during which he has worked on many interesting projects, including a stereoscopic camera, intelligent weighing scales, various set-top boxes and home routers, and even a large walking robot. He is a frequent presenter at open source and embedded conferences, including the Embedded Linux Conference, Embedded World, and the Android Builders' Summit. He has been conducting training courses and workshops in embedded Linux since 2002 and in embedded Android since 2010. He has delivered hundreds of sessions to many well-known companies. You can see some of his work on the "Inner Penguin" blog at www.2net.co.uk. Table of Contents Chapter 1: Starting Out Chapter 2: Learning About Toolchains Chapter 3: All About Bootloaders Chapter 4: Porting and Configuring the Kernel Chapter 5: Building a Root Filesystem Chapter 6: Selecting a Build System Chapter 7: Creating a Storage Strategy Chapter 8: Introducing Device Drivers Chapter 9: Starting up - The init Program Chapter 10: Learning About Processes and Threads Chapter 11: Managing Memory Chapter 12: Debugging with GDB Chapter 13: Profiling and Tracing Chapter 14: Real-time Programming
Linux has been the mainstay of embedded computing for many years. And yet, there are remarkably few books that cover the topic as a whole: this book is intended to fill that gap. The term embedded Linux is not well-defined, and can be applied to the operating system inside a wide range of devices ranging from thermostats to Wi-Fi routers to industrial control units. However, they are all built on the same basic open source software. Those are the technologies that I describe in this book, based on my experience as an engineer and the materials I have developed for my training courses. Technology does not stand still. The industry based around embedded computing is just as susceptible to Moore's law as mainstream computing. The exponential growth that this implies has meant that a surprisingly large number of things have changed since the first edition of this book was published. This second edition is fully revised to use the latest versions of the major open source components, which include Linux 4.9, Yocto Project 2.2 Morty, and Buildroot 2017.02. Since it is clear that embedded Linux will play an important part in the Internet of Things, there is a new chapter on the updating of devices in the field, including Over the Air updates. Another trend is the quest to reduce power consumption, both to extend the battery life of mobile devices and to reduce energy costs. The chapter on power management shows how this is done. Mastering Embedded Linux Programming covers the topics in roughly the order that you will encounter them in a real-life project. The first 6 chapters are concerned with the early stages of the project, covering basics such as selecting the toolchain, the bootloader, and the kernel. At the conclusion of this this section, I introduce the idea of using an embedded build tool, using Buildroot and the Yocto Project as examples. The middle part of the book, chapters 7 through to 13, will help you in the implementation phase of the project. It covers the topics of filesystems, the init program, multithreaded programming, software update, and power management. The third section, chapters 14 and 15, show you how to make effective use of the many debug and profiling tools that Linux has to offer in order to detect problems and identify bottlenecks. The final chapter brings together several threads to explain how Linux can be used in real-time applications. Each chapter introduces a major area of embedded Linux. It describes the background so that you can learn the general principles, but it also includes detailed worked examples that illustrate each of these areas. You can treat this as a book of theory, or a book of examples. It works best if you do both: understand the theory and try it out in real life.

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值