This document provides an overview of a Nerves project badge hacking workshop. It covers interfacing with hardware on Nerves devices, including:
- Booting to the IEx shell for interactive debugging
- Configuring pin multiplexing to control hardware pins
- Blinking an LED using the Elixir Ale library to control GPIO pins
- Blinking an LED by communicating with an Arduino over Firmata protocol
It also discusses Nerves system packages, toolchain setup, target preparation including burning bootloaders, and advanced configuration topics like customizing systems and firmware updates.
Using Erlang in an Embedded and Cross-Compiled WorldFrank Hunleth
This presentation gives an overview of turning Erlang/OTP releases into Flash images that are ready to copy to an SDCard and run on a BeagleBone Black. It was presented at the ErlangDC conference on 12/7/2013.
Building a Network IP Camera using ErlangFrank Hunleth
This is my Erlang Factory SF 2014 talk on using the Nerves project to make a streaming IP camera with the Beaglebone Black and a custom image sensor cape. The presentation provides throughput, latency, and memory usage measurements to motivate using Erlang in embedded Linux-based devices.
(1) The Nerves project aims to build small to mid-sized embedded systems using Erlang/OTP by creating a minimal embedded Linux environment that is cross-compiled to only include necessary libraries. (2) It uses Buildroot to customize a minimal init process and build OTP releases that can fully update systems. (3) The workflow involves developing OTP applications, cross-compiling binaries, generating an Erlang/OTP release, and burning the final system image to an SD card or updating firmware.
Using Erlang on the RaspberryPi to interact with the physical worldBrian Chamberlain
Embedded linux systems are gaining in popularity in the maker/hacker communities. Platforms such as the BeagleBone and RaspberryPi have created new interest in systems which can interact with the physical world. However, interacting with the physical world can be a challenge. Luckily, we have Erlang to help us out. This talk covers new hardware platforms, embedded linux systems, why Erlang is a good fit, and how you can get started hardware hacking the world with Erlang.
This document summarizes a PuppetConf 2011 presentation by Jasper Poppe on automated deployment using Seedbank and Puppet. The presentation introduced Seedbank as a tool for managing Debian and Ubuntu network installations. It also demonstrated Infrastructure Anywhere, a set of Fabric scripts that provide the components for fully automated deployments of core infrastructure from scratch. The presentation provided an overview of Seedbank and Infrastructure Anywhere functionality, showed a demo of live infrastructure installation, and shared information on accessing the open source code repositories. Time was left at the end for questions.
It's been three years since Netflix's Brendan Gregg described the Berkeley Packet Filter as "Superpowers for Linux". Since then there has been an explosion of capabilities and tools based on eBPF, so you've probably heard the term, but do you know what it is and how to use it? In this demo-rich talk we'll explore some of the powerful things we can do with this technology, especially in the context of containers.
This document describes an opinionated control repository for Puppet that contains manifests, modules, Hiera data, and tools to manage Puppet environments. It includes profiles and sample data for common applications. Optional integrations allow testing infrastructure with Vagrant, Docker, Fabric, and GitLab. The repository is intended as a starting point that can be customized for specific projects. It provides a skeleton for managing Puppet code and infrastructure as code.
Smash the Stack: Writing a Buffer Overflow Exploit (Win32)Elvin Gentiles
This document provides an overview of buffer overflow exploits on Windows 32-bit systems. It discusses the lab environment that will be used, basic assembly concepts like registers and instructions, the Windows 32 memory layout, how the stack works, and the general steps for exploit development. These include causing a crash, identifying the offset, determining bad characters, locating space for shellcode, generating shellcode, and redirecting execution to the shellcode. The document concludes by listing some hands-on exercises that will be covered, and recommending additional learning materials on exploit writing.
Using Erlang in an Embedded and Cross-Compiled WorldFrank Hunleth
This presentation gives an overview of turning Erlang/OTP releases into Flash images that are ready to copy to an SDCard and run on a BeagleBone Black. It was presented at the ErlangDC conference on 12/7/2013.
Building a Network IP Camera using ErlangFrank Hunleth
This is my Erlang Factory SF 2014 talk on using the Nerves project to make a streaming IP camera with the Beaglebone Black and a custom image sensor cape. The presentation provides throughput, latency, and memory usage measurements to motivate using Erlang in embedded Linux-based devices.
(1) The Nerves project aims to build small to mid-sized embedded systems using Erlang/OTP by creating a minimal embedded Linux environment that is cross-compiled to only include necessary libraries. (2) It uses Buildroot to customize a minimal init process and build OTP releases that can fully update systems. (3) The workflow involves developing OTP applications, cross-compiling binaries, generating an Erlang/OTP release, and burning the final system image to an SD card or updating firmware.
Using Erlang on the RaspberryPi to interact with the physical worldBrian Chamberlain
Embedded linux systems are gaining in popularity in the maker/hacker communities. Platforms such as the BeagleBone and RaspberryPi have created new interest in systems which can interact with the physical world. However, interacting with the physical world can be a challenge. Luckily, we have Erlang to help us out. This talk covers new hardware platforms, embedded linux systems, why Erlang is a good fit, and how you can get started hardware hacking the world with Erlang.
This document summarizes a PuppetConf 2011 presentation by Jasper Poppe on automated deployment using Seedbank and Puppet. The presentation introduced Seedbank as a tool for managing Debian and Ubuntu network installations. It also demonstrated Infrastructure Anywhere, a set of Fabric scripts that provide the components for fully automated deployments of core infrastructure from scratch. The presentation provided an overview of Seedbank and Infrastructure Anywhere functionality, showed a demo of live infrastructure installation, and shared information on accessing the open source code repositories. Time was left at the end for questions.
It's been three years since Netflix's Brendan Gregg described the Berkeley Packet Filter as "Superpowers for Linux". Since then there has been an explosion of capabilities and tools based on eBPF, so you've probably heard the term, but do you know what it is and how to use it? In this demo-rich talk we'll explore some of the powerful things we can do with this technology, especially in the context of containers.
This document describes an opinionated control repository for Puppet that contains manifests, modules, Hiera data, and tools to manage Puppet environments. It includes profiles and sample data for common applications. Optional integrations allow testing infrastructure with Vagrant, Docker, Fabric, and GitLab. The repository is intended as a starting point that can be customized for specific projects. It provides a skeleton for managing Puppet code and infrastructure as code.
Smash the Stack: Writing a Buffer Overflow Exploit (Win32)Elvin Gentiles
This document provides an overview of buffer overflow exploits on Windows 32-bit systems. It discusses the lab environment that will be used, basic assembly concepts like registers and instructions, the Windows 32 memory layout, how the stack works, and the general steps for exploit development. These include causing a crash, identifying the offset, determining bad characters, locating space for shellcode, generating shellcode, and redirecting execution to the shellcode. The document concludes by listing some hands-on exercises that will be covered, and recommending additional learning materials on exploit writing.
Composer has triggered a renaissance in the PHP community, it has changed the way we deal with other people’s code and it has changed the way we share our code. We are all slowly moving to using Composer, from Wordpress to Joomla and Drupal and frameworks in between. But many of us mistreat composer, follow outdated practices or simply lack a few tricks. In this session i’ll get you the low down on how to use composer the right way.
As computer systems become more sophisticated, process injection techniques also evolve. These techniques are notorious for their use by "malicious software" to hide code execution and avoid detection. In this presentation we dive deep into the Windows runtime and we demonstrate these techniques. Besides, we also learn how to code construction and design patterns that relate to perform hidden code can recognize.
Captain Hook: Pirating AVs to Bypass Exploit MitigationsenSilo
In this talk we reveal six(!) different security issues that we uncovered in various hooking engines. The vulnerabilities we found enable a threat actor to bypass the security measures of the underlying operating system. As we uncovered the vulnerabilities one-by-one we found them to impact commercial engines, such as Microsoft’s Detours, open source engines such as EasyHook and proprietary engines such as those belonging to TrendMicro, Symantec, Kaspersky and about twenty others.
Using Carton and plenv to install application expected versions of perl and modules that doesn't require root access nor replace the system installed versions of perl.
Valerio Di Giampietro - Introduction To IoT Reverse Engineering with an examp...linuxlab_conf
Introduction to firmware reverse engineering process of IoT devices. The process, described with an example on a home router, is based on Information Gathering of hardware and software, Building of an Emulation Environment to run binaries, and Techniques to analyze, hack and modify the firmware.
The introduction to firmware reverse engineering process is described with a real example, done by the author, on a recent home router with the target to load a modified firmware overcoming the router protection that doesn’t allow loading of unsigned firmware (ref: https://github.com/digiampietro/adbtools2 )
The process described is based on:
Information Gathering hw: identify main device components (CPU, Flash, SDRAM, main components) hw: locate UART and JTAG interfaces hw tools: Bus Pirate, OpenOCD, Jtagulator sw: get os image file or firmware file sw tools: strings, file, binwalk, dd, jefferson, uncramfs etc. identification of CPU, Flash, RAM, kernel version, C library, toolchain used etc. identification of Original Manufacturer and Original Firmware Manufacturer Emulation Environment using QEMU select a QEMU machine and CPU reasonably similar to the IoT device (same CPU, similar kernel version, similar modules and libraries) select a tool to build the kernel and the root file system (brief description of Yocto Project, Buildroot and OpenWRT build system). Buildroot will be used in the example and described in more detail Buildroot and kernel configuration, generation of root file system with binaries and libraries with debugging information Overcoming obstacles created by the firmware manufacturer Running interesting binaries in the emulated environment Use tools like strace, ltrace, gdb to reverse engineer the most interesting binaries Analyze how the device works the firmware upgrade process CLI and Web interface analisys main processes analisys finding vulnerabilities hacking into the system hack the firmware upgrade process replace the original firmware Create a Firmware Modification Kit to simplify the firmware modification process.
Embedded Android system development workshop is focused on integrating new device with Android framework. Our hands-on approach makes Emertxe as the best institute to learn android system development training. This workshop deep dives into Android porting, Android Hardware Abstraction Layer (HAL), Android Services and Linux device driver ecosystem. This workshop based training program will enable you to efficiently integrate new hardware with Android HAL / Framework.
Jonathan Corbet - Keynote: The Kernel Reportlinuxlab_conf
A whirlwind tour of what has been happening in the kernel development community and what can be expected in the near future.
The Linux kernel is at the core of any Linux system; the performance and capabilities of the kernel will, in the end, place an upper bound on what the system as a whole can do. This talk will review recent events in the kernel development community, discuss the current state of the kernel and the challenges it faces, and look forward to how the kernel may address those challenges. Attendees of any technical ability should gain a better understanding of how the kernel got to its current state and what can be expected in the near future.
Embedded Recipes 2019 - Testing firmware the devops wayAnne Nicolas
ITRenew is selling recertified OCP servers under the Sesame brand, those servers come either with their original UEFI BIOS or with LinuxBoot. The LinuxBoot project is pushing the Linux kernel inside bios flash and using userland programs as bootloader.
To achieve quality on our software stack, as any project, we need to test it. Traditional BIOS are tested by hand, this is 2019 we need to do it automatically! We already presented the hardware setup behind the LinuxBoot CI, this talk will focus on the software.
We use u-root for our userland bootloader; this software is written in Go so we naturally choose to use Go for our testing too. We will present how we are using and extending the Go native test framework `go test` for testing embedded systems (serial console) and improving the report format for integration to a CI.
Julien Viard de Galbert
Composer is a dependency manager for PHP that allows projects to declare and install dependencies. It works by defining dependencies in a composer.json file and installing them into a vendor directory. This ensures all environments have identical dependency versions. Composer also handles autoloading so dependencies can be used immediately after including the vendor/autoload.php file. It is commonly used to manage library dependencies within a project and distribute PHP libraries to others via Packagist.
XCon 2014 => http://xcon.xfocus.org/
In the past was quite common to exploit heap / pool manager vulnerabilities attacking its internal linked structures. However current memory management improve a lot and at current date it is quite ineffective to attack heap in this way. But still those techniques come into hand when we start to looking at linked structures widespread throughout kernel that are unfortunately not hardened enough.
In this presentation we will examine power of these vulnerabilities by famous example “CVE – 2013 - 3660”. Showing bypass on ‘lazy’ assertions of _LIST_ENTRY, present exploitation after party and teleport to kernel.
Steelcon 2014 - Process Injection with Pythoninfodox
This is the slides to accompany the talk given by Darren Martyn at the Steelcon security conference in July 2014 about process injection using python.
Covers using Python to manipulate processes by injecting code on x86, x86_64, and ARMv7l platforms, and writing a stager that automatically detects what platform it is running on and intelligently decides which shellcode to inject, and via which method.
The Proof of Concept code is available at https://github.com/infodox/steelcon-python-injection
One Year of Porting - Post-mortem of two Linux/SteamOS launchesLeszek Godlewski
2013 was the year in which Linux finally got the attention of game developers; it was also the year in which my first two Linux/SteamOS ports were released. This talk will cover the learnings of one year of porting work from a programmer's point of view: DOs and DON'Ts and issues both expected and unexpected.
This document is a series of errata and clarifications from a previous talk on game development for Linux. It addresses shortcomings in SDL for threaded rendering and audio capabilities, and clarifies that OpenGL context sharing is possible in SDL2. It also recommends using SDL2's joystick and game controller APIs rather than low-level kernel interfaces. Placement of game files on Linux systems and XDG standard directories for configuration and user data are explained. The document concludes by thanking readers and suggesting that an upcoming game may also come to Linux.
Windows Kernel Exploitation : This Time Font hunt you down in 4 bytesPeter Hlavaty
The document discusses exploiting TrueType font (TTF) vulnerabilities to achieve kernel code execution on Windows systems. It begins by describing the discovery of exploitable bugs in a TTF fuzzer. Despite mitigations like KASLR, NX, SMAP, and CFG, the researchers were able to bypass these protections through techniques like controlled overflows, abusing plain kernel structures, and function-driven attacks. They show how to leverage wild overflows, control kernel memory layout, and hijack control flow to achieve arbitrary code execution. The document emphasizes that OS design weaknesses allow bypassing modern defenses through clever bug chaining and memory manipulation.
The Yocto Project is a collaborative open source project that provides prototypes, tools and methods that let you create personalized Linux-based systems for embedded products independent from the hardware architecture. The project was born in 2010 as a partnership of many different hardware manufacturers, open-source operative systems providers and electronic companies, to bring some order to the chaos that was the development of Linux Embedded. Why use Project Yocto? Because it's a development environment for Linux embedded complete with tools, meta-data and documentation - everything that one needs. The free of charge tools that Yocto makes available are powerful and easy to generate (included emulation environments, debuggers, a tool-kit to generate applications and others) and they let you create and continue projects, without causing you a loss of optimizations and investments made in the prototyping phase. Project Yocto supports the adoption of this technology by the open-source community letting users concentrate on the characteristics and development of their product.
Luca Ceresoli - Buildroot vs Yocto: Differences for Your Daily Joblinuxlab_conf
This document discusses the differences between Buildroot and Yocto/Bitbake for embedded Linux development. It begins by explaining that Buildroot and Yocto both use a dependency graph and actions to build each node, but are based on different underlying tools - Buildroot uses Kconfig and Make while Yocto uses Kconfig, Bitbake, and other OpenEmbedded tools. It also notes that Buildroot focuses on generating a root filesystem while Yocto focuses on generating packages and entire Linux distributions.
Kernel vulnerabilities was commonly used to obtain admin privileges, and main rule was to stay in kernel as small time as possible! But nowdays even when you get admin / root then current operating systems are sometimes too restrictive. And that made kernel exploitation nice vector for installing to kernel mode!
In this talk we will examine steps from CPL3 to CPL0, including some nice tricks, and we end up with developing kernel mode drivers.
Marco Cavallini @ LinuxLab 2018 : Workshop Yocto Project, an automatic genera...Marco Cavallini
This document provides information about a workshop on the Yocto Project being conducted by Marco Cavallini of KOAN. The workshop will cover setting up a Yocto Project build environment using Docker, basics of the Yocto Project including layers and recipes, debugging builds, and creating new images. Attendees will learn how to build a basic embedded Linux system from source and boot it in QEMU.
This document provides an overview and agenda for a presentation on Yocto, an open source project for embedded Linux development. It discusses Yocto components, layers, recipes, classes, and the build system. It also outlines how Yocto can be used by both system developers and application developers.
This document discusses vulnerability design patterns for kernel exploitation. It outlines several common vulnerability classes for the kernel including out of boundary errors, buffer overflows, and null pointer writes. It provides examples of how these vulnerabilities could be used to achieve kernel code execution or privilege escalation. It also notes how kernel exploitation techniques have evolved over time to bypass defenses like KASLR and discusses developing exploitation tools instead of just shellcode.
The document discusses various Linux system monitoring utilities including SAR, SADC/SADF, MPSTAT, VMSTAT, and TOP. SAR provides CPU, memory, I/O, network, and other system activity reports. SADC collects system data which SADF can then format and output. MPSTAT reports processor-level statistics. VMSTAT provides virtual memory statistics. TOP displays active tasks and system resources usage.
How to create your own Linux distribution (embedded-gothenburg)Dimitrios Platis
= Please note that the code in the slides may not be working
= Refer to the repository for working examples: https://github.com/platisd/meta-dimitriOS
Welcome to a beginner-friendly deep dive on how to create your own Linux distribution!
But why would you want to create one yourself?
** BACKGROUND **
Mainstream Linux distributions (e.g. Ubuntu, ArchLinux) enable their users to perform a plethora of tasks and often include the means for further customization of the system via a package manager, development tools, a desktop environment etc.
However, if you are creating a device that has a very specific set of use cases and needs to operate under strict constraints in regards to resources, power consumption, performance, or robustness, then using a full-fledged desktop operating system is infeasible. This is very common when developing embedded systems, meant to be used in an IoT application, the automotive or telecom industry, and so forth.
To create an Embedded Linux operating system, there are two paths you can follow:
1. Create a "golden image"; often the first choice when prototyping with a development board, e.g. a Raspberry Pi.
An off-the-shelf operating system, such as Debian, is hacked until it fits the purpose. Then clones of that "golden image" are created and installed in more devices.
This is good enough for creating a proof-of-concept but quickly falls short when the project becomes more complicated, larger, or the need to develop product variants arises.
2. Create a configuration-based distribution; the industry-proven way to create an Embedded Linux operating system.
Instead of maintaining the operating system as a big binary, its components are specified in version controllable configuration files. Setting everything up may require a steeper learning curve since things are not already conveniently in place. However, it is the only sustainable way to go forward when it comes to serious Embedded Linux development.
More on the topic: https://www.linuxjournal.com/content/linux-iot-development-adjusting-binary-os-yocto-project-workflow
** WORKSHOP **
In this workshop, we are going to demonstrate the "ingredients" needed to build your own Linux distribution using the Yocto project. Then we will run our distribution on a Raspberry Pi board.
Yocto is a collection of tools and processes enabling the creation of configurable Embedded Linux distributions. You define which components are to be included in your operating system with software- and hardware-specific configuration files. "Recipes" determine how these components are built and also what they depend upon. Finally, these recipes are utilized by "bitbake" (a tool offered by Yocto) to build your custom Linux image.
During the workshop, we will go over the setup needed to create a custom operating system for a typical IoT device. It boots up, automatically connects to the internet, and launches a C++ demon that fetches information from a cloud API.
Composer has triggered a renaissance in the PHP community, it has changed the way we deal with other people’s code and it has changed the way we share our code. We are all slowly moving to using Composer, from Wordpress to Joomla and Drupal and frameworks in between. But many of us mistreat composer, follow outdated practices or simply lack a few tricks. In this session i’ll get you the low down on how to use composer the right way.
As computer systems become more sophisticated, process injection techniques also evolve. These techniques are notorious for their use by "malicious software" to hide code execution and avoid detection. In this presentation we dive deep into the Windows runtime and we demonstrate these techniques. Besides, we also learn how to code construction and design patterns that relate to perform hidden code can recognize.
Captain Hook: Pirating AVs to Bypass Exploit MitigationsenSilo
In this talk we reveal six(!) different security issues that we uncovered in various hooking engines. The vulnerabilities we found enable a threat actor to bypass the security measures of the underlying operating system. As we uncovered the vulnerabilities one-by-one we found them to impact commercial engines, such as Microsoft’s Detours, open source engines such as EasyHook and proprietary engines such as those belonging to TrendMicro, Symantec, Kaspersky and about twenty others.
Using Carton and plenv to install application expected versions of perl and modules that doesn't require root access nor replace the system installed versions of perl.
Valerio Di Giampietro - Introduction To IoT Reverse Engineering with an examp...linuxlab_conf
Introduction to firmware reverse engineering process of IoT devices. The process, described with an example on a home router, is based on Information Gathering of hardware and software, Building of an Emulation Environment to run binaries, and Techniques to analyze, hack and modify the firmware.
The introduction to firmware reverse engineering process is described with a real example, done by the author, on a recent home router with the target to load a modified firmware overcoming the router protection that doesn’t allow loading of unsigned firmware (ref: https://github.com/digiampietro/adbtools2 )
The process described is based on:
Information Gathering hw: identify main device components (CPU, Flash, SDRAM, main components) hw: locate UART and JTAG interfaces hw tools: Bus Pirate, OpenOCD, Jtagulator sw: get os image file or firmware file sw tools: strings, file, binwalk, dd, jefferson, uncramfs etc. identification of CPU, Flash, RAM, kernel version, C library, toolchain used etc. identification of Original Manufacturer and Original Firmware Manufacturer Emulation Environment using QEMU select a QEMU machine and CPU reasonably similar to the IoT device (same CPU, similar kernel version, similar modules and libraries) select a tool to build the kernel and the root file system (brief description of Yocto Project, Buildroot and OpenWRT build system). Buildroot will be used in the example and described in more detail Buildroot and kernel configuration, generation of root file system with binaries and libraries with debugging information Overcoming obstacles created by the firmware manufacturer Running interesting binaries in the emulated environment Use tools like strace, ltrace, gdb to reverse engineer the most interesting binaries Analyze how the device works the firmware upgrade process CLI and Web interface analisys main processes analisys finding vulnerabilities hacking into the system hack the firmware upgrade process replace the original firmware Create a Firmware Modification Kit to simplify the firmware modification process.
Embedded Android system development workshop is focused on integrating new device with Android framework. Our hands-on approach makes Emertxe as the best institute to learn android system development training. This workshop deep dives into Android porting, Android Hardware Abstraction Layer (HAL), Android Services and Linux device driver ecosystem. This workshop based training program will enable you to efficiently integrate new hardware with Android HAL / Framework.
Jonathan Corbet - Keynote: The Kernel Reportlinuxlab_conf
A whirlwind tour of what has been happening in the kernel development community and what can be expected in the near future.
The Linux kernel is at the core of any Linux system; the performance and capabilities of the kernel will, in the end, place an upper bound on what the system as a whole can do. This talk will review recent events in the kernel development community, discuss the current state of the kernel and the challenges it faces, and look forward to how the kernel may address those challenges. Attendees of any technical ability should gain a better understanding of how the kernel got to its current state and what can be expected in the near future.
Embedded Recipes 2019 - Testing firmware the devops wayAnne Nicolas
ITRenew is selling recertified OCP servers under the Sesame brand, those servers come either with their original UEFI BIOS or with LinuxBoot. The LinuxBoot project is pushing the Linux kernel inside bios flash and using userland programs as bootloader.
To achieve quality on our software stack, as any project, we need to test it. Traditional BIOS are tested by hand, this is 2019 we need to do it automatically! We already presented the hardware setup behind the LinuxBoot CI, this talk will focus on the software.
We use u-root for our userland bootloader; this software is written in Go so we naturally choose to use Go for our testing too. We will present how we are using and extending the Go native test framework `go test` for testing embedded systems (serial console) and improving the report format for integration to a CI.
Julien Viard de Galbert
Composer is a dependency manager for PHP that allows projects to declare and install dependencies. It works by defining dependencies in a composer.json file and installing them into a vendor directory. This ensures all environments have identical dependency versions. Composer also handles autoloading so dependencies can be used immediately after including the vendor/autoload.php file. It is commonly used to manage library dependencies within a project and distribute PHP libraries to others via Packagist.
XCon 2014 => http://xcon.xfocus.org/
In the past was quite common to exploit heap / pool manager vulnerabilities attacking its internal linked structures. However current memory management improve a lot and at current date it is quite ineffective to attack heap in this way. But still those techniques come into hand when we start to looking at linked structures widespread throughout kernel that are unfortunately not hardened enough.
In this presentation we will examine power of these vulnerabilities by famous example “CVE – 2013 - 3660”. Showing bypass on ‘lazy’ assertions of _LIST_ENTRY, present exploitation after party and teleport to kernel.
Steelcon 2014 - Process Injection with Pythoninfodox
This is the slides to accompany the talk given by Darren Martyn at the Steelcon security conference in July 2014 about process injection using python.
Covers using Python to manipulate processes by injecting code on x86, x86_64, and ARMv7l platforms, and writing a stager that automatically detects what platform it is running on and intelligently decides which shellcode to inject, and via which method.
The Proof of Concept code is available at https://github.com/infodox/steelcon-python-injection
One Year of Porting - Post-mortem of two Linux/SteamOS launchesLeszek Godlewski
2013 was the year in which Linux finally got the attention of game developers; it was also the year in which my first two Linux/SteamOS ports were released. This talk will cover the learnings of one year of porting work from a programmer's point of view: DOs and DON'Ts and issues both expected and unexpected.
This document is a series of errata and clarifications from a previous talk on game development for Linux. It addresses shortcomings in SDL for threaded rendering and audio capabilities, and clarifies that OpenGL context sharing is possible in SDL2. It also recommends using SDL2's joystick and game controller APIs rather than low-level kernel interfaces. Placement of game files on Linux systems and XDG standard directories for configuration and user data are explained. The document concludes by thanking readers and suggesting that an upcoming game may also come to Linux.
Windows Kernel Exploitation : This Time Font hunt you down in 4 bytesPeter Hlavaty
The document discusses exploiting TrueType font (TTF) vulnerabilities to achieve kernel code execution on Windows systems. It begins by describing the discovery of exploitable bugs in a TTF fuzzer. Despite mitigations like KASLR, NX, SMAP, and CFG, the researchers were able to bypass these protections through techniques like controlled overflows, abusing plain kernel structures, and function-driven attacks. They show how to leverage wild overflows, control kernel memory layout, and hijack control flow to achieve arbitrary code execution. The document emphasizes that OS design weaknesses allow bypassing modern defenses through clever bug chaining and memory manipulation.
The Yocto Project is a collaborative open source project that provides prototypes, tools and methods that let you create personalized Linux-based systems for embedded products independent from the hardware architecture. The project was born in 2010 as a partnership of many different hardware manufacturers, open-source operative systems providers and electronic companies, to bring some order to the chaos that was the development of Linux Embedded. Why use Project Yocto? Because it's a development environment for Linux embedded complete with tools, meta-data and documentation - everything that one needs. The free of charge tools that Yocto makes available are powerful and easy to generate (included emulation environments, debuggers, a tool-kit to generate applications and others) and they let you create and continue projects, without causing you a loss of optimizations and investments made in the prototyping phase. Project Yocto supports the adoption of this technology by the open-source community letting users concentrate on the characteristics and development of their product.
Luca Ceresoli - Buildroot vs Yocto: Differences for Your Daily Joblinuxlab_conf
This document discusses the differences between Buildroot and Yocto/Bitbake for embedded Linux development. It begins by explaining that Buildroot and Yocto both use a dependency graph and actions to build each node, but are based on different underlying tools - Buildroot uses Kconfig and Make while Yocto uses Kconfig, Bitbake, and other OpenEmbedded tools. It also notes that Buildroot focuses on generating a root filesystem while Yocto focuses on generating packages and entire Linux distributions.
Kernel vulnerabilities was commonly used to obtain admin privileges, and main rule was to stay in kernel as small time as possible! But nowdays even when you get admin / root then current operating systems are sometimes too restrictive. And that made kernel exploitation nice vector for installing to kernel mode!
In this talk we will examine steps from CPL3 to CPL0, including some nice tricks, and we end up with developing kernel mode drivers.
Marco Cavallini @ LinuxLab 2018 : Workshop Yocto Project, an automatic genera...Marco Cavallini
This document provides information about a workshop on the Yocto Project being conducted by Marco Cavallini of KOAN. The workshop will cover setting up a Yocto Project build environment using Docker, basics of the Yocto Project including layers and recipes, debugging builds, and creating new images. Attendees will learn how to build a basic embedded Linux system from source and boot it in QEMU.
This document provides an overview and agenda for a presentation on Yocto, an open source project for embedded Linux development. It discusses Yocto components, layers, recipes, classes, and the build system. It also outlines how Yocto can be used by both system developers and application developers.
This document discusses vulnerability design patterns for kernel exploitation. It outlines several common vulnerability classes for the kernel including out of boundary errors, buffer overflows, and null pointer writes. It provides examples of how these vulnerabilities could be used to achieve kernel code execution or privilege escalation. It also notes how kernel exploitation techniques have evolved over time to bypass defenses like KASLR and discusses developing exploitation tools instead of just shellcode.
The document discusses various Linux system monitoring utilities including SAR, SADC/SADF, MPSTAT, VMSTAT, and TOP. SAR provides CPU, memory, I/O, network, and other system activity reports. SADC collects system data which SADF can then format and output. MPSTAT reports processor-level statistics. VMSTAT provides virtual memory statistics. TOP displays active tasks and system resources usage.
How to create your own Linux distribution (embedded-gothenburg)Dimitrios Platis
= Please note that the code in the slides may not be working
= Refer to the repository for working examples: https://github.com/platisd/meta-dimitriOS
Welcome to a beginner-friendly deep dive on how to create your own Linux distribution!
But why would you want to create one yourself?
** BACKGROUND **
Mainstream Linux distributions (e.g. Ubuntu, ArchLinux) enable their users to perform a plethora of tasks and often include the means for further customization of the system via a package manager, development tools, a desktop environment etc.
However, if you are creating a device that has a very specific set of use cases and needs to operate under strict constraints in regards to resources, power consumption, performance, or robustness, then using a full-fledged desktop operating system is infeasible. This is very common when developing embedded systems, meant to be used in an IoT application, the automotive or telecom industry, and so forth.
To create an Embedded Linux operating system, there are two paths you can follow:
1. Create a "golden image"; often the first choice when prototyping with a development board, e.g. a Raspberry Pi.
An off-the-shelf operating system, such as Debian, is hacked until it fits the purpose. Then clones of that "golden image" are created and installed in more devices.
This is good enough for creating a proof-of-concept but quickly falls short when the project becomes more complicated, larger, or the need to develop product variants arises.
2. Create a configuration-based distribution; the industry-proven way to create an Embedded Linux operating system.
Instead of maintaining the operating system as a big binary, its components are specified in version controllable configuration files. Setting everything up may require a steeper learning curve since things are not already conveniently in place. However, it is the only sustainable way to go forward when it comes to serious Embedded Linux development.
More on the topic: https://www.linuxjournal.com/content/linux-iot-development-adjusting-binary-os-yocto-project-workflow
** WORKSHOP **
In this workshop, we are going to demonstrate the "ingredients" needed to build your own Linux distribution using the Yocto project. Then we will run our distribution on a Raspberry Pi board.
Yocto is a collection of tools and processes enabling the creation of configurable Embedded Linux distributions. You define which components are to be included in your operating system with software- and hardware-specific configuration files. "Recipes" determine how these components are built and also what they depend upon. Finally, these recipes are utilized by "bitbake" (a tool offered by Yocto) to build your custom Linux image.
During the workshop, we will go over the setup needed to create a custom operating system for a typical IoT device. It boots up, automatically connects to the internet, and launches a C++ demon that fetches information from a cloud API.
This document discusses two solutions for automating the deployment of FreeBSD and PC-BSD systems. Solution 1 involves writing custom installation scripts and configuring networking by hand, while Solution 2 uses the pc-thinclient utility included with PC-BSD and TrueOS. The document then provides details on setting up and customizing automated installs using pc-thinclient, including installing packages and customizing user accounts. It concludes by discussing tips for improving scalability and speeding up installations.
The document discusses two solutions for automating the deployment of FreeBSD and PC-BSD systems. Solution 1 involves writing custom installation scripts and configuring networking by hand, while Solution 2 uses the pc-thinclient utility included with PC-BSD and TrueOS. The document then provides details on setting up and customizing automated installs using pc-thinclient, including installing packages and customizing user accounts. It also discusses scaling the solution and provides tips for optimizing install performance.
The document discusses two solutions for automating the deployment of FreeBSD and PC-BSD systems. Solution 1 involves writing custom installation scripts, while Solution 2 uses the pc-thinclient utility included with PC-BSD and TrueOS. The utility allows deploying diskless clients that PXE boot and connect to a server, simplifying management. Customizing the automated install process is covered, such as changing packages, user setup, and running commands. Tips for improved scalability and speeding up installations are also provided.
Advanced Eclipse Workshop (held at IPC2010 -spring edition-)Bastian Feder
This document provides an agenda for an Advanced Eclipse Workshop on June 30, 2010. It introduces the three presenters and provides an overview of topics to be covered, including Eclipse basics, shortcuts, templates, validators, PHP Tool Integration, Subversion, debugging with Xdebug, external tools, and building documentation. Hands-on exercises are included for preferences, debugging configuration, and debugging sessions. Contact information and licensing details are also provided.
Linux is a freely distributed implementation of a UNIX-like kernel developed by Linus Torvalds. The document discusses installation of Red Hat Enterprise Linux from DVD/CD, including language selection, partitioning, boot loader configuration, network configuration, package selection, and completion. It also covers file systems, including ext3, swap, RAID, and LVM, and the File System Hierarchy Standard.
Prizm Content Connect is a lightweight document viewer flash control that allows applications to display and interact with different file formats like Microsoft Office documents. It provides a universal viewing solution and acts as a document container for embedding documents in a custom form or webpage. The viewer is lightweight, flexible and allows integrating an end-to-end solution using Office or other native format documents in a custom solution.
Here are the permissions for the given files/directories:
drwxr-xr-x 2 root root 4096 Apr 16 11:48 dir1
-rw-r--r-- 1 root root 0 Apr 16 11:48 file1
1. cp file1 dir1/file2
- This would be allowed. You have r permission on file1 and w permission on dir1 to create file2.
2. rm file1
- This would not be allowed. You do not have w permission on the directory containing file1.
3. ln file1 link
- This would not be allowed. You do not have w permission on the current directory to create the link.
4
This document discusses some of the advantages and disadvantages of introducing Linux into systems that previously used Windows. It outlines higher stability, lower costs, and improved security as potential benefits of Linux. However, it also notes learning curves for users accustomed to Windows and potential compatibility issues. The document provides guidance on setting up a Linux development environment, including compilers, debuggers, version control through Subversion, and recommendations for hosting Subversion repositories. It encourages taking a cautious, business-driven approach to any transition.
How to make debian package from scratch (linux)Thierry Gayet
- The document discusses two methods for creating Debian packages: using dpkg-deb or dpkg-buildpackage.
- It provides step-by-step instructions for creating the package directory structure, metadata files, building and installing the package, and verifying installation.
- An alternative method using dh_make is also presented, which simplifies the process by automatically generating basic packaging files and directories.
This document provides instructions for installing Oracle 11g Release 2 on Fedora 14. It describes downloading and unpacking the required software, configuring kernel parameters and firewall settings, installing prerequisite packages, creating user groups and directories for the installation, and running the Oracle Universal Installer to complete the database installation. Post-installation steps involve restoring the original "/etc/redhat-release" file and setting the restart flag in "/etc/oratab".
This document provides instructions for installing Oracle 11g Release 2 on Fedora 14. It describes downloading and unpacking the required software, configuring kernel parameters and firewall settings, creating user groups and directories for the installation, and running the Oracle Universal Installer. Additional post-installation steps include restoring the original /etc/redhat-release file and setting the restart flag in /etc/oratab.
Setup of EDA tools and workstation environment variables in NCTU 307 Lab. wor...Michael Lee
This document discusses setting up the environment variables needed to use EDA tools on workstations in the NCTU 307 Lab. It describes the purpose and setup of key variables like $PATH, $LD_LIBRARY_PATH, $LM_LICENSE_FILE, and $DISPLAY. It also provides instructions for installing and configuring Xming to enable GUI applications on Windows and offers tips for debugging issues with variables or starting specific EDA tools like Cadence.
The document provides instructions for various post-installation configuration exercises on an Ubuntu system, including: getting accustomed to using sudo; creating a new user account called "inst"; learning how to install software; updating the software repository list; installing common development packages; learning how to control services; and configuring the X Window system.
This document outlines steps for implementing a continuous integration workflow including code driven development, automated testing environments, and continuous deployment. It discusses problems with current development processes and how continuous integration addresses these by merging code daily and enabling deployment every day. It then provides 14 steps for transitioning to this workflow, covering tools like Git, Bitbucket, Jenkins, Vagrant, and scripts for provisioning servers and deploying code between environments.
The document discusses how to install, configure and uninstall Linux operating systems, covering topics such as partitioning disks, installing software packages, setting up user accounts, basic and advanced command line instructions, and configuring hardware settings during the Linux installation process. It also provides instructions for removing Linux from a system by overwriting the master boot record with zeros using DD or DEBUG commands to restore the hard drive to a virgin state.
This document discusses IzPack, an open source installer builder for Java applications. It can create installers that work on multiple platforms from a single source. The document outlines how IzPack works, including using an XML descriptor to define installer resources, customizing installers with custom panels and actions, and packaging files and third party libraries. It provides an example of how IzPack was used to create the GlassFish application server installer. The document also discusses strategies for open source projects, including gaining users and community contributions to help a project mature.
Similar to Badge Hacking with Nerves Workshop - ElixirConf 2016 - Justin Schneck and Frank Hunleth (20)
Gas agency management system project report.pdfKamal Acharya
The project entitled "Gas Agency" is done to make the manual process easier by making it a computerized system for billing and maintaining stock. The Gas Agencies get the order request through phone calls or by personal from their customers and deliver the gas cylinders to their address based on their demand and previous delivery date. This process is made computerized and the customer's name, address and stock details are stored in a database. Based on this the billing for a customer is made simple and easier, since a customer order for gas can be accepted only after completing a certain period from the previous delivery. This can be calculated and billed easily through this. There are two types of delivery like domestic purpose use delivery and commercial purpose use delivery. The bill rate and capacity differs for both. This can be easily maintained and charged accordingly.
Software Engineering and Project Management - Software Testing + Agile Method...Prakhyath Rai
Software Testing: A Strategic Approach to Software Testing, Strategic Issues, Test Strategies for Conventional Software, Test Strategies for Object -Oriented Software, Validation Testing, System Testing, The Art of Debugging.
Agile Methodology: Before Agile – Waterfall, Agile Development.
Digital Twins Computer Networking Paper Presentation.pptxaryanpankaj78
A Digital Twin in computer networking is a virtual representation of a physical network, used to simulate, analyze, and optimize network performance and reliability. It leverages real-time data to enhance network management, predict issues, and improve decision-making processes.
Generative AI Use cases applications solutions and implementation.pdfmahaffeycheryld
Generative AI solutions encompass a range of capabilities from content creation to complex problem-solving across industries. Implementing generative AI involves identifying specific business needs, developing tailored AI models using techniques like GANs and VAEs, and integrating these models into existing workflows. Data quality and continuous model refinement are crucial for effective implementation. Businesses must also consider ethical implications and ensure transparency in AI decision-making. Generative AI's implementation aims to enhance efficiency, creativity, and innovation by leveraging autonomous generation and sophisticated learning algorithms to meet diverse business challenges.
https://www.leewayhertz.com/generative-ai-use-cases-and-applications/
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...IJECEIAES
Climate change's impact on the planet forced the United Nations and governments to promote green energies and electric transportation. The deployments of photovoltaic (PV) and electric vehicle (EV) systems gained stronger momentum due to their numerous advantages over fossil fuel types. The advantages go beyond sustainability to reach financial support and stability. The work in this paper introduces the hybrid system between PV and EV to support industrial and commercial plants. This paper covers the theoretical framework of the proposed hybrid system including the required equation to complete the cost analysis when PV and EV are present. In addition, the proposed design diagram which sets the priorities and requirements of the system is presented. The proposed approach allows setup to advance their power stability, especially during power outages. The presented information supports researchers and plant owners to complete the necessary analysis while promoting the deployment of clean energy. The result of a case study that represents a dairy milk farmer supports the theoretical works and highlights its advanced benefits to existing plants. The short return on investment of the proposed approach supports the paper's novelty approach for the sustainable electrical system. In addition, the proposed system allows for an isolated power setup without the need for a transmission line which enhances the safety of the electrical network
Null Bangalore | Pentesters Approach to AWS IAMDivyanshu
#Abstract:
- Learn more about the real-world methods for auditing AWS IAM (Identity and Access Management) as a pentester. So let us proceed with a brief discussion of IAM as well as some typical misconfigurations and their potential exploits in order to reinforce the understanding of IAM security best practices.
- Gain actionable insights into AWS IAM policies and roles, using hands on approach.
#Prerequisites:
- Basic understanding of AWS services and architecture
- Familiarity with cloud security concepts
- Experience using the AWS Management Console or AWS CLI.
- For hands on lab create account on [killercoda.com](https://killercoda.com/cloudsecurity-scenario/)
# Scenario Covered:
- Basics of IAM in AWS
- Implementing IAM Policies with Least Privilege to Manage S3 Bucket
- Objective: Create an S3 bucket with least privilege IAM policy and validate access.
- Steps:
- Create S3 bucket.
- Attach least privilege policy to IAM user.
- Validate access.
- Exploiting IAM PassRole Misconfiguration
-Allows a user to pass a specific IAM role to an AWS service (ec2), typically used for service access delegation. Then exploit PassRole Misconfiguration granting unauthorized access to sensitive resources.
- Objective: Demonstrate how a PassRole misconfiguration can grant unauthorized access.
- Steps:
- Allow user to pass IAM role to EC2.
- Exploit misconfiguration for unauthorized access.
- Access sensitive resources.
- Exploiting IAM AssumeRole Misconfiguration with Overly Permissive Role
- An overly permissive IAM role configuration can lead to privilege escalation by creating a role with administrative privileges and allow a user to assume this role.
- Objective: Show how overly permissive IAM roles can lead to privilege escalation.
- Steps:
- Create role with administrative privileges.
- Allow user to assume the role.
- Perform administrative actions.
- Differentiation between PassRole vs AssumeRole
Try at [killercoda.com](https://killercoda.com/cloudsecurity-scenario/)
Rainfall intensity duration frequency curve statistical analysis and modeling...bijceesjournal
Using data from 41 years in Patna’ India’ the study’s goal is to analyze the trends of how often it rains on a weekly, seasonal, and annual basis (1981−2020). First, utilizing the intensity-duration-frequency (IDF) curve and the relationship by statistically analyzing rainfall’ the historical rainfall data set for Patna’ India’ during a 41 year period (1981−2020), was evaluated for its quality. Changes in the hydrologic cycle as a result of increased greenhouse gas emissions are expected to induce variations in the intensity, length, and frequency of precipitation events. One strategy to lessen vulnerability is to quantify probable changes and adapt to them. Techniques such as log-normal, normal, and Gumbel are used (EV-I). Distributions were created with durations of 1, 2, 3, 6, and 24 h and return times of 2, 5, 10, 25, and 100 years. There were also mathematical correlations discovered between rainfall and recurrence interval.
Findings: Based on findings, the Gumbel approach produced the highest intensity values, whereas the other approaches produced values that were close to each other. The data indicates that 461.9 mm of rain fell during the monsoon season’s 301st week. However, it was found that the 29th week had the greatest average rainfall, 92.6 mm. With 952.6 mm on average, the monsoon season saw the highest rainfall. Calculations revealed that the yearly rainfall averaged 1171.1 mm. Using Weibull’s method, the study was subsequently expanded to examine rainfall distribution at different recurrence intervals of 2, 5, 10, and 25 years. Rainfall and recurrence interval mathematical correlations were also developed. Further regression analysis revealed that short wave irrigation, wind direction, wind speed, pressure, relative humidity, and temperature all had a substantial influence on rainfall.
Originality and value: The results of the rainfall IDF curves can provide useful information to policymakers in making appropriate decisions in managing and minimizing floods in the study area.
Discover the latest insights on Data Driven Maintenance with our comprehensive webinar presentation. Learn about traditional maintenance challenges, the right approach to utilizing data, and the benefits of adopting a Data Driven Maintenance strategy. Explore real-world examples, industry best practices, and innovative solutions like FMECA and the D3M model. This presentation, led by expert Jules Oudmans, is essential for asset owners looking to optimize their maintenance processes and leverage digital technologies for improved efficiency and performance. Download now to stay ahead in the evolving maintenance landscape.
Build the Next Generation of Apps with the Einstein 1 Platform.
Rejoignez Philippe Ozil pour une session de workshops qui vous guidera à travers les détails de la plateforme Einstein 1, l'importance des données pour la création d'applications d'intelligence artificielle et les différents outils et technologies que Salesforce propose pour vous apporter tous les bénéfices de l'IA.
Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...shadow0702a
This document serves as a comprehensive step-by-step guide on how to effectively use PyCharm for remote debugging of the Windows Subsystem for Linux (WSL) on a local Windows machine. It meticulously outlines several critical steps in the process, starting with the crucial task of enabling permissions, followed by the installation and configuration of WSL.
The guide then proceeds to explain how to set up the SSH service within the WSL environment, an integral part of the process. Alongside this, it also provides detailed instructions on how to modify the inbound rules of the Windows firewall to facilitate the process, ensuring that there are no connectivity issues that could potentially hinder the debugging process.
The document further emphasizes on the importance of checking the connection between the Windows and WSL environments, providing instructions on how to ensure that the connection is optimal and ready for remote debugging.
It also offers an in-depth guide on how to configure the WSL interpreter and files within the PyCharm environment. This is essential for ensuring that the debugging process is set up correctly and that the program can be run effectively within the WSL terminal.
Additionally, the document provides guidance on how to set up breakpoints for debugging, a fundamental aspect of the debugging process which allows the developer to stop the execution of their code at certain points and inspect their program at those stages.
Finally, the document concludes by providing a link to a reference blog. This blog offers additional information and guidance on configuring the remote Python interpreter in PyCharm, providing the reader with a well-rounded understanding of the process.
Advanced control scheme of doubly fed induction generator for wind turbine us...IJECEIAES
This paper describes a speed control device for generating electrical energy on an electricity network based on the doubly fed induction generator (DFIG) used for wind power conversion systems. At first, a double-fed induction generator model was constructed. A control law is formulated to govern the flow of energy between the stator of a DFIG and the energy network using three types of controllers: proportional integral (PI), sliding mode controller (SMC) and second order sliding mode controller (SOSMC). Their different results in terms of power reference tracking, reaction to unexpected speed fluctuations, sensitivity to perturbations, and resilience against machine parameter alterations are compared. MATLAB/Simulink was used to conduct the simulations for the preceding study. Multiple simulations have shown very satisfying results, and the investigations demonstrate the efficacy and power-enhancing capabilities of the suggested control system.
22. What’s in a Nerves system package?
▸ Elixir build infrastructure
▸ mix.exs – build the system image via mix
▸ nerves.exs – additional system image information such as
where to find pre-built system images
▸ Buildroot configuration
▸ nerves_defconfig – top level configuration options
▸ Custom package definitions
▸ Linux kernel configuration and patches
▸ Board-specific root file system additions
27. MIX FILE
defmodule MyApp.Mixfile do
…
def project do
[app: :my_app,
version: "0.1.0",
archives: [nerves_bootstrap: "~> 0.1"],
target: @target,
deps_path: "deps/#{@target}",
build_path: "_build/#{@target}",
aliases: aliases,
deps: deps ++ system(@target)]
end
end
New Projects
28. MIX FILE
defmodule MyApp.Mixfile do
…
def aliases do
["deps.precompile": ["nerves.precompile", "deps.precompile"],
"deps.loadpaths": ["deps.loadpaths", "nerves.loadpaths"]]
end
end
New Projects
31. Flash layout
Master Boot Record
Bootloaders
Root Filesystem A
Read-only
Root Filesystem B
Read-only
Application Data
Read-write
Linux kernel
Erlang
C libraries and apps
OTP release
App settings
Database
Logs
Other files
35. Host Tools
# copy and untar system and toolchain
$ export NERVES_SYSTEM=/path/to/uncompressed/system
$ export NERVES_TOOLCHAIN=/path/to/uncompressed/toolchain
Cached Nerves System and Nerves Toolchain
Since bandwidth is limited
Make sure you unset after the conference.
41. CONSOLE CABLE DRIVERS
Host Tools
Mac OS
Linux
https://www.adafruit.com/images/product-files/954/
PL2303_MacOSX_1_6_0_20151022.zip
"Everything just works on Linux"
~Frank Hunleth
53. LinkIt Smart 7688 Flash
▸ 32 MB NAND Flash
▸ Bootloader and Linux kernel stored here
▸ LinkIt bootloader doesn’t support FTL so don’t update
too many times
▸ Linux mtd driver provides access (/dev/mtdblock1, etc.)
▸ MicroSD card
▸ Root filesystems
▸ Application data
54. Typical Nerves Flash layout
Master Boot Record
Bootloaders
Root Filesystem A
Read-only
Root Filesystem B
Read-only
Application Data
Read-write
Linux kernel
Erlang
C libraries and apps
OTP release
App settings
Database
Logs
Other files
55. Flash layout
Master Boot Record
Root Filesystem A
Read-only
Root Filesystem B
Read-only
Application Data
Read-write
Erlang
C libraries and apps
OTP release
App settings
Database
Logs
Other files
Bootloader
Linux Kernel
57. The Console
▸ Black - Ground
▸ Red - 5v
▸ White(RX) - TX
▸ Green(TX) - RX
Don’t worry about accidentally swapping RX and TX. If nothing shows up on
the console, just swap them.
60. BURN BOOTLOADER
▸ Connect a 3.3V FTDI cable (GND, RX, and TX) to the LinkIt
Smart. Power up the LinkIt Smart and verify that you can
see text and type. You should be interacting with the
default OpenWRT firmware.
▸ Remove power from the LinkIt Smart
LinkIt Smart Prep
61. BURN BOOTLOADER
▸ Plug the USB Flash drive into the LinkIt Smart via the On-
the-go cable. Make sure that it's plugged into the USB
Host connector.
▸ Press the 'b' key repeatedly on the serial port while
rebooting the LinkIt Smart.
▸ Stop when you see that it is programming the Flash.
LinkIt Smart Prep
62. BURN LINUX KERNEL
▸ Press the '5' key repeatedly on the serial port while
rebooting the LinkIt Smart.
▸ Stop when you see that it is programming the Flash.
▸ Should be looking for rootfs on SD
LinkIt Smart Prep
81. ▸ Bootloader
▸ Some pins have to configured as early as possible
▸ Usually only deal with this on custom boards
▸ Linux kernel device tree
▸ Textual description of the hardware configuration
▸ Compiled down and loaded early in the Linux boot process
▸ Device tree overlays may be loaded after boot (but not
supported on the LinkIt Smart)
▸ Custom programs
Configuring pinmux’d processors
82. ▸ Device tree
▸ linux-4.4.14/arch/mips/boot/dts/ralink/LINKIT7688.dts
▸ Compiled to LINKIT7688.dtb
▸ Usermode app - pinmux
▸ https://github.com/nerves-project/nerves_system_linkit/
tree/develop/package/mtk-linkit
▸ Invoke on the Linkit Smart as:
LinkIt Smart pinmux configuration
/usr/bin/pinmux set ephy gpio
87. MIX FILE
defmodule BlinkyAle.Mixfile do
…
def application do
[mod: {BlinkyAle, []},
applications: [:logger, :elixir_ale]]
end
def deps do
[{:nerves, "~> 0.3.0"},
{:elixir_ale, "~> 0.5.6"}]
end
end
Blinky Elixir Ale
88. defmodule BlinkyAle do
use Application
# See http://elixir-lang.org/docs/stable/elixir/Application.html
# for more information on OTP Applications
def start(_type, _args) do
import Supervisor.Spec, warn: false
# Define workers and child supervisors to be supervised
children = [
worker(Task, [fn -> blink end], restart: :transient),
]
# See http://elixir-lang.org/docs/stable/elixir/Supervisor.html
# for other strategies and supported options
opts = [strategy: :one_for_one, name: BlinkyAle.Supervisor]
Supervisor.start_link(children, opts)
end
...
end
Blinky Elixir Ale
89. defmodule BlinkyAle do
...
def blink do
:os.cmd '/usr/bin/pinmux set ephy gpio'
{:ok, pid} = Gpio.start_link(43, :output)
blink_forever(pid)
end
def blink_forever(pid) do
Gpio.write(pid, 1)
:timer.sleep(1000)
Gpio.write(pid, 0)
:timer.sleep(1000)
blink_forever(pid)
end
end
Blinky Elixir Ale
96. Running on the Host
$ mix new blinky_firmata_host
https://github.com/mobileoverlord/blinky_firmata_host
Fast track
97. Running on the Host
defmodule BlinkyFirmataHost.Mixfile do
...
def application do
[applications: [:logger, :firmata],
mod: {BlinkyFirmataHost, []}]
end
defp deps do
[{:firmata, github: "mobileoverlord/firmata"}]
end
end
98. Running on the Host
defmodule BlinkyFirmataHost.Protocol do
use GenServer
use Firmata.Protocol.Mixin
alias Firmata.Board
def start_link(tty, opts []) do
GenServer.start_link(__MODULE__, [tty, opts], name: __MODULE__)
end
def init([tty, opts]) do
IO.puts "Init"
{:ok, board} = Board.start_link(tty, opts)
{:ok, %{
board: board
}}
end
...
end
99. Running on the Host
defmodule BlinkyFirmataHost.Protocol do
...
def handle_info({:firmata, {:pin_map, _pin_map}}, s) do
IO.puts "Set Pin Map"
Board.set_pin_mode(s.board, 13, @output)
send(self, {:blink, 1})
{:noreply, s}
end
def handle_info({:blink, state}, s) do
IO.puts "Blink"
Board.digital_write(s.board, 13, state)
state = if state == 1, do: 0, else: 1
Process.send_after(self, {:blink, state}, 1000)
{:noreply, s}
end
def handle_info(_, s) do
{:noreply, s}
end
end
100. Running on the Host
Interactive Elixir (1.3.2) - press Ctrl+C to exit (type h() ENTER for
help)
iex(1)> Nerves.UART.enumerate
%{"/dev/cu.Bluetooth-Incoming-Port" => %{}, "/dev/cu.MyQC-SPPDev" => %{},
"/dev/cu.MyQC-SPPDev-1" => %{},
"/dev/cu.usbmodem1421" => %{manufacturer: "MediaTek Labs", product_id:
43777,
vendor_id: 3725}}
101. Running on the Host
iex(2)> BlinkyFirmataHost.Protocol.start_link "/dev/cu.usbmodem1421"
Init
{:ok, #PID<0.156.0>}
Set Pin Map
Blink
105. Running on the Target
$ mix nerves.new blinky_firmata --target linkit
https://github.com/mobileoverlord/blinky_firmata
Fast track
106. Running on the Target
defmodule BlinkyFirmata.Mixfile do
...
def application do
[applications: [:logger, :firmata],
mod: {BlinkyFirmata, []}]
end
defp deps do
[{:nerves, "~> 0.3.0"},
{:firmata, github: "mobileoverlord/firmata"}]
end
end
107. Running on the Target
defmodule BlinkyFirmata.Protocol do
use GenServer
use Firmata.Protocol.Mixin
alias Firmata.Board
def start_link(tty, opts []) do
GenServer.start_link(__MODULE__, [tty, opts], name: __MODULE__)
end
def init([tty, opts]) do
IO.puts "Init"
{:ok, board} = Board.start_link(tty, opts)
{:ok, %{
board: board
}}
end
...
end
108. Running on the Target
defmodule BlinkyFirmata.Protocol do
...
def handle_info({:firmata, {:pin_map, _pin_map}}, s) do
IO.puts "Set Pin Map"
Board.set_pin_mode(s.board, 13, @output)
send(self, {:blink, 1})
{:noreply, s}
end
def handle_info({:blink, state}, s) do
IO.puts "Blink"
Board.digital_write(s.board, 13, state)
state = if state == 1, do: 0, else: 1
Process.send_after(self, {:blink, state}, 1000)
{:noreply, s}
end
def handle_info(_, s) do
{:noreply, s}
end
end
109. Running on the Target
defmodule BlinkyFirmata do
use Application
def start(_type, _args) do
import Supervisor.Spec, warn: false
# Define workers and child supervisors to be supervised
children = [
worker(BlinkyFirmata.Protocol, ["ttyS0"]),
]
# See http://elixir-lang.org/docs/stable/elixir/Supervisor.html
# for other strategies and supported options
opts = [strategy: :one_for_one, name: BlinkyFirmata.Supervisor]
Supervisor.start_link(children, opts)
end
end
110. Running on the Target
$ mix firmware
$ mix firmware.burn
123. Project Layout
# apps/badge_fw
$ mix deps.get
$ mix firmware
** (UndefinedFunctionError) function :relx.do/2 is undefined (module :relx is
not available)
If you are at the top of the umbrella
125. Initialization
# apps/badge_fw/mix.exs
def application do
[mod: {BadgeFw, []},
applications: [:logger, :badge_lib, :nerves_interim_wifi]]
end
def deps do
[{:nerves, "~> 0.3.0"},
{:nerves_interim_wifi, "~> 0.1"},
{:badge_lib, in_umbrella: true}]
end
# apps/badge_fw
$ mix deps.get
126. Initialization
# apps/badge_fw/lib/badge_fw.ex
defmodule BadgeFw do
use Application
alias Nerves.InterimWiFi, as: WiFi
def start(_type, _args) do
import Supervisor.Spec, warn: false
:os.cmd('modprobe mt7603e')
# Define workers and child supervisors to be supervised
children = [
worker(Task, [fn -> network end], restart: :transient),
]
# See http://elixir-lang.org/docs/stable/elixir/Supervisor.html
# for other strategies and supported options
opts = [strategy: :one_for_one, name: BadgeFw.Supervisor]
Supervisor.start_link(children, opts)
end
def network do
wlan_config = Application.get_env(:badge_fw, :wlan0)
WiFi.setup "wlan0", wlan_config
end
end
139. Arduino Firmata
defmodule BadgeLib.Firmata do
use GenServer
use Firmata.Protocol.Modes
alias Firmata.Board, as: Board
def start_link(opts []) do
port = opts[:port] || "ttyS0"
speed = opts[:speed] || 57600
serial_opts = [speed: speed]
GenServer.start_link(__MODULE__, [port, serial_opts], name: __MODULE__)
end
def init([port, serial_opts]) do
{:ok, board} = Board.start_link(port, serial_opts)
{:ok, %{
board: board
}}
end
...
end
140. Arduino Firmata
defmodule BadgeLib.Firmata do
...
def handle_info({:firmata, {:pin_map, _pin_map}}, s) do
{:noreply, s}
end
def handle_info(_, s) do
{:noreply, s}
end
end
141. Arduino Firmata
defmodule BadgeLib.Firmata do
use GenServer
use Firmata.Protocol.Modes
alias Firmata.Board, as: Board
@high 1
@low 0
@vibration_pin 9
def start_link(opts [])
def vibrate(state @high) do
GenServer.call(__MODULE__, {:vibrate, state})
end
...
end
142. Arduino Firmata
defmodule BadgeLib.Firmata do
...
def handle_call({:vibrate, state}, _from, s) do
Board.digital_write(s.board, @vibration_pin, state)
{:reply, :ok, s}
end
def handle_info({:firmata, {:pin_map, _pin_map}}, s) do
Board.set_pin_mode(s.board, @vibration_pin, @output)
{:noreply, s}
end
end
143. Running on the host
Firmata.begin(57600);
while (!Serial) {
;
}
144. Running on the host
Firmata.begin(57600);
while (!Serial) {
;
}
Interactive Elixir (1.3.2) - press Ctrl+C to exit (type h() ENTER for
help)
iex(1)> Nerves.UART.enumerate
%{"/dev/cu.Bluetooth-Incoming-Port" => %{}, "/dev/cu.MyQC-SPPDev" => %{},
"/dev/cu.MyQC-SPPDev-1" => %{},
"/dev/cu.usbmodem1421" => %{manufacturer: "MediaTek Labs", product_id:
43777,
vendor_id: 3725}}
147. Arduino Firmata
defmodule BadgeLib.Firmata do
...
@vibration_pulse 300
@vibration_times 7
def vibrate_pulse() do
GenServer.call(__MODULE__, :vibrate_pulse)
end
...
end
148. Arduino Firmata
defmodule BadgeLib.Firmata do
...
def handle_call(:vibrate_pulse, _from, s) do
send(self, {:vibrate_pulse, 0, 1})
{:reply, :ok, s}
end
def handle_info({:vibrate_pulse, @vibration_times, _},s) do
Board.digital_write(s.board, @vibration_pin, @low)
{:noreply, s}
end
def handle_info({:vibrate_pulse, times, state}, s) do
Board.digital_write(s.board, @vibration_pin, state)
state =
if state == 0, do: 1, else: 0
Process.send_after(self,
{:vibrate_pulse, times + 1, state}, @vibration_pulse)
{:noreply, s}
end
end
150. Arduino Firmata
defmodule BadgeLib.Firmata do
...
@display_clear 0x81
@display_text 0x82
@display_time 20_000
def text(message) do
GenServer.call(__MODULE__, {:text, message})
end
def clear() do
GenServer.call(__MODULE__, :clear)
end
...
end
151. Arduino Firmata
defmodule BadgeLib.Firmata do
...
def handle_call({:text, message}, _from, s) do
Board.sysex_write(s.board, @display_clear, "")
resp = Board.sysex_write(s.board, @display_text, message)
Process.send_after(self, :clear_display, @display_time)
{:reply, {:ok, resp}, s}
end
def handle_call(:clear, _from, s) do
resp = Board.sysex_write(s.board, @display_clear, "")
{:reply, {:ok, resp}, s}
end
def handle_info(:clear_display, s) do
Board.sysex_write(s.board, @display_clear, "")
{:noreply, s}
end
...
end
153. Arduino Firmata
defmodule BadgeFw do
use Application
alias Nerves.InterimWiFi, as: WiFi
def start(_type, _args) do
import Supervisor.Spec, warn: false
:os.cmd('modprobe mt7603e')
# Define workers and child supervisors to be supervised
children = [
worker(Task, [fn -> network end], restart: :transient),
worker(BadgeLib.Firmata, []),
]
# See http://elixir-lang.org/docs/stable/elixir/Supervisor.html
# for other strategies and supported options
opts = [strategy: :one_for_one, name: BadgeFw.Supervisor]
Supervisor.start_link(children, opts)
end
...
end
156. Connecting to Twitter
# badge_lib/mix.exs
def application do
[applications: [:logger, :firmata, :oauth, :extwitter]]
end
defp deps do
[{:firmata, github: "mobileoverlord/firmata"},
{:oauth, github: "tim/erlang-oauth"},
{:extwitter, "~> 0.6"}]
end
157. Connecting to Twitter
defmodule BadgeFw.Worker do
use GenServer
def start_link(opts []) do
GenServer.start_link(__MODULE__, [], opts)
end
def init([]) do
BadgeLib.Firmata.clear()
{:ok, %{}}
end
end
158. defmodule BadgeFw do
use Application
alias Nerves.InterimWiFi, as: WiFi
def start(_type, _args) do
import Supervisor.Spec, warn: false
:os.cmd('modprobe mt7603e')
# Define workers and child supervisors to be supervised
children = [
worker(Task, [fn -> network end], restart: :transient),
worker(BadgeLib.Firmata, []),
worker(BadgeFw.Worker, []),
]
# See http://elixir-lang.org/docs/stable/elixir/Supervisor.html
# for other strategies and supported options
opts = [strategy: :one_for_one, name: BadgeFw.Supervisor]
Supervisor.start_link(children, opts)
end
...
end
Connecting to Twitter
159. defmodule BadgeFw.Worker do
use GenServer
@hashtag "#NervesBadge"
@handle "@ElixirConf"
@interval 25_000
def init([]) do
BadgeLib.Firmata.clear()
Process.send_after(self, :update, @interval)
{:ok, %{last: {nil, nil}}}
end
end
Connecting to Twitter
160. def handle_info(:update, %{last: {lhash, luser}} = s) do
{hash, user} = {@handle, @hashtag}
new_hash = get_tweet(hash)
new_user = get_tweet(user)
last =
cond do
new_hash != lhash ->
display_tweet(new_hash)
{new_hash, luser}
new_user != luser ->
display_tweet(new_user)
{lhash, new_user}
true -> {lhash, luser}
end
Process.send_after(self, :update, @interval)
{:noreply, %{s | last: last}}
end
Connecting to Twitter
161. def get_tweet(search) do
case ExTwitter.search(search, [count: 1]) do
[tweet] -> tweet
_ -> nil
end
end
def display_tweet(tweet) do
IO.puts "display tweet"
BadgeLib.Utf8ToASCII.convert(tweet.text)
|> BadgeLib.Firmata.text
BadgeLib.Firmata.vibrate_pulse
end
Connecting to Twitter
162. defmodule BadgeLib.Utf8ToASCII do
def convert(string), do: convert(string, <<>>)
def convert(<<c::utf8, rest::binary>>, result) when c <= 127 do
convert(rest, result <> <<c::utf8>>)
end
def convert(<<_::utf8, rest::binary>>, result) do
convert(rest, result)
end
def convert(<<>>, result) do
result
end
end
Connecting to Twitter
179. Reasons to make your own system
▸ Add a library or application that can’t be built using mix
▸ Postgres
▸ Qt
▸ Add a Linux kernel module or patch the kernel
▸ WiFi drivers
▸ Audio, webcams, USB peripherals
▸ Patch or change the bootloader
▸ Enable a Busybox command
▸ Likely if you need to run a shell script
▸ Consider re-implementing in Elixir
180. Reasons NOT to make your own system
▸ Add files to the root filesystem
▸ These can be added via the rootfs-additions mechanism
▸ Change the iex terminal tty or alter how Erlang is started
▸ Create your own erlinit.config for your project
▸ Add or remove files from the firmware update files
▸ Create your own fwup.conf for your project
▸ Summary: Try to avoid modifying systems too much since it will
take away the benefits of working with the Elixir tools
181. Prereqs to working with systems
▸ Concepts
▸ Buildroot
▸ Linux kernel configuration
▸ Busybox
▸ Build and deploy requirements
▸ Linux (native, VM, or Docker)
▸ Someplace to put the system image since it’s too large
for hex.pm
182. Buildroot
▸ Toolchain, bootloader, kernel, root filesystem
builder for embedded Linux
▸ Cross-compiled
▸ Support for building ~1800 programs and
libraries
▸ Menu system for enabling and configuring packages
▸ Uses Makefiles, but not necessary to know make even to
add packages
▸ Very well documented
183. World views
▸ Buildroot normally is the top-level project that builds firmware
images
▸ Nerves uses Buildroot to produce the system images that later
get combined with OTP releases
▸ Consequences
▸ Erlang packages in Buildroot aren’t usable (no ejabberd)
▸ Nerves images are much smaller due to not including all (or
most) of OTP
▸ For most development, Nerves builds are faster and can be
run on OSX
184. Defconfigs and .configs
▸ Anything using Kconfig to manage configuration options uses
these (Linux, Buildroot, Busybox)
▸ .config
▸ Found in the root of the build directory for the project
▸ Has the values for ALL options – hidden, derived, etc.
▸ defconfig
▸ Subset of .config with only non-default options
▸ Usually stored in source control
▸ make savedefconfig
185. Activity: Start a system build
▸ Clone one of the official Nerves system images
▸ https://github.com/nerves-project/nerves_system_*
▸ Method 1 – official builds
▸ cd nerves_system_foo; mix deps.get; mix compile
▸ CTRL-C to stop (mix clean may be needed to start over)
▸ Method 2 – easier for development
▸ Clone https://github.com/nerves-project/nerves_system_br
▸ nerves_system_br/create-build.sh
nerves_system_foo/nerves_defconfig out
▸ cd out; make
186. Activity: Compile in a new package
▸ Go to the out directory from the last activity
▸ make menuconfig
▸ Find and enable postgresql
▸ Hint: Type the “/” key to search for postgresql. Press the number
▸ While you’re in menuconfig, take a look around
▸ Exit menuconfig. Be sure to save!
▸ Inspect .config and see that BR2_PACKAGE_POSTGRESQL is enabled
▸ make savedefconfig
▸ Inspect nerves_system_foo/nerves_defconfig has POSTGRESQL enabled
▸ Run make if you have time
187. The Linux kernel
▸ Why Linux? Best device driver support for embedded
▸ Nerves uses a trimmed down Linux kernel to keep
the image size reasonable
▸ Many device drivers compiled into the kernel so no
need to load them at initialization
▸ Some device drivers still compiled as modules
▸ Module parameters unknown until runtime
▸ Don’t work when compiled into the kernel
▸ More generic images
188. Activity: Enable a device driver
▸ Go to the out directory from before
▸ make linux-menuconfig
▸ Enable support for USB->serial adapters – called USB Modem (CDC
ACM) support in the kernel
▸ Use “/” to search for it if you’re not sure where it is
▸ Exit and save
▸ Inspect build/linux-x.y.z/.config to see that the option was saved
▸ make linux-savedefconfig
▸ Inspect build/linux-x.y.z/defconfig to verify the option again
▸ cp build/linux-x.y.z/defconfig to the Linux defconfig for the Nerves
system. This is usually called linux-x.y.defconfig
189. Busybox
▸ Provides tons of Unix apps in one small binary
▸ ls, sh, dd, ps, find, cat, tail, tar, cd, mkdir, etc.
▸ ntpd, dhcpc
▸ vi (sorry, no emacs)
▸ Ideally, Nerves would not have to use Busybox
▸ Wishlist: project that adds common shell commands to
the IEx shell and improves OS process inspection
▸ Removing Busybox is not trivial so it will be with us for a
while
190. Activity: Modify the Busybox config
▸ Go to the out directory from before
▸ make busybox-menuconfig
▸ Enable the ping utility, exit and save
▸ Verify that CONFIG_PING is enabled in build/busybox-1.x.y/.config
▸ If your system overrides the default busybox configuration, copy the new
one on top of it
▸ If not,
▸ Copy build/busybox-1.x.y/.config to ../busybox.config
▸ make menuconfig
▸ Set the Busybox configuration to ${NERVES_DEFCONFIG_DIR}/
busybox.config
▸ make savedefconfig
191. Using your custom Nerves system
▸ Go to the out directory from before
▸ export NERVES_SYSTEM=$PWD
▸ Now go to your Elixir project and run mix
192. Publishing a custom Nerves system
▸ What you’ll need
▸ Someplace to hold your nerves_system_xyz
▸ Someplace to hold the built tarball for the system
▸ GitHub supports both - attach the tarball to a release
▸ hex.pm only supports the source repository
194. Final steps
▸ Go back to your system’s out directory
▸ make system
▸ Publish the created tarball
▸ Publish the source on hex.pm or git
▸ Let everyone know to reference your Nerves system image
in their mix.exs
196. erlinit
▸ Replacement for /sbin/init that starts the Erlang virtual
machine
▸ Basic initialization of the Linux user land
▸ Loopback network connection
▸ Mounts /tmp, /proc, /sys
▸ Configures the tty
▸ Configuration stored in /etc/erlinit.conf
▸ Can be overridden by passing parameters to the Linux
kernel from the bootloader
197. erlinit debugging options
▸ --verbose
▸ --hang-on-exit
▸ Useful to capture error messages when the VM exits
▸ --run-on-exit /bin/sh
▸ Drop into a shell if the VM exits
▸ Exiting the shell reboots or hangs
▸ --warn-unused-tty
▸ erlinit will tell you what options to pass it to use the shell on
the terminal you’re looking at
198. erlinit features
▸ Mount filesystems
▸ Configure a unique hostname
▸ --hostname-pattern and --uniqueid-exec
▸ Nerves uses fhunleth/boardid to read serial numbers
▸ Wrap the launch of the Erlang VM in another program
▸ --alternate-exec
▸ Perform some custom system-specific initialization that can’t be
done in Erlang or Elixir
▸ Capture the terminal with dtach to route it to a GUI
▸ Run the Erlang VM as a regular user
199. erlinit pitfalls
▸ Running shell scripts to initialize the system
▸ Move initialization to Elixir to take advantage of OTP
supervision
▸ Currently no standard way of handing system
initialization in Nerves
▸ Assuming writable filesystems always can be mounted
▸ Failures happen – must be handled in Elixir
▸ erlinit can’t report errors so Elixir must check
201. fwup
▸ Firmware update packaging and application
▸ Packages
▸ Zip-formatted archives
▸ Metadata
▸ All data files protected by cryptographic
hashes
▸ Packages can be cryptographically signed
▸ Very simple scripts supported (lack of functionality is a
feature)
202. fwup processing
Master Boot Record
FAT Boot partition
Root Filesystem A
Read-only
Root Filesystem B
Read-only
Application Data
Read-write
rootfs.img
uImage
other files
on_init
on_finish
.fw file
fwup processing
1
2
3
4
5
203. Anatomy of a fwup.conf file
▸ Resources
▸ Files that are included as part of the zip archive
▸ Not required to be used when upgrading
▸ Tasks
▸ Instructions for applying updates
▸ Only one task is run at a time
▸ Tasks may have conditions for when they’re run
▸ Common task names: “complete” and “upgrade”
204. LinkIt Smart fwup.conf
# Let the rootfs have room to grow up to 64 MiB and align
# it to the nearest 1 MB boundary
define(ROOTFS_A_PART_OFFSET, 2048)
define(ROOTFS_A_PART_COUNT, 131072)
define(ROOTFS_B_PART_OFFSET, 133120)
define(ROOTFS_B_PART_COUNT, 131072)
# Application partition
# NOTE: Keep the total amount used under 1.78 GiB so that
# everything fits in the "2 GB" eMMC.
define(APP_PART_OFFSET, 264192)
define(APP_PART_COUNT, 1048576)
https://github.com/nerves-project/nerves_system_linkit/blob/develop/fwup.conf
207. LinkIt Smart fwup.conf
mbr mbr-a {
partition 0 {
block-offset = ${ROOTFS_A_PART_OFFSET}
block-count = ${ROOTFS_A_PART_COUNT}
type = 0x83 # Linux
}
partition 1 {
block-offset = ${APP_PART_OFFSET}
block-count = ${APP_PART_COUNT}
type = 0xc # FAT32
}
# partition 2 and 3 are unused
}
https://github.com/nerves-project/nerves_system_linkit/blob/develop/fwup.conf
208. LinkIt Smart fwup.conf
# This firmware task writes everything to the destination media
task complete {
on-init {
mbr_write(mbr-a)
}
on-resource rootfs.img {
# write to the first rootfs partition
raw_write(${ROOTFS_A_PART_OFFSET})
}
on-finish {
fat_mkfs(${APP_PART_OFFSET}, ${APP_PART_COUNT})
fat_setlabel(${APP_PART_OFFSET}, "APPDATA")
}
}
https://github.com/nerves-project/nerves_system_linkit/blob/develop/fwup.conf
209. LinkIt Smart fwup.conf
task upgrade.a {
# This task upgrades the A partition
require-partition-offset(0,
${ROOTFS_B_PART_OFFSET})
on-resource rootfs.img {
# write to the first rootfs partition
raw_write(${ROOTFS_A_PART_OFFSET})
}
on-finish {
# Switch over to boot the new rootfs
mbr_write(mbr-a)
}
}
https://github.com/nerves-project/nerves_system_linkit/blob/develop/fwup.conf
211. FAT filesystem commands
Command Description
fat_mkfs(block_offset, block_count) Create a FAT file system
fat_write(block_offset, filename) Write the resource to the file system
fat_mv(block_offset, oldname, newname) Rename a file
fat_rm(block_offset, filename) Delete a file
fat_mkdir(block_offset, filename) Create a directory
fat_touch(block_offset, filename) Create an empty file if the file doesn't exist