<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Ronaldo Nunez</title>
    <description>The latest articles on DEV Community by Ronaldo Nunez (@ronaldonunez).</description>
    <link>https://dev.to/ronaldonunez</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F373584%2F1fb00fc9-83d5-4ab5-9d9e-d17e9832a72d.jpg</url>
      <title>DEV Community: Ronaldo Nunez</title>
      <link>https://dev.to/ronaldonunez</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ronaldonunez"/>
    <language>en</language>
    <item>
      <title>Building Android for UDOO-NEO</title>
      <dc:creator>Ronaldo Nunez</dc:creator>
      <pubDate>Wed, 02 Dec 2020 00:59:44 +0000</pubDate>
      <link>https://dev.to/ronaldonunez/building-android-for-udoo-neo-3j82</link>
      <guid>https://dev.to/ronaldonunez/building-android-for-udoo-neo-3j82</guid>
      <description>&lt;p&gt;Embedded Android is a hot topic in embedded systems circles. Not due to the easiness of building it. In this article, I'll guide you on the building saga of Android Marshmallow, or simply Android M, for UDOO-NEO boards.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.udoo.org/udoo-neo/"&gt;UDOO-NEO&lt;/a&gt; is a low-cost development board with some nice support for Android. If you already tried to build Android from the scratch then you know that building it can be very tricky, that's especially true for old versions. For that reason, I decided to share with you a technique to build Android on modern Linux distributions.&lt;/p&gt;

&lt;p&gt;First of all, you gonna need a Linux distribution. Android's team suggests Ubuntu 14.04 to build Marshmallow version, mainly for the OpenJDK version available on its repositories, which is v7. It's not possible to use any newer version.&lt;/p&gt;

&lt;p&gt;You can use any Linux distribution you like or feel comfortable with, but keep in mind that you gonna need to install OpenJDK-7 anyway. Personally, I don't like to keep many versions of JDK in my machine, even &lt;code&gt;update-alternatives&lt;/code&gt; being a good tool to maintain many JVM/JDK versions in the host system.&lt;/p&gt;

&lt;p&gt;You doubtless don't want to install Ubuntu 14.04 on your machine, since it lacks support since 2019. You may say "ok, I can go with a VM", but, believe me, there is a faster and less disk/memory-hungry alternative: &lt;em&gt;Docker&lt;/em&gt;. &lt;em&gt;Docker&lt;/em&gt; containers can work over host's filesystem and can consume up to 90% less RAM, once the host shares most of its resources with containers.&lt;/p&gt;

&lt;p&gt;Instead of learning how to use &lt;em&gt;Docker&lt;/em&gt;, which may be a bit difficult, we'll use a tool called &lt;em&gt;rebuild&lt;/em&gt;, or &lt;em&gt;&lt;a href="http://rbld.io/"&gt;rbld&lt;/a&gt;&lt;/em&gt;. &lt;em&gt;Rebuild&lt;/em&gt; has a simple command interface to create containers for cross-compiling.&lt;/p&gt;

&lt;h1&gt;
  
  
  Installing rbld
&lt;/h1&gt;

&lt;p&gt;Before installing &lt;em&gt;rbld&lt;/em&gt;, you need to install &lt;em&gt;Docker&lt;/em&gt;, &lt;em&gt;gem&lt;/em&gt; and &lt;em&gt;Ruby&lt;/em&gt;. In &lt;em&gt;OpenSUSE&lt;/em&gt;, type the command below on the terminal:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# zypper install -y docker ruby ruby-devel
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add your user to &lt;code&gt;docker&lt;/code&gt; group (remember to logoff after running the command below):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ usermod -aG docker &amp;lt;username&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Finally, you're good to install &lt;em&gt;rbld&lt;/em&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# gem install rbld
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Building environment setup
&lt;/h1&gt;

&lt;p&gt;Using &lt;em&gt;rbld&lt;/em&gt; is very straight forward:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Usage:
  rbld help                Show this help screen
  rbld help COMMAND        Show help for COMMAND
  rbld COMMAND [PARAMS]    Run COMMAND with PARAMS

rebuild: Zero-dependency, reproducible build environments

Commands:

  checkout
  commit
  create
  deploy
  list
  load
  modify
  publish
  rm
  run
  save
  search
  status
  version
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We need to create an environment, for that use command &lt;code&gt;create&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ rbld create --base ubuntu:14.04 android-m
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, we need to provision the environment:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ rbld modify android-m -- "sudo apt-get update &amp;amp;&amp;amp; sudo apt-get install git-core gnupg flex bison build-essential zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z1-dev libgl1-mesa-dev libxml2-utils xsltproc unzip fontconfig python lzop bc u-boot-tools liblz4-dev vim uuid uuid-dev zip lzop gperf zlib1g-dev liblz-dev liblzo2-2 liblzo2-dev u-boot-tools lib32z1 flex git-core curl mtd-utils android-tools-fsutils"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Finally, is time to commit changes (yes, environments in &lt;em&gt;rbld&lt;/em&gt; are versioned):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ rbld commit --tag v1 android-m
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Cloning source-code
&lt;/h1&gt;

&lt;p&gt;Let's leave the environment setup aside for a moment and focus on collecting the code to build Android.&lt;/p&gt;

&lt;p&gt;In order to clone Android repos, you need to install &lt;code&gt;repo&lt;/code&gt; tool:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ cd ~
$ mkdir ~/bin
$ curl http://commondatastorage.googleapis.com/git-repo-downloads/repo &amp;gt; ~/bin/repo
$ chmod a+x ~/bin/repo
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, we can clone Android M repositories (be aware that may take several minutes):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ mkdir ~/bin ~/android-m
$ cd ~/android-m
$ ~/bin/repo init -u https://github.com/UDOOboard/android_udoo_platform_manifest -b android-6.0.1
$ ~/bin/repo sync -jN #N is the number of parallel jobs
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Building Android
&lt;/h1&gt;

&lt;p&gt;We have an environment and the code, then we're ready to build an Android image.&lt;br&gt;
Launch the environment we've created some sections before:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ rbld run android-m:v1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You'll notice that you're now inside our build environment. This environment is isolated from your host system but the host and the environment share the filesystem. You may be now at the root of Android's source code.&lt;br&gt;
Set ARCH environment variable, then source the envsetup.sh:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ export ARCH=arm
$ source build/envsetup.sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the Android build system, you can choose configurations among a list of options, to show up that list, simply type &lt;code&gt;lunch&lt;/code&gt; on the terminal.&lt;br&gt;
For UDOO-NEO we have two options:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;udooneo_6sx-eng&lt;/li&gt;
&lt;li&gt;udooneo_6sx-user
Eng version integrates some debug tools that are not available in user images. Let's build an eng version for now:
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ lunch udooneo_6sx-eng
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;OK, to build it type &lt;code&gt;m&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ m
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can check Android's build system commands with the command &lt;code&gt;hmm&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ hmm
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The build artifacts reside in &lt;code&gt;out/&lt;/code&gt; directory. You can use &lt;code&gt;make_sd.sh&lt;/code&gt; script to create an sd-card and boot up your new Android image on the board.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ cp make_sd.sh out/target/product/udooneo_6sx
$ cd out/target/product/udooneo_6sx
$ sudo -E ./make_sd.sh /dev/sdx
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Troubleshooting
&lt;/h1&gt;

&lt;h3&gt;
  
  
  arm-eabi-gcc: error: backports/drivers/net/wireless
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;arm-eabi-gcc: error: backports/drivers/net/wireless
/ti/wlcore/main.c: No such file or directory
arm-eabi-gcc: fatal error: no input files
compilation terminated.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Solution:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd kernel_imx/
make mrproper
cd ..
Make
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  make: *** No rule to make target ... liblz4-static_intermediates
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;make: *** No rule to make target `out/target/product/udooneo_6sx/obj/STATIC_LIBRARIES/liblz4-static_intermediates/export_includes', needed by `out/target/product/udooneo_6sx/obj/EXECUTABLES/updater_intermediates/import_includes'.  Stop.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Solution:&lt;/strong&gt;&lt;br&gt;
Include the lines below to &lt;code&gt;extenal/lz4/lib/android.mk&lt;/code&gt; and build again:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;include $(CLEAR_VARS)
LOCAL_MODULE := liblz4-static
LOCAL_SRC_FILES := $(liblz4_src_files)
LOCAL_MODULE_TAGS := optional
include $(BUILD_STATIC_LIBRARY)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  References
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.udoo.org/docs-neo/Advanced_Topics/Compile_Android_From_Source.html"&gt;https://www.udoo.org/docs-neo/Advanced_Topics/Compile_Android_From_Source.html&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://source.android.com/setup/build/initializing"&gt;https://source.android.com/setup/build/initializing&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.udoo.org/forum/threads/error-when-building-android-aosp.7946/"&gt;https://www.udoo.org/forum/threads/error-when-building-android-aosp.7946/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.udoo.org/forum/threads/how-i-can-compile-android-from-source-by-myself.4733/#post-20752"&gt;https://www.udoo.org/forum/threads/how-i-can-compile-android-from-source-by-myself.4733/#post-20752&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>android</category>
      <category>aosp</category>
      <category>udoo</category>
      <category>embedded</category>
    </item>
    <item>
      <title>Let's talk about documentation...</title>
      <dc:creator>Ronaldo Nunez</dc:creator>
      <pubDate>Thu, 22 Oct 2020 21:48:09 +0000</pubDate>
      <link>https://dev.to/ronaldonunez/let-s-talk-about-documentation-25ig</link>
      <guid>https://dev.to/ronaldonunez/let-s-talk-about-documentation-25ig</guid>
      <description>&lt;p&gt;Documentation is so important that no project should be considered as done without it. Well, at least it would be better if that affirmation was true all the time. Those who work on legacy projects understand what I said at the top of this paragraph.&lt;/p&gt;

&lt;p&gt;No rarely you'll find yourself working in complete darkness, looking for information and data from old projects, and finding absolutely nothing.&lt;/p&gt;

&lt;p&gt;That's the main reason I decided to share below some aspects that I consider important regarding project documentation as well as some tips and tricks making it easier to get started. Then you can make life easier for those that'll maintain the project that you're currently working on.&lt;/p&gt;

&lt;h2&gt;
  
  
  Documentation is all about future and collaboration
&lt;/h2&gt;

&lt;p&gt;When you write down things you're working on, you're collaborating with you, in the future. Believe me, some point in the future you or one of your teammates will need to know how the different modules of a project interact, or why you'd chosen a library/technology instead of another one. I understand that code should be clear enough to drop comments out, but code doesn't show the big picture for those reading it.&lt;/p&gt;

&lt;p&gt;For instance, imagine a scenario where you receive the task to implement a simple feature in an old system. So to get it started, you'll need to find its repository, the instructions to build it, a brief explanation of how it works, and about its architecture. You won't find that in code!&lt;br&gt;
That kind of information is also valuable for the newcomers in your company and for your mates too.&lt;br&gt;
It's a good idea to have a place (I mean a virtual one) where you and your colleagues can write down about you're working on - put everything there: repository URLs, build instructions, architecture diagrams, etc.&lt;/p&gt;

&lt;h2&gt;
  
  
  Documentation must be broadly accescible
&lt;/h2&gt;

&lt;p&gt;Word and PDF are not good documentation containers. Of course, that doesn't apply for delivery documentation or any other kind of static doc, as a release note, for instance. Even with all recent efforts of Microsoft and Adobe on improving them editor/reader apps, it's hard to find what you are looking for on them, and also they weren't originally designed with collaboration in mind. Moreover, those kinds of files are shared through e-mails or instant messengers, so only peers involved in the conversation can easily access them.&lt;br&gt;
Instead of docs and PDFs, prefer wiki or blog like tools. They usually provide versioning systems as well as embedded search engines, then it won't be hard to find old project docs and collaborate on them. Even bug/project tracking systems, as Jira or Bugzilla can help you and your team to keep track of project history and show you how you solved issues you'd faced during development.&lt;/p&gt;

&lt;h2&gt;
  
  
  README is your friend
&lt;/h2&gt;

&lt;p&gt;I know: code maintenance is hard, and documentation maintenance is even harder! For that reason, a readme file is a good idea. Since it's near to the source code, you'll find it easy to maintain it. Modern versioning system frontends can interpret markdown readmes, so it's easy to enrich them with pictures, diagrams, bullets, etc.&lt;br&gt;
Readme files can be a good start point, especially for coders. A good readme may contain a building howto, a description of the project, usage examples, and so on.&lt;br&gt;
  A diagram says more than a thousand words&lt;br&gt;
Need to show how modules talks to each other? Prefer a diagram to explain it. You'll save time for those that'll read it.&lt;br&gt;
Lazy about drawing them on an app? Do it on a whiteboard and take a picture. Mobile scanner apps may save some time drawing and can make them easy to read on collaboration tools.&lt;/p&gt;

&lt;p&gt;...&lt;/p&gt;

&lt;p&gt;I know that writing docs is boring and time-consuming, but it worth it. Keep in mind that people will work someday on what you're working on today, so they'll depend on what you left for consulting. Maybe code can describe itself, but projects no.&lt;br&gt;
All that I said may seem to be obvious for you but you can't imagine how many times I faced a lack of documentation in my career, which reinforces the importance to talk about it.&lt;/p&gt;

</description>
      <category>documentation</category>
      <category>newcoders</category>
      <category>embedded</category>
    </item>
  </channel>
</rss>
