The document discusses how to modify and customize the Android system for a custom device. It involves defining a new product in the build system, adding new components like libraries and drivers, writing JNI bindings to interface with native code from Java, and ensuring applications can access the custom framework.
Yocto Project Open Source Build System and Collaboration InitiativeMarcelo Sanz
A detailed introduction to the Yocto Project, an open source collaboration project that provides templates, tools and methods to help you create custom Linux-based systems for embedded products regardless of hardware architecture.
Yocto Project Open Source Build System and Collaboration InitiativeMarcelo Sanz
A detailed introduction to the Yocto Project, an open source collaboration project that provides templates, tools and methods to help you create custom Linux-based systems for embedded products regardless of hardware architecture.
Unit 6 Operating System TEIT Savitribai Phule Pune University by Tushar B KuteTushar B Kute
Recent And Future Trends In Os
Linux Kernel Module Programming, Embedded Operating Systems: Characteristics of Embedded Systems, Embedded Linux, and Application specific OS. Basic services of NACH Operating System.
Introduction to Service Oriented Operating System (SOOS), Introduction to Ubuntu EDGE OS.
Designed By : Tushar B Kute (http://tusharkute.com)
Kernel Recipes 2013 - Easy rootfs using BuildrootAnne Nicolas
The Linux kernel is an exciting world. But if you want to get a working system, it is still essential to provide our kernel a root filesystem. The kernel developers often struggle to find a simple rootfs, adapted to their architecture, together with the tools that fits properly.
We will present how Buildroot, a tool for building embedded Linux systems, can meet the needs of kernel developers in the build of minimal rootfs for their developments.
linux device drivers: Role of Device Drivers, Splitting The Kernel, Classes of
Devices and Modules, Security Issues, Version Numbering, Building and Running Modules
Kernel Modules Vs. Applications, Compiling and Loading, Kernel Symbol Table,
Preliminaries, Interaction and Shutdown, Module Parameters, Doing It in User Space.
Oplægget blev holdt ved et seminar i InfinIT-interessegruppen Højniveausprog til indlejrede systemer, der blev afholdt den 6. marts 2013. Læs mere om interessegruppen her: http://www.infinit.dk/dk/interessegrupper/hoejniveau_sprog_til_indlejrede_systemer/hoejniveau_sprog_til_indlejrede_systemer.htm
Tracing The Evolution Open Source & Embedded Systems - Mr. Jayakumar Balasubr...Lounge47
The last session traced the evolution of Open Source and its relevance to Embedded systems. It highlighted the most popular tools used by the Open Source community and shared some tips on how to build embedded devices through leveraging the power of this paradigm. The discussions also dealt with Intellectual property issues.
#OSSPARIS19 : Control your Embedded Linux remotely by using WebSockets - Gian...Paris Open Source Summit
Always wanted to control your IoT device without SSH'ing into it? In this talk we will show how WebSockets, MQTT and a set of custom go/js libraries can help in managing remotely your IoT device without knowing its IP address. Learn how you can use the Arduino Create Agent to easily deploy containers, remotely. A journey on Docker client, APT command line, sockets, systemd and much more on Arm and Intel Linux devices.
Unit 6 Operating System TEIT Savitribai Phule Pune University by Tushar B KuteTushar B Kute
Recent And Future Trends In Os
Linux Kernel Module Programming, Embedded Operating Systems: Characteristics of Embedded Systems, Embedded Linux, and Application specific OS. Basic services of NACH Operating System.
Introduction to Service Oriented Operating System (SOOS), Introduction to Ubuntu EDGE OS.
Designed By : Tushar B Kute (http://tusharkute.com)
Kernel Recipes 2013 - Easy rootfs using BuildrootAnne Nicolas
The Linux kernel is an exciting world. But if you want to get a working system, it is still essential to provide our kernel a root filesystem. The kernel developers often struggle to find a simple rootfs, adapted to their architecture, together with the tools that fits properly.
We will present how Buildroot, a tool for building embedded Linux systems, can meet the needs of kernel developers in the build of minimal rootfs for their developments.
linux device drivers: Role of Device Drivers, Splitting The Kernel, Classes of
Devices and Modules, Security Issues, Version Numbering, Building and Running Modules
Kernel Modules Vs. Applications, Compiling and Loading, Kernel Symbol Table,
Preliminaries, Interaction and Shutdown, Module Parameters, Doing It in User Space.
Oplægget blev holdt ved et seminar i InfinIT-interessegruppen Højniveausprog til indlejrede systemer, der blev afholdt den 6. marts 2013. Læs mere om interessegruppen her: http://www.infinit.dk/dk/interessegrupper/hoejniveau_sprog_til_indlejrede_systemer/hoejniveau_sprog_til_indlejrede_systemer.htm
Tracing The Evolution Open Source & Embedded Systems - Mr. Jayakumar Balasubr...Lounge47
The last session traced the evolution of Open Source and its relevance to Embedded systems. It highlighted the most popular tools used by the Open Source community and shared some tips on how to build embedded devices through leveraging the power of this paradigm. The discussions also dealt with Intellectual property issues.
#OSSPARIS19 : Control your Embedded Linux remotely by using WebSockets - Gian...Paris Open Source Summit
Always wanted to control your IoT device without SSH'ing into it? In this talk we will show how WebSockets, MQTT and a set of custom go/js libraries can help in managing remotely your IoT device without knowing its IP address. Learn how you can use the Arduino Create Agent to easily deploy containers, remotely. A journey on Docker client, APT command line, sockets, systemd and much more on Arm and Intel Linux devices.
#OSSPARIS19 : RIOT: towards open source, secure DevOps on microcontroller-bas...Paris Open Source Summit
La mise-à-jour de firmwares "Over-The-Air" sur microcontrôleur a toujours été un sujet ambitieux et pourtant primordial pour sécuriser une application IoT. Le système d'exploitation RIOT (https://riot-os.org) fournit désormais les briques logicielles pour réaliser des mise-à-jour de firmware en utilisant des protocoles standards et sécurisés de bout-en-bout.
#OSSPARIS19 : The evolving (IoT) security landscape - Gianluca Varisco, ArduinoParis Open Source Summit
IoT is at the peak of the hype cycle - what they call the 'Peak of Inflated Expectations’. The complexity of the cybersecurity landscape is at an all-time high, with security researchers, vendors and even governments all trying to come to a consensus for making the cyber-world a safer place. In this world of lightning-fast development cycles, it may intuitively feel like security gets left behind. The battle over standards is always a struggle. The unresolved problem of software updates and short vendor support cycle combined with the lack of effort into security makes these devices an easy target. Companies not only need to update their technology stack for the evolving security landscape but also their mindset, processes and culture. This talk will shine a light on some of the challenges that today’s executives face in finding and fixing systemic problems in and outside of security through people, tools and understanding.
#OSSPARIS19: Construire des applications IoT "secure-by-design" - Thomas Gaza...Paris Open Source Summit
"Cette présentation a pour but de présenter MirageOS et ses applications à l'écriture d'applications IoT sécurées. En particulier, MirageOS permet de développer des applications d'infrastructure réseau --- firewalls, proxy VPN, serveurs d'emails, etc. --- qui peuvent être déployées sur des processeurs embarqués de type ARMv8, ESP32 ou RISC-V. Nous expliquerons comment nous nous appuierons sur cette couche d'infrastructure entièrement open-source pour développer OSMOSE, une plateforme sécurisée et décentralisée permettant de construire des application IoT centrées sur l'utilisateur et le respect de sa vie privée.
"
#OSSPARIS19 : Detecter des anomalies de séries temporelles à la volée avec Wa...Paris Open Source Summit
WarpScript est un langage de programmation open source conçu pour facilement requêter, manipuler et traiter des données de séries temporelles à la volée. Bien qu'il soit compatible nativement avec Warp 10, WarpScript peut aussi être connecté à d'autre sources de données. Dans cette présentation, nous allons détecter des anomalies à la volée en utilisant des fonctions WarpScript et répondre aux questions suivantes. Que doit-on définir comme une anomalie ? Quel algorithme correspond au type d'anomalie que l'on cherche à détecter ? Comment prendre en compte la possible saisonnalité de mes données ?
#OSSPARIS19 : Comment ONLYOFFICE aide à organiser les travaux de recherches ...Paris Open Source Summit
ONLYOFFICE développée par Ascensio System SIA, est une suite bureautique open-source basée sur l'élément Canvas de HTML5, qui offre une gamme complète d’outils d’édition en ligne des documents texte, feuilles de calcul et présentations.
Cette présentation commence par l’aperçu des principes de base :
- support de tous les formats courants,
- riche éventail d’outils de la mise en forme,
- affichage du contenu de manière identique, quel que soit le navigateur utilisé,
- ressources permettant d’étendre les fonctionnalités des éditeurs,
- capacités avancées de co-édition,
- transfert de données sécurisé en temps réel.
Le nombre des universités et des écoles qui optent pour les alternatives open source aux solutions populaires offertes par les grandes marques, augmente chaque année. Les solutions de ONLYOFFICE sont actuellement utilisées par plus de 30 établissements d’enseignement en France tels que treize Universités de la Sorbonne, l’Université de Grenoble, l’Université de Nantes, l’École Nationale d'Ingénieurs de Brest, le l'établissement public Campus Condorcet, etc.
Dans cette partie, Jeremy Maton, l’Administrateur Systèmes et Réseaux à l’Institut de Biologie de Lille, va présenter comment ONLYOFFICE est intégrée au sein de leur unité de recherches et aide à organiser le flux de travail.
#OSSPARIS19 - Understanding Open Source Governance - Gilles Gravier, Wipro Li...Paris Open Source Summit
Stratégie, risques liés à l'adoption de l'open source... Comment un modèle de gouvernance fort peut rendre votre parcours open source le plus efficace.
#OSSPARIS19 : Publier du code Open Source dans une banque : Mission impossibl...Paris Open Source Summit
Dans une banque vieille de 200 ans, il ne parait pas forcément évident au premier abord de convaincre d’une démarche Open Source. Et pourtant, nous l’avons fait !
Dans cette conférence, nous vous expliquerons comment l’idée de publier du code Open Source est née, quels sont les leviers et opportunités que nous avons actionnés pour convaincre nos différentes directions. Nous expliquerons également les difficultés rencontrées et les choix retenus.
Si vous aussi, vous êtes dans une banque, une assurance ou encore un groupe industriel, et que vous cherchez des clés pour initier une démarche Open Source, alors venez nous voir !
#OSSPARIS19 - Tuto de première installation de VITAM, un système d'archivage ...Paris Open Source Summit
#Business #Apps - Track - Gestion documentaire et collaboration
VITAM est une solution d'archivage open source utilisée pour des volumes élevés jusqu'à des milliards de documents. C'est un système distribué qui peut être implémenté aussi bien sur du bare metal que du cloud OpenStack, utilisant de 3 à plus de 100 VM.
Il est conçu pour être efficace et très facile à administrer. Les principales opérations techniques sont entièrement automatisées.
Cette présentation vous donnera les principales informations sur l'architecture VITAM, la façon de l'installer sur votre infrastructure et les pièges classiques à éviter. Elle vous permettra aussi de rencontrer des techniciens impliqués dans le développement de VITAM.
#OSSPARIS19 - Tuto de première installation de VITAM, un système d'archivage ...
OWF12/PAUG Conf Days Android system development, maxime ripard, free electrons
1. OpenWorld Forum 2012
Android System Free Electrons
Development Embedded Linux
Developers
Maxime Ripard
Free Electrons
maxime.ripard@free-
electrons.com
Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http://free-electrons.com 1/25
2. Maxime Ripard
Embedded Linux engineer and trainer at Free Electrons since
2011
Embedded Linux development: kernel and driver development,
system integration, boot time and power consumption
optimization, consulting, etc.
Embedded Linux training, Linux driver development training
and Android system development training, with materials
freely available under a Creative Commons license.
http://www.free-electrons.com
Contributor to various open-source projects: Barebox, Linux,
Buildroot
Living in Toulouse, south west of France
Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http://free-electrons.com 2/25
3. Why Modify Android ?
Because we have a custom set of functions on a given device
that isn’t handled by the vanilla Android
Because we want to add a different UI/set of features than
AOSP
Because since we have access to the source code, we can!
Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http://free-electrons.com 3/25
4. The Android Stack
Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http://free-electrons.com 4/25
5. Devices in the Source Tree
The build system is using a configuration mechanism based on
various layer of hardware design
The upper layer, the product is typically the one we want to
build a system for
The build system has no other configuration mechanism: no
Kconfig, text file, or any other mecanism that can be easily
modified
Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http://free-electrons.com 5/25
6. Product, devices and boards
Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http://free-electrons.com 6/25
7. Defining new products
Devices are well supported by the Android build system. It
allows to build multiple devices with the same source tree, to
have a per-device configuration, etc.
All the product definitions should be put in
device/<company>/<device>
The entry point is the AndroidProducts.mk file, which
should define the PRODUCT_MAKEFILES variable
This variable defines where the actual product definitions are
located.
It follows such an architecture because you can have several
products using the same device
If you want your product to appear in the lunch menu, you
need to create a vendorsetup.sh file in the device
directory, with the right calls to add_lunch_combo
Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http://free-electrons.com 7/25
8. Our New Product
AndroidProducts.mk
PRODUCT_MAKEFILES +=
$(LOCAL_DIR)/full_product.mk
full_product.mk
$(call inherit-product, build/target/product/generic.mk)
PRODUCT_NAME := full_MyDevice
PRODUCT_DEVICE := MyDevice
PRODUCT_MODEL := Full flavor of My Brand New Device
vendorsetup.sh
add_lunch_combo full_product-eng
Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http://free-electrons.com 8/25
9. Add a New Component
The integration of new components into the build system are
done through Android.mk files
These files just contains where the source code is and what
the expected result should be: an executable, a shared library,
a jar file, etc.
All the build magic is abstracted by the build system
Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http://free-electrons.com 9/25
10. Add a New Library
Create a new subfolder under the
device/company/product/lib folder
This folder will contain the source code in itself, plus the
headers and the Android.mk file
To include a new package into a given build, you need to add
the package name to the content of the PRODUCT_PACKAGES
variable
Let’s use the libusb as an example
Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http://free-electrons.com 10/25
11. Steps to add the libusb
The first step is obviously to untar the source code in the
device/company/product/lib/libusb folder
Since the Android build system doesn’t rely at all on external
build tools, we have some bits that are missing
The first one is that the source code is missing the config.h
header file, that is usually generated with the autoconf tool,
through the ./configure command
When we try to compile, it lacks two things: the
TIMESPEC_TO_TIMEVAL macro and the timerfd.h header
The first one should be declared by the c library, let’s add the
macro declaration where the source code is using it
The timerfd.h file is one of the header exposed by the Linux
Kernel. It is not in the headers found in the toolchain used by
Android though, so we will need to disable the use of such
feature through the command
./configure --disable-timerfd
Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http://free-electrons.com 11/25
12. Library Makefile
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES :=
core.c
descriptor.c
io.c
sync.c
os/linux_usbfs.c
LOCAL_C_INCLUDES +=
$(LOCAL_PATH)/os
LOCAL_MODULE:= libusb
LOCAL_MODULE_TAGS:= optional
LOCAL_PRELINK_MODULE:= false
include $(BUILD_SHARED_LIBRARY)
Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http://free-electrons.com 12/25
13. Next steps
The libusb uses the device files under the folder
/dev/bus/usb, that are only readable by the root user and
the usb group.
The device files creations are handled by the init application,
so that when a new device appears on the system, its
associated device files will be created as well
The specific part of init that handles these files is called
ueventd
It uses a set of rules to create device files with the correct
permissions at runtime
If we want to use a binary running as user and that has access
to the USB devices, we’ll have to modify these permissions
Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http://free-electrons.com 13/25
14. Modify the permissions of the device files
Permissions on the files are the enforced thanks to two
components:
Permissions on files on the system are defined in a C header:
android_filesystem_config.h
Permissions for device files are handled by ueventd that uses a
file called ueventd.rc
We can modify the permissions on the device files by adding
or modifying a ueventd.rc file
/dev/bus/usb/* 0666 root usb
Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http://free-electrons.com 14/25
15. Integrate a binary that uses the libusb
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES:= usb_bin.c
LOCAL_C_INCLUDES +=
$(JNI_H_INCLUDE)
device/company/device/lib/libusb
LOCAL_SHARED_LIBRARIES := libusb
LOCAL_MODULE := usbbin
LOCAL_MODULE_TAGS := optional
LOCAL_PRELINK_MODULE := false
include $(BUILD_EXECUTABLE)
Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http://free-electrons.com 15/25
16. JNI Bindings
A Java framework to call and be called by native applications
written in other languages
Mostly used for:
Writing Java bindings to C/C++ libraries
Accessing platform-specific features
Writing high-performance sections
It is used extensively across the Android userspace to interface
between the Java Framework and the native daemons
Since Gingerbread, you can develop apps in a purely native
way, possibly calling Java methods through JNI
Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http://free-electrons.com 16/25
17. Libusb bindings
Create a new subfolder under
device/company/device/framework/USBFramework/jni
Write the JNI bindings so that the Java can call functions
from the libusb
Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http://free-electrons.com 17/25
18. Libusb bindings
static struct libusb_device_handle *devh;
JNIEXPORT void JNICALL Java_com_fe_USB_init(JNIEnv *env,
jobject obj)
{
ret = libusb_init(NULL);
if (ret < 0)
return ret;
devh = libusb_open_device_with_vid_pid(NULL,
0xdead,
0xbeef);
if (!devh) {
libusb_exit(NULL);
return -EINVAL;
}
return 0;
}
Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http://free-electrons.com 18/25
19. Android.mk for the bindings
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES:=
usb_jni.c
LOCAL_C_INCLUDES +=
$(JNI_H_INCLUDE)
device/company/device/lib/libusb
LOCAL_SHARED_LIBRARIES :=
libusb
LOCAL_MODULE := libusb_jni
LOCAL_MODULE_TAGS := optional
LOCAL_PRELINK_MODULE := false
include $(BUILD_SHARED_LIBRARY)
Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http://free-electrons.com 19/25
20. Java Framework
package com.fe;
class USB {
private native void init();
public USB() {
init();
}
static {
System.loadLibrary("usb_jni");
}
}
Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http://free-electrons.com 20/25
21. Android.mk for the framework
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES :=
$(call all-subdir-java-files)
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE:= com.fe.usb
include $(BUILD_JAVA_LIBRARY)
Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http://free-electrons.com 21/25
22. Permissions file
<?xml version="1.0" encoding="utf-8"?>
<permissions>
<library name="com.fe.usb"
file="/system/framework/com.fe.usb.jar"/>
</permissions>
Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http://free-electrons.com 22/25
23. Applications using that code
Any applications can now use the part of the framework we
just added, using a regular Java call
However, by default, the jar file generated won’t be loaded by
dalvik, resulting in a error at runtime.
You need to add extra bits to the manifest file so that both
the Play Store and Dalvik knows that you need the given jar
file to work properly
You need to add the <uses-library> XML tag
Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http://free-electrons.com 23/25
24. Android Manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.fe.usb">
<application
android:icon="@drawable/icon"
android:label="@string/app_name">
...
<uses-library android:name="com.fe.usb"
android:required="true" />
</application>
</manifest>
Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http://free-electrons.com 24/25
25. Questions?
Maxime Ripard
maxime.ripard@free-electrons.com
Slides under CC-BY-SA 3.0.
Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http://free-electrons.com 25/25