http://wiki.openmoko.org/api.php?action=feedcontributions&user=Bryce.Leo&feedformat=atomOpenmoko - User contributions [en]2024-03-29T02:28:26ZUser contributionsMediaWiki 1.19.24http://wiki.openmoko.org/wiki/Main_PageMain Page2007-08-13T03:26:51Z<p>Bryce.Leo: /* Hands-on Guides */</p>
<hr />
<div>{{Languages|Main_Page}}<br />
<big>'''Welcome to the [[OpenMoko]] public Wiki'''</big><br><br />
<br />
[[Image:FIC-neo1973_small.jpg|200px|right|frontside]]<br />
OpenMoko is an [http://en.wikipedia.org/wiki/Open_source Open Source] project to create the world's first free mobile phone operating system.<br />
<br />
The [[OpenMoko]] project is a community that anyone can join, to help design their ideal phone.<br />
<br />
Eventually, phone software won't be tied to any particular phone.<br />
<br />
You can install any OpenMoko software over the whole range of [[Supported Hardware|supported phones]], and if you upgrade your phone, you don't lose that software. Bugs fixed on any phone are fixed on all. <br />
<br />
'''Currently it is not suitable for users.''' The state of the software at the moment is pre-alpha. If you order a Neo1973, DO NOT expect to be able to use it as an everyday phone for several months.<br />
<br />
The [[Neo1973]] from [[FIC]] is the first of many phones that OpenMoko will run on. Buy it at [https://direct.openmoko.com/ Openmoko Online Shop] (currently [http://jouston.no-ip.com/archives/000230.html out of stock]). You may wish to see the [[SH1 FAQ|Shipment 1 FAQ]].<br />
<br />
Please join us in collaborating on the OpenMoko project through any of the [[Development resources | project resources]] including this OpenMoko wiki. Please see the [[Help:Contents | wiki editing help]] page for information on making contributions to this wiki. A [[Meet the Core Team | core team]] of developers funded by FIC, Inc. leads the project.<br />
<br />
An [[introduction]] page is available, with [[Introduction#Photos|photos]] and [[Introduction#Videos|videos]]. Moreover, the usual [[FAQ | Frequently Asked Questions]] (FAQ) page might be helpful. Developers may find the [[ChangeLog | change log]] an important resource.<br />
<br />
Update 2007-07-25: The [http://forums.makeopensource.com/ Unofficial OpenMoko Forums] are now open! Everyone is invited to participate!<br />
<br />
<br />
The members of the OpenMoko community would like to thank FIC Inc. for showing leadership and initiating the OpenMoko project.<br />
<br />
== OpenMoko Areas of Interest ==<br />
* [[Basic End-user]] - Information for end users who want basic functionality and no surprises<br />
* [[Advanced End-user]] - Information for advanced end-users who want advanced and experimental functionality but who are not programmers<br />
* [[Development resources | Project Resources]] - Provides a centralized location of all resources such as [[Development resources#Mailing_Lists|mailing lists]], [[Development resources#IRC | communication tools]], and other software development oriented resources.<br />
* [[Application Developer]] - Information for application developers, including ideas and specifications for applications, and tools to build them<br />
* [[System Developer]] - Information for system developers, including bootloader, kernel, and libraries<br />
* [[Hardware Developer]] - Information for hardware developers, including hardware specs and debug board<br />
* [[Current events]] - Information on both past and future events where FIC or OpenMoko had or will have a presence.<br />
* [http://forums.makeopensource.com/ Unofficial OpenMoko Forums] - Everyone is invited to collaborate with OpenMoko users and developers on the forums.<br />
* Most of the documentation and Wiki assumes you are using Linux; here are some notes for users of [[Other OSes]].<br />
<br />
== Developer's Documentation ==<br />
<br />
=== Hands-on Guides ===<br />
* [[Getting Started with your Neo1973]]<br />
* [[MokoMakefile|Building OpenMoko using the MokoMakefile]]<br />
* [[Application Development Crash Course]] -A very basic how-to for the new people. <br />
* [[OpenMoko2007.2|Building OpenMoko 2007.2]]<br />
* [[Building OpenMoko from scratch]]<br />
** [[Building a hello world application]]<br />
** Old [[Building OpenMoko from scratch (pre-BBT)]]<br />
* [[Migration to bad block tolerant builds]]<br />
* [[Running OpenMoko on PC]]<br />
** [[Getting OpenMoko working on host with Xoo]]<br />
** [[Getting OpenMoko working on host with Xephyr]]<br />
** [[How to run OpenMoko Apps on PC]]<br />
** [[OpenMoko under QEMU]]<br />
** [[Test Openmoko Emulation with chroot image|Test Openmoko Emulation with a Prebuilt chroot Image]]<br />
* [[Booting from SD]]<br />
<br />
=== Hardware Reference Documentation ===<br />
* All [[:Category:Hardware|Hardware]] related documentation and specifications are found on the [[:Category:Hardware|Hardware page]].<br />
* The [[Neo1973 Hardware]] page provides an overview of the hardware components used by the [[:Category:Neo1973 Hardware|Neo1973 hardware platform]]. PCB photographs are also included. A [[Disassembling Neo1973 | photo disassembly story]] may be an interesting starting place.<br />
* [[:Category:Neo1973 Hardware Debugging | Neo1973 Hardware Debugging]] is assisted with the [[Debug Board | Neo1973 debug board]]. A page discussing [[Connecting Neo1973 with Debug Board v2 | debug board and Neo1973 configurations]] is also provided.<br />
<br />
=== Software Reference Documentation ===<br />
* Architectural<br />
** [[OpenMokoFramework]] - The OpenMoko Application Framework<br />
* [[Neo1973 host software]]<br />
* Device Software<br />
** Low-Level<br />
*** [[u-boot]] - The bootloader we use, including documentation for our modifications<br />
*** [[kernel]] - The Linux kernel we use, including documentation for our modifications<br />
** Userspace<br />
*** [[binary compatibility]]<br />
*** [[gsmd]] - the GSM daemon managing the GSM Modem<br />
*** [[gpsd]] - the AGPS (Assisted GPS) daemon<br />
<br />
=== OpenMoko ===<br />
* [[OpenEmbedded]] - The distribution-building framework<br />
* [[Toolchain]] - The toolchain we use for compilation<br />
* [[OpenMoko]] - The OpenMoko distribution<br />
** [[OpenMoko2007]] - The first intended release of it<br />
** [[OpenMoko2007.2]] - An improved release with more formalized style guidelines.<br />
** [[Userspace root image]]<br />
<br />
==== User Interface Related ====<br />
* [[Look & Feel]]<br />
** [[Artwork]]<br />
* [[Applications]]<br />
* [[Widgets]]<br />
** [[Widget Inheritance Graph]]<br />
* [[Application UI Design Recommendations]]<br />
<br />
=== Misc. Development Related ===<br />
* [[Freshman todo]]<br />
* [[Templates]]<br />
* [[PIM Storage]]<br />
* [[Coding Guidelines]]<br />
* [[OpenMoko#Setting_up_an_OpenMoko_SDK|How to setup the OpenMoko SDK]]<br />
* Alternative distributions for [[Neo1973]] GTA01: [[Angstrom on Neo1973]], [http://pokylinux.org Poky] (instructions needed!)<br />
* [[License]] - How we license our code<br />
* [[Development resources]] - Describes resources for developers (lists, svn, ...)<br />
* [[Neo1973 Phase 0]] - Information for Phase 0 device owners<br />
* [[Wishlist:Neo1973 P0 Review]] - Impressions of the Phase 0 hardware device, also the Phase 0 FAQ<br />
* [[Neo1973 Phase 1]] - Information for Phase 1 device owners<br />
* [[Wishlist:Neo1973 P1 Review]] - Impressions of the Phase 1 hardware device<br />
* [[External Feeds]] - List of feeds from people blogging about OpenMoko<br />
<br />
== Administrative / Organizational ==<br />
<br />
* [[Shipping Notes]] - Information to help FIC figure out how to ship products to you, and how much it might cost.<br />
* [[My Account]] - Ideas for what sort of account-based services FIC should provide with the phone.<br />
* [[Hear Me FIC]] - Information to help FIC know what the community wants.<br />
* [[Listen Up Community]] - Community's To-Do-List<br />
* [[Wiki Issues]] - problems/requests regarding this Wiki<br />
<br />
== Miscellaneous ==<br />
* [[WiFi support in OpenMoko]]<br />
* [[Neo1973 and Windows]] - If you want to commit that offence ;) (does not work, help!)<br />
* [[Press Coverage]] - What the press says about the OpenMoko project<br />
* [[mFAQ]] - The OpenMoko Misinformation FAQ ('''mFAQ''') - What the press '''''incorrectly''''' says about the OpenMoko project<br />
* [[Wish List]] - A collection of ideas and ideals we'd like to see implemented some day<br />
* [[Wish List - Hardware]] - A collection of ideas we'd like to see in the next Neo release<br />
* [[Wishlist:BuiltInScriptingLanguage|Wish List - Built-in Scripting Language]] - Discussion on a suitable scripting language to be included<br />
* [[Media Content]] - What types of media on the device can we use (that is non-software)?<br />
* [[Testimonials]] - How did you get to OpenMoko?<br />
* [[Buying Interest List]] - (Not official and not a pre-order page) Have you put money aside for Neo1973? Put your nick here.<br />
* [[iPhone]] - Comparison between Apple iPhone and FIC Neo1973<br />
* [[Translation]] - Translation of OpenMoko<br />
* [[Summer of code]] - Our page with project applications for Google's Summer of Code<br />
* [[SWAG]] - Where to purchase openmoko swag (T-Shirts!)<br />
* [[Trademark Policy]] -- The OpenMoko Trademark Policy<br />
<br />
<span id="bottom"></span><br />
<br />
[[Category:Information| ]]<br />
[[Category:Categories| ]]</div>Bryce.Leohttp://wiki.openmoko.org/wiki/Main_PageMain Page2007-08-13T03:25:58Z<p>Bryce.Leo: /* Misc. Development Related */</p>
<hr />
<div>{{Languages|Main_Page}}<br />
<big>'''Welcome to the [[OpenMoko]] public Wiki'''</big><br><br />
<br />
[[Image:FIC-neo1973_small.jpg|200px|right|frontside]]<br />
OpenMoko is an [http://en.wikipedia.org/wiki/Open_source Open Source] project to create the world's first free mobile phone operating system.<br />
<br />
The [[OpenMoko]] project is a community that anyone can join, to help design their ideal phone.<br />
<br />
Eventually, phone software won't be tied to any particular phone.<br />
<br />
You can install any OpenMoko software over the whole range of [[Supported Hardware|supported phones]], and if you upgrade your phone, you don't lose that software. Bugs fixed on any phone are fixed on all. <br />
<br />
'''Currently it is not suitable for users.''' The state of the software at the moment is pre-alpha. If you order a Neo1973, DO NOT expect to be able to use it as an everyday phone for several months.<br />
<br />
The [[Neo1973]] from [[FIC]] is the first of many phones that OpenMoko will run on. Buy it at [https://direct.openmoko.com/ Openmoko Online Shop] (currently [http://jouston.no-ip.com/archives/000230.html out of stock]). You may wish to see the [[SH1 FAQ|Shipment 1 FAQ]].<br />
<br />
Please join us in collaborating on the OpenMoko project through any of the [[Development resources | project resources]] including this OpenMoko wiki. Please see the [[Help:Contents | wiki editing help]] page for information on making contributions to this wiki. A [[Meet the Core Team | core team]] of developers funded by FIC, Inc. leads the project.<br />
<br />
An [[introduction]] page is available, with [[Introduction#Photos|photos]] and [[Introduction#Videos|videos]]. Moreover, the usual [[FAQ | Frequently Asked Questions]] (FAQ) page might be helpful. Developers may find the [[ChangeLog | change log]] an important resource.<br />
<br />
Update 2007-07-25: The [http://forums.makeopensource.com/ Unofficial OpenMoko Forums] are now open! Everyone is invited to participate!<br />
<br />
<br />
The members of the OpenMoko community would like to thank FIC Inc. for showing leadership and initiating the OpenMoko project.<br />
<br />
== OpenMoko Areas of Interest ==<br />
* [[Basic End-user]] - Information for end users who want basic functionality and no surprises<br />
* [[Advanced End-user]] - Information for advanced end-users who want advanced and experimental functionality but who are not programmers<br />
* [[Development resources | Project Resources]] - Provides a centralized location of all resources such as [[Development resources#Mailing_Lists|mailing lists]], [[Development resources#IRC | communication tools]], and other software development oriented resources.<br />
* [[Application Developer]] - Information for application developers, including ideas and specifications for applications, and tools to build them<br />
* [[System Developer]] - Information for system developers, including bootloader, kernel, and libraries<br />
* [[Hardware Developer]] - Information for hardware developers, including hardware specs and debug board<br />
* [[Current events]] - Information on both past and future events where FIC or OpenMoko had or will have a presence.<br />
* [http://forums.makeopensource.com/ Unofficial OpenMoko Forums] - Everyone is invited to collaborate with OpenMoko users and developers on the forums.<br />
* Most of the documentation and Wiki assumes you are using Linux; here are some notes for users of [[Other OSes]].<br />
<br />
== Developer's Documentation ==<br />
<br />
=== Hands-on Guides ===<br />
* [[Getting Started with your Neo1973]]<br />
* [[MokoMakefile|Building OpenMoko using the MokoMakefile]] <br />
* [[OpenMoko2007.2|Building OpenMoko 2007.2]]<br />
* [[Building OpenMoko from scratch]]<br />
** [[Building a hello world application]]<br />
** Old [[Building OpenMoko from scratch (pre-BBT)]]<br />
* [[Migration to bad block tolerant builds]]<br />
* [[Running OpenMoko on PC]]<br />
** [[Getting OpenMoko working on host with Xoo]]<br />
** [[Getting OpenMoko working on host with Xephyr]]<br />
** [[How to run OpenMoko Apps on PC]]<br />
** [[OpenMoko under QEMU]]<br />
** [[Test Openmoko Emulation with chroot image|Test Openmoko Emulation with a Prebuilt chroot Image]]<br />
* [[Booting from SD]]<br />
<br />
=== Hardware Reference Documentation ===<br />
* All [[:Category:Hardware|Hardware]] related documentation and specifications are found on the [[:Category:Hardware|Hardware page]].<br />
* The [[Neo1973 Hardware]] page provides an overview of the hardware components used by the [[:Category:Neo1973 Hardware|Neo1973 hardware platform]]. PCB photographs are also included. A [[Disassembling Neo1973 | photo disassembly story]] may be an interesting starting place.<br />
* [[:Category:Neo1973 Hardware Debugging | Neo1973 Hardware Debugging]] is assisted with the [[Debug Board | Neo1973 debug board]]. A page discussing [[Connecting Neo1973 with Debug Board v2 | debug board and Neo1973 configurations]] is also provided.<br />
<br />
=== Software Reference Documentation ===<br />
* Architectural<br />
** [[OpenMokoFramework]] - The OpenMoko Application Framework<br />
* [[Neo1973 host software]]<br />
* Device Software<br />
** Low-Level<br />
*** [[u-boot]] - The bootloader we use, including documentation for our modifications<br />
*** [[kernel]] - The Linux kernel we use, including documentation for our modifications<br />
** Userspace<br />
*** [[binary compatibility]]<br />
*** [[gsmd]] - the GSM daemon managing the GSM Modem<br />
*** [[gpsd]] - the AGPS (Assisted GPS) daemon<br />
<br />
=== OpenMoko ===<br />
* [[OpenEmbedded]] - The distribution-building framework<br />
* [[Toolchain]] - The toolchain we use for compilation<br />
* [[OpenMoko]] - The OpenMoko distribution<br />
** [[OpenMoko2007]] - The first intended release of it<br />
** [[OpenMoko2007.2]] - An improved release with more formalized style guidelines.<br />
** [[Userspace root image]]<br />
<br />
==== User Interface Related ====<br />
* [[Look & Feel]]<br />
** [[Artwork]]<br />
* [[Applications]]<br />
* [[Widgets]]<br />
** [[Widget Inheritance Graph]]<br />
* [[Application UI Design Recommendations]]<br />
<br />
=== Misc. Development Related ===<br />
* [[Freshman todo]]<br />
* [[Templates]]<br />
* [[PIM Storage]]<br />
* [[Coding Guidelines]]<br />
* [[OpenMoko#Setting_up_an_OpenMoko_SDK|How to setup the OpenMoko SDK]]<br />
* Alternative distributions for [[Neo1973]] GTA01: [[Angstrom on Neo1973]], [http://pokylinux.org Poky] (instructions needed!)<br />
* [[License]] - How we license our code<br />
* [[Development resources]] - Describes resources for developers (lists, svn, ...)<br />
* [[Neo1973 Phase 0]] - Information for Phase 0 device owners<br />
* [[Wishlist:Neo1973 P0 Review]] - Impressions of the Phase 0 hardware device, also the Phase 0 FAQ<br />
* [[Neo1973 Phase 1]] - Information for Phase 1 device owners<br />
* [[Wishlist:Neo1973 P1 Review]] - Impressions of the Phase 1 hardware device<br />
* [[External Feeds]] - List of feeds from people blogging about OpenMoko<br />
<br />
== Administrative / Organizational ==<br />
<br />
* [[Shipping Notes]] - Information to help FIC figure out how to ship products to you, and how much it might cost.<br />
* [[My Account]] - Ideas for what sort of account-based services FIC should provide with the phone.<br />
* [[Hear Me FIC]] - Information to help FIC know what the community wants.<br />
* [[Listen Up Community]] - Community's To-Do-List<br />
* [[Wiki Issues]] - problems/requests regarding this Wiki<br />
<br />
== Miscellaneous ==<br />
* [[WiFi support in OpenMoko]]<br />
* [[Neo1973 and Windows]] - If you want to commit that offence ;) (does not work, help!)<br />
* [[Press Coverage]] - What the press says about the OpenMoko project<br />
* [[mFAQ]] - The OpenMoko Misinformation FAQ ('''mFAQ''') - What the press '''''incorrectly''''' says about the OpenMoko project<br />
* [[Wish List]] - A collection of ideas and ideals we'd like to see implemented some day<br />
* [[Wish List - Hardware]] - A collection of ideas we'd like to see in the next Neo release<br />
* [[Wishlist:BuiltInScriptingLanguage|Wish List - Built-in Scripting Language]] - Discussion on a suitable scripting language to be included<br />
* [[Media Content]] - What types of media on the device can we use (that is non-software)?<br />
* [[Testimonials]] - How did you get to OpenMoko?<br />
* [[Buying Interest List]] - (Not official and not a pre-order page) Have you put money aside for Neo1973? Put your nick here.<br />
* [[iPhone]] - Comparison between Apple iPhone and FIC Neo1973<br />
* [[Translation]] - Translation of OpenMoko<br />
* [[Summer of code]] - Our page with project applications for Google's Summer of Code<br />
* [[SWAG]] - Where to purchase openmoko swag (T-Shirts!)<br />
* [[Trademark Policy]] -- The OpenMoko Trademark Policy<br />
<br />
<span id="bottom"></span><br />
<br />
[[Category:Information| ]]<br />
[[Category:Categories| ]]</div>Bryce.Leohttp://wiki.openmoko.org/wiki/Main_PageMain Page2007-08-02T18:26:06Z<p>Bryce.Leo: /* Misc. Development Related */</p>
<hr />
<div><big>'''Welcome to the [[OpenMoko]] public Wiki'''</big><br><br />
<small>For other languages see the </small>[[#bottom|bottom]]<small> of this page.</small> <br />
<br />
[[Image:FIC-neo1973_small.jpg|200px|right|frontside]]<br />
OpenMoko is an [http://en.wikipedia.org/wiki/Open_source Open Source] project to create the world's first free mobile phone operating system.<br />
<br />
The [[OpenMoko]] project is a community that anyone can join, to help design their ideal phone.<br />
<br />
Eventually, phone software won't be tied to any particular phone. You can install any OpenMoko software over the whole range of [[Supported Hardware|supported phones]], and if you upgrade your phone, you don't lose that software. Bugs fixed on any phone are fixed on all. <br />
<br />
'''Currently it is not suitable for users.''' The state of the software at the moment is pre-alpha. If you order a Neo1973, DO NOT expect to be able to use it as an everyday phone for several months.<br />
<br />
The [[Neo1973]] from [[FIC]] is the first of many phones that OpenMoko will run on; indeed, some people erroneously use the terms Neo1973 and OpenMoko as interchangeable. If you are willing to have the alpha test experience, you can order Neo1973 hardware now from the [https://direct.openmoko.com/ Openmoko Online Shop]. You may wish to see the [[SH1 FAQ|Shipment 1 FAQ]].<br />
<br />
Please join us in collaborating on the OpenMoko project through any of the [[Development resources | project resources]] including this OpenMoko wiki. Please see the [[Help:Contents | wiki editing help]] page for information on making contributions to this wiki. A [[Meet the Core Team | core team]] of developers funded by FIC, Inc. leads the project.<br />
<br />
An [[introduction]] page is available, with [[Introduction#Photos|photos]] and [[Introduction#Videos|videos]]. Moreover, the usual [[FAQ | Frequently Asked Questions]] (FAQ) page might be helpful. Developers may find the [[ChangeLog | change log]] an important resource.<br />
<br />
Update 2007-07-25: The [http://forums.makeopensource.com/ Unofficial OpenMoko Forums] are now open! Everyone is invited to participate!<br />
<br />
<br />
The members of the OpenMoko community would like to thank FIC Inc. for showing leadership and initiating the OpenMoko project.<br />
<br />
== OpenMoko Areas of Interest ==<br />
* [[Basic End-user]] - Information for end users that want basic functionality and no surprises<br />
* [[Advanced End-user]] - Information for advanced end-users that want advanced and experimental functionality but who are not programmers<br />
* [[Development resources | Project Resources]] - Provides a centralized location of all resources such as [[Development resources#Mailing_Lists|mailing lists]], [[Development resources#IRC | communication tools]], and other software development oriented resources.<br />
* [[Application Developer]] - Information for application developers, including ideas and specifications for applications, and tools to build them<br />
* [[System Developer]] - Information for system developers, including bootloader, kernel, and libraries<br />
* [[Hardware Developer]] - Information for hardware developers, including hardware specs and debug board<br />
* [[Current events]] - Information on both past and future events where FIC or OpenMoko had or will have a presence.<br />
* [http://forums.makeopensource.com/ Unofficial OpenMoko Forums] - Everyone is invited to collaborate with OpenMoko users and developers on the forums.<br />
<br />
== Developer's Documentation ==<br />
<br />
=== Hands-on Guides ===<br />
* [[Getting Started with your Neo1973]]<br />
* [[MokoMakefile|Building OpenMoko using the MokoMakefile]] <br />
* [[Building OpenMoko from scratch]]<br />
** [[Building a hello world application]]<br />
** Old [[Building OpenMoko from scratch (pre-BBT)]]<br />
* [[Migration to bad block tolerant builds]]<br />
* [[Running OpenMoko on PC]]<br />
** [[Getting OpenMoko working on host with Xoo]]<br />
** [[Getting OpenMoko working on host with Xephyr]]<br />
** [[How to run OpenMoko Apps on PC]]<br />
** [[OpenMoko under QEMU]]<br />
** [[Test Openmoko Emulation with chroot image|Test Openmoko Emulation with a Prebuilt chroot Image]]<br />
* [[Booting from SD]]<br />
<br />
=== Hardware Reference Documentation ===<br />
* All [[:Category:Hardware|Hardware]] related documentation and specifications are found on the [[:Category:Hardware|Hardware page]].<br />
* The [[Neo1973 Hardware]] page provides an overview of the hardware components used by the [[:Category:Neo1973 Hardware|Neo1973 hardware platform]]. PCB photographs are also included. A [[Disassembling Neo1973 | photo disassembly story]] may be an interesting starting place.<br />
* [[:Category:Neo1973 Hardware Debugging | Neo1973 Hardware Debugging]] is assisted with the [[Debug Board | Neo1973 debug board]]. A page discussing [[Connecting Neo1973 with Debug Board v2 | debug board and Neo1973 configurations]] is also provided.<br />
<br />
=== Software Reference Documentation ===<br />
* Architectural<br />
** [[OpenMokoFramework]] - The OpenMoko Application Framework<br />
* [[Neo1973 host software]]<br />
* Device Software<br />
** Low-Level<br />
*** [[u-boot]] - The bootloader we use, including documentation for our modifications<br />
*** [[kernel]] - The Linux kernel we use, including documentation for our modifications<br />
** Userspace<br />
*** [[binary compatibility]]<br />
*** [[gsmd]] - the GSM daemon managing the GSM Modem<br />
*** [[gpsd]] - the AGPS (Assisted GPS) daemon<br />
<br />
=== OpenMoko ===<br />
* [[OpenEmbedded]] - The distribution-building framework<br />
* [[Toolchain]] - The toolchain we use for compilation<br />
* [[OpenMoko]] - The OpenMoko distribution<br />
** [[OpenMoko2007]] - The first intended release of it<br />
** [[OpenMoko2007.2]] - An improved release with more formalized style guidelines.<br />
** [[Userspace root image]]<br />
<br />
==== User Interface Related ====<br />
* [[Look & Feel]]<br />
** [[Artwork]]<br />
* [[Applications]]<br />
* [[Widgets]]<br />
** [[Widget Inheritance Graph]]<br />
* [[Application UI Design Recommendations]]<br />
<br />
=== Misc. Development Related ===<br />
* [[Freshman todo]]<br />
* [[Templates]]<br />
* [[PIM Storage]]<br />
* [[Coding Guidelines]]<br />
* [[OpenMoko#Setting_up_an_OpenMoko_SDK|How to setup the OpenMoko SDK]]<br />
* [[Application Development Crash Course]] -A very basic how-to for the new people.<br />
* [[License]] - How we license our code<br />
* [[Development resources]] - Describes resources for developers (lists, svn, ...)<br />
* [[Neo1973 Phase 0]] - Information for Phase 0 device owners<br />
* [[Wishlist:Neo1973 P0 Review]] - Impressions of the Phase 0 hardware device, also the Phase 0 FAQ<br />
* [[Neo1973 Phase 1]] - Information for Phase 1 device owners<br />
* [[Wishlist:Neo1973 P1 Review]] - Impressions of the Phase 1 hardware device<br />
* [[External Feeds]] - List of feeds from people blogging about OpenMoko<br />
<br />
== Administrative / Organizational ==<br />
<br />
* [[Shipping Notes]] - Information to help FIC figure out how to ship products to you, and how much it might cost.<br />
* [[My Account]] - Ideas for what sort of account-based services FIC should provide with the phone.<br />
* [[Hear Me FIC]] - Information to help FIC know what the community wants.<br />
* [[Wiki Issues]] - problems/requests regarding this Wiki<br />
<br />
== Miscellaneous ==<br />
* [[WiFi support in OpenMoko]]<br />
* [[Neo1973 and Windows]] - If you want to commit that offence ;) (does not work, help!)<br />
* [[Press Coverage]] - What the press says about the OpenMoko project<br />
* [[mFAQ]] - The OpenMoko Misinformation FAQ ('''mFAQ''') - What the press '''''incorrectly''''' says about the OpenMoko project<br />
* [[Wish List]] - A collection of ideas and ideals we'd like to see implemented some day<br />
* [[Wish List - Hardware]] - A collection of ideas we'd like to see in the next Neo release<br />
* [[Wishlist:BuiltInScriptingLanguage|Wish List - Built-in Scripting Language]] - Discussion on a suitable scripting language to be included<br />
* [[Media Content]] - What types of media on the device can we use (that is non-software)?<br />
* [[Testimonials]] - How did you get to OpenMoko?<br />
* [[Buying Interest List]] - (Not official and not a pre-order page) Have you put money aside for Neo1973? Put your nick here.<br />
* [[iPhone]] - Comparison between Apple iPhone and FIC Neo1973<br />
* [[Translation]] - Translation of OpenMoko<br />
* [[Summer of code]] - Our page with project applications for Google's Summer of Code<br />
* [[SWAG]] - Where to purchase openmoko swag (T-Shirts!)<br />
* [[Trademark Policy]] -- The OpenMoko Trademark Policy<br />
<br />
<span id="bottom"></span><br />
{{Languages|Main_Page}}<br />
<br />
[[Category:Information| ]]<br />
[[Category:Categories| ]]</div>Bryce.Leohttp://wiki.openmoko.org/wiki/Customizing_the_Openmoko_DistributionCustomizing the Openmoko Distribution2007-07-31T03:31:08Z<p>Bryce.Leo: /* Filling in the files */</p>
<hr />
<div>== What's the goal? ==<br />
<br />
The goal of this page is to teach you how to take an application that you've coded (or the sample app) and properly get it included in your rootfs. This article is a bit of an aggregate page, it's going to take information from [[MokoMakefile]], [[User:CesarB/Using a local overlay|Using a local overlay]], [[Building a hello world application]], and [[Create a package from existing sources]]. So as you can see the goal is for it to be a very thorough introduction, and will take you from "Idea to Inclusion" of your application.<br />
<br />
<br />
== Setting Up the OpenMoko Environment ==<br />
<br />
{| border="1" cellspacing="0" cellpadding="5" <br />
|*If you already have the environment setup then it is imperative that you update your Makefile.<br />
Do this by running:<br />
<pre>make update-makefile</pre><br />
|}<br />
<br />
This part of the tutorial is going to be pretty basic. I absolutely love [[MokoMakefile]], it's fantastic, the creator has done and continues to do a fantastic job with this. I see absolutely no reason not to use it I put my OpenMoko development directory in /home/bryce/mokodev/ and that works great for me. You can feel free to do the same or put it anywhere else in your user directory (or anywhere on your system if you're feeling daring and a little nutty).<br />
<br />
To get your environment setup please get it setup according to [[MokoMakefile]] however if you do have the build environment setup manually and you're sure you know what you're doing then feel free to go forward with this.<br />
<br />
== Setting Up a Local Overlay ==<br />
If you're at the point for setting up a local overlay this means a couple things. First: You've had a brilliant idea for an application that you just need to have on the OpenMoko platform. Second: You realize that this killer app of yours needs to be done properly and you're not going to do anything silly like include it in the actual tree for the OpenMoko distro because it would probably end up just getting overwritten eventually, or you just realize that it's bad practice!<br />
<br />
If you're wondering why and what a local overlay is then let me take this time to explain it to you. A local overlay is where you, as a developer keep your local files in an OE style setup so that you can simply pull your updated code into the tree. You add your overlay tree into the bitbake setup so that when you call bitbake it will pull your own or your customized packages before going to the OE or OpenMoko trees.This keeps everything nice and organized for you and also allows you to build/rebuild/include you apps by using the [[MokoMakefile]]<br />
<br />
Thank you to [[User:CesarB]] for this part of the wiki.<br />
<br />
To create a local overlay:<br />
<br />
* Create a "local" directory and its subdirectories<br />
<br />
mkdir local local/conf local/classes local/packages<br />
<br />
* Copy <code>site.conf</code> from the openmoko tree to <code>local/conf</code><br />
<br />
cp oe/conf/site.conf local/conf/site.conf<br />
<br />
* Edit the site.conf you copied to add the new tree as a source for bitbake recipes.<br />
<br />
Change the current <code>BBFILES</code> to look like this:<br />
BBFILES := "${OMDIR}/openembedded/packages/*/*.bb ${OMDIR}/oe/packages/*/*.bb ${OMDIR}/local/packages/*/*.bb"<br />
Change your <code>BBFILE_COLLECTIONS</code> line to look like this:<br />
BBFILE_COLLECTIONS = "upstream local overlay"<br />
Add this line:<br />
BBFILE_PATTERN_overlay = "^${OMDIR}/local/"<br />
Add this line:<br />
BBFILE_PRIORITY_overlay = "20"<br />
<br />
The <code>BBFILE_PRIORITY</code> should be greater than all the other <code>BBFILE_PRIORITY</code> variables on the same file.<br />
<br />
* Change your <code>BBPATH</code> environment variable to add the new tree ''before'' the two others in your <code>setup-env</code> file.<code>setup-env</code> is created by [[MokoMakefile]] automatically and is located in your <code>${OMDIR}</code> directory.<br />
<br />
export BBPATH="${OMDIR}/build:${OMDIR}/local:${OMDIR}/oe:${OMDIR}/openembedded"<br />
<br />
== Using Your New Local Overlay ==<br />
<br />
=== Changing files in conf/ ===<br />
<br />
To change a file in conf/, just copy the file to the overlay tree (preserving the directory structure) and edit it.<br />
<br />
=== Changing files in classes/ ===<br />
<br />
To change a file in classes/, just copy the file to the overlay tree and edit it.<br />
<br />
=== Changing packages ===<br />
<br />
Changing a package's recipe is a bit more complex. You have to copy over (or symlink) not only the .bb file for the package, but also ''all'' the files it includes with <code>require</code>, and the <code>FILESDIR</code> directories (all directories referred to by <code>FILESDIR</code>, usually named either ''package''-''version'' or <code>files</code>). If you forget one of them, the build will give an error (either when parsing the recipe in the case of <code>require</code>, or when trying to build in the case of the <code>FILESDIR</code> directories).<br />
<br />
=== Adding a new package ===<br />
<br />
You can add a new package (or a recipe for a new version of a package) to the overlay tree simply by creating it on the overlay tree.<br />
<br />
== Your First Application ==<br />
<br />
I know that I said I'd have a GDK application in here, however, I'd really like to get this whole course done first and have you guys starting to code instead of just looking at what I've written!<br />
<br />
This will be a very simple CLI hello world.<br />
<br />
=== Before We Code ===<br />
<br />
Like a good coder you want to make sure that you're not just doing things, but that you're doing them the right way! <br />
<br />
Now change directories into your <code>local/packages</code> directory.The following commands expect you'll be in that directory so don't change unless you know what you're doing!<br />
<br />
You'll want to make a directory with the name of your application, and a subdirectory called files.<br />
mkdir myhelloworld myhelloworld/files<br />
Now you'll want to create two files in the <code>files</code> directory<br />
touch myhelloworld/files/README.txt myhelloworld/files/myhelloworld.c<br />
And finally you'll want to create a bitbake file.<br />
touch myhelloworld/myhelloworld.bb<br />
<br />
Alrighty now all your necessary files are created so lets go over this real quick.<br />
<pre><br />
$HOME<br />
+- $OMDIR (contains the official openmoko tree)<br />
| +- local/<br />
| +- packages/<br />
| +- myhelloworld/<br />
| +- myhelloworld.bb<br />
| +- files/<br />
| +- myhelloworld.c<br />
| +- README.txt<br />
</pre><br />
<br />
That should be your structure, if it's not you should go and fix it up.<br />
=== Filling the Files ===<br />
<br />
So you've got your sample files all laid out now it's time to make them actually do something.<br />
<br />
myhelloworld.c<br />
<pre><br />
#include <stdio.h><br />
<br />
int main(int argc, char** argv)<br />
{<br />
printf("Ello Poppet!\n");<br />
return 0;<br />
}<br />
</pre><br />
<br />
README.txt<br />
<pre><br />
This is a command line application. It prints a simple Hello World! To stdout.<br />
</pre><br />
<br />
myhelloworld.bb<br />
<pre><br />
DESCRIPTION = "A killer hello world application"<br />
AUTHOR = "Bryce Leo"<br />
HOMEPAGE = ""<br />
SECTION = "console/applications"<br />
PRIORITY = "optional"<br />
LICENSE = "MIT"<br />
#DEPENDS = ""<br />
#RDEPENDS = ""<br />
#RRECOMMENDS = ""<br />
#RCONFLICTS = ""<br />
#SRCDATE = "20070729"<br />
#PV = "0.1"<br />
#PR = "r0"<br />
SRC_URI = "file://myhelloworld.c \<br />
file://README.txt "<br />
<br />
S = "${WORKDIR}/myhelloworld/"<br />
<br />
do_compile() {<br />
${CC} ${CFLAGS} ${LDFLAGS} ${WORKDIR}/myhelloworld.c -o myhelloworld<br />
}<br />
<br />
do_install() {<br />
install -m 0755 -d ${D}${bindir} ${D}${docdir}/myhelloworld<br />
install -m 0755 ${S}/myhelloworld ${D}${bindir}<br />
install -m 0644 ${WORKDIR}/README.txt ${D}${docdir}/myhelloworld<br />
}<br />
<br />
</pre><br />
<br />
=== Your First Compilation ===<br />
<br />
This is where the [[MokoMakefile]] comes in very very handy. Change to your ${OMDIR} directory, You'll know it by the fact that it is where <code>Makefile</code> resides.<br />
make build-package-myhelloworld<br />
This should all come back and not return any error messages, The output should end in something similar to<br />
<pre><br />
NOTE: package myhelloworld-1.0: completed<br />
NOTE: build 200707291926: completed<br />
Build statistics:<br />
Attempted builds: 1<br />
</pre><br />
<br />
Now that no errors were thrown we are happily done!<br />
<br />
== Adding Your Application to the Image ==<br />
<br />
So you've had an idea, you've setup the build environment, you've setup your local overlay, you've laid out your application tree, you've put code into those fantastic files of yours and now it compiles.There's only one thing left to do. Add that application to your image.<br />
<br />
Now lets go over in words and whys what we're about to do. First we need to make modify the <code>${OMDIR}/build/conf/local.conf</code>. We add in the variable <code>DISTRO_EXTRA_RDEPENDS</code> and set its value to include <code>myhelloworld</code>. If you'd like to include other packages from your own overlay or the OM tree just add them inseparated by spaces. After this gets added as a dependency to build the Distro (in this case OpenMoko). Now we have to re-build the task-base package. This essentially just generates an ipk file that will "Merge machine and distro options to create a basic machine task/package." It pretty much builds a file with a list of packages to be installed that are required for the distro to work correctly. So then you just go through and make <code>openmoko-devel-image, build-qemu, flash-qemu-local,</code> and <code>run-qemu</code>. Then calibrate your stylus, head over to the terminal, and run your application!<br />
<br />
=== Modifying Your local.conf ===<br />
Now, go into your build config directory <code>${OMDIR}/build/conf/</code> and now you'll be editing <code>local.conf</code><br />
Add this line to you <code>local.conf</code><br />
DISTRO_EXTRA_RDEPENDS += "myhelloworld"<br />
With this line you can also include other applications from the OE tree. For instance my <code>local.conf</code> looks like this.<br />
<pre><br />
MACHINE = "fic-gta01"<br />
DISTRO = "openmoko"<br />
BUILD_ARCH = "i686"<br />
SRCDATE_eds-dbus = "now"<br />
DISTRO_EXTRA_RDEPENDS += "lua dillo myhelloworld"<br />
</pre><br />
<br />
Now that you've fixed your <code>local.conf</code> it's time to go through all the necessary tasks to add and re-build you image and have your sweet package included.<br />
<br />
=== Building ===<br />
Now come the easy part thanks to [[MokoMakefile]]. <br />
<br />
make rebuild-package-task-base<br />
make openmoko-devel-image<br />
make build-qemu<br />
make flash-qemu-local<br />
<br />
Now all you have to do is run qemu.<br />
make run-qemu<br />
<br />
From here after you calibrate your stylus, you click on the Menu in the top right, click down to terminal, then just run your program.<br />
<pre><br />
root@fic-gta02:/$ myhelloworld<br />
Ello Poppet!<br />
</pre><br />
<br />
==Adding Python scripts as applications==<br />
This is for adding python scripts/packages to the image for your own use.<br />
===First steps===<br />
First, you need to modify the <code>local.conf</code> file as described above. You need to modify <br />
DISTRO_EXTRA_RDEPENDS += "myhelloworld"<br />
to<br />
DISTRO_EXTRA_RDEPENDS += "myhelloworld python"<br />
<br />
This is because python is not included by default in the openmoko image. Or you can use <code>python-gtk</code> if you wish.<br />
<br />
Next, you need to perform these actions from the <code>$OMDIR/local</code> directory.<br />
<br />
mkdir packages/pyhelloworld packages/pyhelloworld/files<br />
<br />
touch packages/pyhelloworld/files/pyhello packages/pyhelloworld/README.txt<br />
<br />
touch packages/pyhelloworld/pyhelloworld.bb<br />
<br />
===Filling in the files===<br />
Now, edit <code>packages/pyhelloworld/files/pyhello</code> to contain:<br />
<pre> <br />
#!/usr/bin/python<br />
<br />
print "hello world!"<br />
print "shutting down now. Farewell oh cruel, cruel world!"<br />
</pre><br />
<br />
Next up, is editing <code>packages/pyhelloworld/files/README.txt</code> to say:<br />
<br />
This is the most awesome helloworld application ever. Know why? It has SNAKES!<br />
<br />
Kidding aside, next is the all important <code> packages/pyhelloworld/pyhelloworld.bb:</code><br />
<pre><br />
DESCRIPTION = "A pythonic hello world applicaiton"<br />
AUTHOR = "Tyler Laing"<br />
HOMEPAGE = ""<br />
SECTION = "console/applications"<br />
PRIORITY = "optional"<br />
LICENSE = "MIT"<br />
#DEPENDS = ""<br />
#RDEPENDS = ""<br />
#RRECOMMENDS = ""<br />
#RCONFLICTS = ""<br />
#SRCDATE = "20070729"<br />
#PV = "0.1"<br />
#PR = "r0"<br />
SRC_URI = "file://pyhello \<br />
file://README.txt "<br />
<br />
S = "${WORKDIR}/pyhelloworld/"<br />
<br />
<br />
do_install() {<br />
install -m 0755 -d ${D}${bindir} ${D}${docdir}/pyhelloworld<br />
install -m 0755 ${WORKDIR}/pyhello ${D}${bindir}<br />
install -m 0644 ${WORKDIR}/README.txt ${D}${docdir}/pyhelloworld<br />
}<br />
<br />
</pre><br />
<br />
I'll explain each of the parts right here, for future reference.<br />
<br />
====Meanings of variables in .bb files====<br />
<br />
$WORKDIR = $OMDIR/local/packages/<application directory><br />
$bindir = $OMDIR/build/tmp/work/armv4t-linux/<application directory>/image/usr/bin<br />
$docir = $OMDIR/build/tmp/work/armv4t-linux/<application directory>/image/usr/share/doc<br />
$D = $OMDIR/build/<br />
<br />
====Final steps====<br />
Complete the last steps as per the above instructions, from the point of altering <code>DISTRO_EXTRA_RDEPENDS</code>.<br />
<br />
And your done!<br />
<br />
[[Category:Applications]]<br />
[[Category:OpenMoko]]<br />
[[Category:Developer]]</div>Bryce.Leohttp://wiki.openmoko.org/wiki/User:Bryce.LeoUser:Bryce.Leo2007-07-31T01:35:24Z<p>Bryce.Leo: </p>
<hr />
<div>Goal: Write documentation to keep the new guys interested and hopefully gain a few long-term devs along the way.</div>Bryce.Leohttp://wiki.openmoko.org/wiki/Customizing_the_Openmoko_DistributionCustomizing the Openmoko Distribution2007-07-31T01:27:06Z<p>Bryce.Leo: /* Setting Up the OpenMoko Environment */</p>
<hr />
<div>== What's the goal? ==<br />
<br />
The goal of this page is to teach you how to take an application that you've coded (or the sample app) and properly get it included in your rootfs. This article is a bit of an aggregate page, it's going to take information from [[MokoMakefile]], [[User:CesarB/Using a local overlay|Using a local overlay]], [[Building a hello world application]], and [[Create a package from existing sources]]. So as you can see the goal is for it to be a very thorough introduction, and will take you from "Idea to Inclusion" of your application.<br />
<br />
<br />
== Setting Up the OpenMoko Environment ==<br />
<br />
{| border="1" cellspacing="0" cellpadding="5" <br />
|*If you already have the environment setup then it is imperative that you update your Makefile.<br />
Do this by running:<br />
<pre>make update-makefile</pre><br />
|}<br />
<br />
This part of the tutorial is going to be pretty basic. I absolutely love [[MokoMakefile]], it's fantastic, the creator has done and continues to do a fantastic job with this. I see absolutely no reason not to use it I put my OpenMoko development directory in /home/bryce/mokodev/ and that works great for me. You can feel free to do the same or put it anywhere else in your user directory (or anywhere on your system if you're feeling daring and a little nutty).<br />
<br />
To get your environment setup please get it setup according to [[MokoMakefile]] however if you do have the build environment setup manually and you're sure you know what you're doing then feel free to go forward with this.<br />
<br />
== Setting Up a Local Overlay ==<br />
If you're at the point for setting up a local overlay this means a couple things. First: You've had a brilliant idea for an application that you just need to have on the OpenMoko platform. Second: You realize that this killer app of yours needs to be done properly and you're not going to do anything silly like include it in the actual tree for the OpenMoko distro because it would probably end up just getting overwritten eventually, or you just realize that it's bad practice!<br />
<br />
If you're wondering why and what a local overlay is then let me take this time to explain it to you. A local overlay is where you, as a developer keep your local files in an OE style setup so that you can simply pull your updated code into the tree. You add your overlay tree into the bitbake setup so that when you call bitbake it will pull your own or your customized packages before going to the OE or OpenMoko trees.This keeps everything nice and organized for you and also allows you to build/rebuild/include you apps by using the [[MokoMakefile]]<br />
<br />
Thank you to [[User:CesarB]] for this part of the wiki.<br />
<br />
To create a local overlay:<br />
<br />
* Create a "local" directory and its subdirectories<br />
<br />
mkdir local local/conf local/classes local/packages<br />
<br />
* Copy <code>site.conf</code> from the openmoko tree to <code>local/conf</code><br />
<br />
cp oe/conf/site.conf local/conf/site.conf<br />
<br />
* Edit the site.conf you copied to add the new tree as a source for bitbake recipes.<br />
<br />
Change the current <code>BBFILES</code> to look like this:<br />
BBFILES := "${OMDIR}/openembedded/packages/*/*.bb ${OMDIR}/oe/packages/*/*.bb ${OMDIR}/local/packages/*/*.bb"<br />
Change your <code>BBFILE_COLLECTIONS</code> line to look like this:<br />
BBFILE_COLLECTIONS = "upstream local overlay"<br />
Add this line:<br />
BBFILE_PATTERN_overlay = "^${OMDIR}/local/"<br />
Add this line:<br />
BBFILE_PRIORITY_overlay = "20"<br />
<br />
The <code>BBFILE_PRIORITY</code> should be greater than all the other <code>BBFILE_PRIORITY</code> variables on the same file.<br />
<br />
* Change your <code>BBPATH</code> environment variable to add the new tree ''before'' the two others in your <code>setup-env</code> file.<code>setup-env</code> is created by [[MokoMakefile]] automatically and is located in your <code>${OMDIR}</code> directory.<br />
<br />
export BBPATH="${OMDIR}/build:${OMDIR}/local:${OMDIR}/oe:${OMDIR}/openembedded"<br />
<br />
== Using Your New Local Overlay ==<br />
<br />
=== Changing files in conf/ ===<br />
<br />
To change a file in conf/, just copy the file to the overlay tree (preserving the directory structure) and edit it.<br />
<br />
=== Changing files in classes/ ===<br />
<br />
To change a file in classes/, just copy the file to the overlay tree and edit it.<br />
<br />
=== Changing packages ===<br />
<br />
Changing a package's recipe is a bit more complex. You have to copy over (or symlink) not only the .bb file for the package, but also ''all'' the files it includes with <code>require</code>, and the <code>FILESDIR</code> directories (all directories referred to by <code>FILESDIR</code>, usually named either ''package''-''version'' or <code>files</code>). If you forget one of them, the build will give an error (either when parsing the recipe in the case of <code>require</code>, or when trying to build in the case of the <code>FILESDIR</code> directories).<br />
<br />
=== Adding a new package ===<br />
<br />
You can add a new package (or a recipe for a new version of a package) to the overlay tree simply by creating it on the overlay tree.<br />
<br />
== Your First Application ==<br />
<br />
I know that I said I'd have a GDK application in here, however, I'd really like to get this whole course done first and have you guys starting to code instead of just looking at what I've written!<br />
<br />
This will be a very simple CLI hello world.<br />
<br />
=== Before We Code ===<br />
<br />
Like a good coder you want to make sure that you're not just doing things, but that you're doing them the right way! <br />
<br />
Now change directories into your <code>local/packages</code> directory.The following commands expect you'll be in that directory so don't change unless you know what you're doing!<br />
<br />
You'll want to make a directory with the name of your application, and a subdirectory called files.<br />
mkdir myhelloworld myhelloworld/files<br />
Now you'll want to create two files in the <code>files</code> directory<br />
touch myhelloworld/files/README.txt myhelloworld/files/myhelloworld.c<br />
And finally you'll want to create a bitbake file.<br />
touch myhelloworld/myhelloworld.bb<br />
<br />
Alrighty now all your necessary files are created so lets go over this real quick.<br />
<pre><br />
$HOME<br />
+- $OMDIR (contains the official openmoko tree)<br />
| +- local/<br />
| +- packages/<br />
| +- myhelloworld/<br />
| +- myhelloworld.bb<br />
| +- files/<br />
| +- myhelloworld.c<br />
| +- README.txt<br />
</pre><br />
<br />
That should be your structure, if it's not you should go and fix it up.<br />
=== Filling the Files ===<br />
<br />
So you've got your sample files all laid out now it's time to make them actually do something.<br />
<br />
myhelloworld.c<br />
<pre><br />
#include <stdio.h><br />
<br />
int main(int argc, char** argv)<br />
{<br />
printf("Ello Poppet!\n");<br />
return 0;<br />
}<br />
</pre><br />
<br />
README.txt<br />
<pre><br />
This is a command line application. It prints a simple Hello World! To stdout.<br />
</pre><br />
<br />
myhelloworld.bb<br />
<pre><br />
DESCRIPTION = "A killer hello world application"<br />
AUTHOR = "Bryce Leo"<br />
HOMEPAGE = ""<br />
SECTION = "console/applications"<br />
PRIORITY = "optional"<br />
LICENSE = "MIT"<br />
#DEPENDS = ""<br />
#RDEPENDS = ""<br />
#RRECOMMENDS = ""<br />
#RCONFLICTS = ""<br />
#SRCDATE = "20070729"<br />
#PV = "0.1"<br />
#PR = "r0"<br />
SRC_URI = "file://myhelloworld.c \<br />
file://README.txt "<br />
<br />
S = "${WORKDIR}/myhelloworld/"<br />
<br />
do_compile() {<br />
${CC} ${CFLAGS} ${LDFLAGS} ${WORKDIR}/myhelloworld.c -o myhelloworld<br />
}<br />
<br />
do_install() {<br />
install -m 0755 -d ${D}${bindir} ${D}${docdir}/myhelloworld<br />
install -m 0755 ${S}/myhelloworld ${D}${bindir}<br />
install -m 0644 ${WORKDIR}/README.txt ${D}${docdir}/myhelloworld<br />
}<br />
<br />
</pre><br />
<br />
=== Your First Compilation ===<br />
<br />
This is where the [[MokoMakefile]] comes in very very handy. Change to your ${OMDIR} directory, You'll know it by the fact that it is where <code>Makefile</code> resides.<br />
make build-package-myhelloworld<br />
This should all come back and not return any error messages, The output should end in something similar to<br />
<pre><br />
NOTE: package myhelloworld-1.0: completed<br />
NOTE: build 200707291926: completed<br />
Build statistics:<br />
Attempted builds: 1<br />
</pre><br />
<br />
Now that no errors were thrown we are happily done!<br />
<br />
== Adding Your Application to the Image ==<br />
<br />
So you've had an idea, you've setup the build environment, you've setup your local overlay, you've laid out your application tree, you've put code into those fantastic files of yours and now it compiles.There's only one thing left to do. Add that application to your image.<br />
<br />
Now lets go over in words and whys what we're about to do. First we need to make modify the <code>${OMDIR}/build/conf/local.conf</code>. We add in the variable <code>DISTRO_EXTRA_RDEPENDS</code> and set its value to include <code>myhelloworld</code>. If you'd like to include other packages from your own overlay or the OM tree just add them inseparated by spaces. After this gets added as a dependency to build the Distro (in this case OpenMoko). Now we have to re-build the task-base package. This essentially just generates an ipk file that will "Merge machine and distro options to create a basic machine task/package." It pretty much builds a file with a list of packages to be installed that are required for the distro to work correctly. So then you just go through and make <code>openmoko-devel-image, build-qemu, flash-qemu-local,</code> and <code>run-qemu</code>. Then calibrate your stylus, head over to the terminal, and run your application!<br />
<br />
=== Modifying Your local.conf ===<br />
Now, go into your build config directory <code>${OMDIR}/build/conf/</code> and now you'll be editing <code>local.conf</code><br />
Add this line to you <code>local.conf</code><br />
DISTRO_EXTRA_RDEPENDS += "myhelloworld"<br />
With this line you can also include other applications from the OE tree. For instance my <code>local.conf</code> looks like this.<br />
<pre><br />
MACHINE = "fic-gta01"<br />
DISTRO = "openmoko"<br />
BUILD_ARCH = "i686"<br />
SRCDATE_eds-dbus = "now"<br />
DISTRO_EXTRA_RDEPENDS += "lua dillo myhelloworld"<br />
</pre><br />
<br />
Now that you've fixed your <code>local.conf</code> it's time to go through all the necessary tasks to add and re-build you image and have your sweet package included.<br />
<br />
=== Building ===<br />
Now come the easy part thanks to [[MokoMakefile]]. <br />
<br />
make rebuild-package-task-base<br />
make openmoko-devel-image<br />
make build-qemu<br />
make flash-qemu-local<br />
<br />
Now all you have to do is run qemu.<br />
make run-qemu<br />
<br />
From here after you calibrate your stylus, you click onthe Menu in the top right, click down to terminal, then just run your program.<br />
<pre><br />
root@fic-gta02:/$ myhelloworld<br />
Ello Poppet!<br />
</pre><br />
<br />
[[Category:Applications]]<br />
[[Category:OpenMoko]]<br />
[[Category:Developer]]</div>Bryce.Leohttp://wiki.openmoko.org/wiki/Customizing_the_Openmoko_DistributionCustomizing the Openmoko Distribution2007-07-31T01:25:35Z<p>Bryce.Leo: /* Setting Up a Local Overlay */</p>
<hr />
<div>== What's the goal? ==<br />
<br />
The goal of this page is to teach you how to take an application that you've coded (or the sample app) and properly get it included in your rootfs. This article is a bit of an aggregate page, it's going to take information from [[MokoMakefile]], [[User:CesarB/Using a local overlay|Using a local overlay]], [[Building a hello world application]], and [[Create a package from existing sources]]. So as you can see the goal is for it to be a very thorough introduction, and will take you from "Idea to Inclusion" of your application.<br />
<br />
<br />
== Setting Up the OpenMoko Environment ==<br />
<br />
{| border="1" cellspacing="0" cellpadding="5" <br />
|*If you already have the environment setup then it is imperative that you update your Makefile.<br />
Do this by running:<br />
<pre>make update-makefile</pre><br />
|}<br />
<br />
This part of the tutorial is going to be pretty basic. I absolutely love [[MokoMakefile]], it's fantastic, the creator has done and continues to do a fantastic job with this. I see absolutely no reason not to use it. However I cannot for the life of me understand why they create their working directory in /home/moko, the home directory is for home directories for users of your system, not for a development directory. I put my OpenMoko development directory in /home/bryce/mokodev/ and that works great for me, and also makes more sense so that multiple users on my machine could develop with no attempt to overlap.<br />
<br />
To get your environment setup please get it setup according to [[MokoMakefile]] however if you do have the build environment setup manually and you're sure you know what you're doing then feel free to go forward with this.<br />
<br />
== Setting Up a Local Overlay ==<br />
If you're at the point for setting up a local overlay this means a couple things. First: You've had a brilliant idea for an application that you just need to have on the OpenMoko platform. Second: You realize that this killer app of yours needs to be done properly and you're not going to do anything silly like include it in the actual tree for the OpenMoko distro because it would probably end up just getting overwritten eventually, or you just realize that it's bad practice!<br />
<br />
If you're wondering why and what a local overlay is then let me take this time to explain it to you. A local overlay is where you, as a developer keep your local files in an OE style setup so that you can simply pull your updated code into the tree. You add your overlay tree into the bitbake setup so that when you call bitbake it will pull your own or your customized packages before going to the OE or OpenMoko trees.This keeps everything nice and organized for you and also allows you to build/rebuild/include you apps by using the [[MokoMakefile]]<br />
<br />
Thank you to [[User:CesarB]] for this part of the wiki.<br />
<br />
To create a local overlay:<br />
<br />
* Create a "local" directory and its subdirectories<br />
<br />
mkdir local local/conf local/classes local/packages<br />
<br />
* Copy <code>site.conf</code> from the openmoko tree to <code>local/conf</code><br />
<br />
cp oe/conf/site.conf local/conf/site.conf<br />
<br />
* Edit the site.conf you copied to add the new tree as a source for bitbake recipes.<br />
<br />
Change the current <code>BBFILES</code> to look like this:<br />
BBFILES := "${OMDIR}/openembedded/packages/*/*.bb ${OMDIR}/oe/packages/*/*.bb ${OMDIR}/local/packages/*/*.bb"<br />
Change your <code>BBFILE_COLLECTIONS</code> line to look like this:<br />
BBFILE_COLLECTIONS = "upstream local overlay"<br />
Add this line:<br />
BBFILE_PATTERN_overlay = "^${OMDIR}/local/"<br />
Add this line:<br />
BBFILE_PRIORITY_overlay = "20"<br />
<br />
The <code>BBFILE_PRIORITY</code> should be greater than all the other <code>BBFILE_PRIORITY</code> variables on the same file.<br />
<br />
* Change your <code>BBPATH</code> environment variable to add the new tree ''before'' the two others in your <code>setup-env</code> file.<code>setup-env</code> is created by [[MokoMakefile]] automatically and is located in your <code>${OMDIR}</code> directory.<br />
<br />
export BBPATH="${OMDIR}/build:${OMDIR}/local:${OMDIR}/oe:${OMDIR}/openembedded"<br />
<br />
== Using Your New Local Overlay ==<br />
<br />
=== Changing files in conf/ ===<br />
<br />
To change a file in conf/, just copy the file to the overlay tree (preserving the directory structure) and edit it.<br />
<br />
=== Changing files in classes/ ===<br />
<br />
To change a file in classes/, just copy the file to the overlay tree and edit it.<br />
<br />
=== Changing packages ===<br />
<br />
Changing a package's recipe is a bit more complex. You have to copy over (or symlink) not only the .bb file for the package, but also ''all'' the files it includes with <code>require</code>, and the <code>FILESDIR</code> directories (all directories referred to by <code>FILESDIR</code>, usually named either ''package''-''version'' or <code>files</code>). If you forget one of them, the build will give an error (either when parsing the recipe in the case of <code>require</code>, or when trying to build in the case of the <code>FILESDIR</code> directories).<br />
<br />
=== Adding a new package ===<br />
<br />
You can add a new package (or a recipe for a new version of a package) to the overlay tree simply by creating it on the overlay tree.<br />
<br />
== Your First Application ==<br />
<br />
I know that I said I'd have a GDK application in here, however, I'd really like to get this whole course done first and have you guys starting to code instead of just looking at what I've written!<br />
<br />
This will be a very simple CLI hello world.<br />
<br />
=== Before We Code ===<br />
<br />
Like a good coder you want to make sure that you're not just doing things, but that you're doing them the right way! <br />
<br />
Now change directories into your <code>local/packages</code> directory.The following commands expect you'll be in that directory so don't change unless you know what you're doing!<br />
<br />
You'll want to make a directory with the name of your application, and a subdirectory called files.<br />
mkdir myhelloworld myhelloworld/files<br />
Now you'll want to create two files in the <code>files</code> directory<br />
touch myhelloworld/files/README.txt myhelloworld/files/myhelloworld.c<br />
And finally you'll want to create a bitbake file.<br />
touch myhelloworld/myhelloworld.bb<br />
<br />
Alrighty now all your necessary files are created so lets go over this real quick.<br />
<pre><br />
$HOME<br />
+- $OMDIR (contains the official openmoko tree)<br />
| +- local/<br />
| +- packages/<br />
| +- myhelloworld/<br />
| +- myhelloworld.bb<br />
| +- files/<br />
| +- myhelloworld.c<br />
| +- README.txt<br />
</pre><br />
<br />
That should be your structure, if it's not you should go and fix it up.<br />
=== Filling the Files ===<br />
<br />
So you've got your sample files all laid out now it's time to make them actually do something.<br />
<br />
myhelloworld.c<br />
<pre><br />
#include <stdio.h><br />
<br />
int main(int argc, char** argv)<br />
{<br />
printf("Ello Poppet!\n");<br />
return 0;<br />
}<br />
</pre><br />
<br />
README.txt<br />
<pre><br />
This is a command line application. It prints a simple Hello World! To stdout.<br />
</pre><br />
<br />
myhelloworld.bb<br />
<pre><br />
DESCRIPTION = "A killer hello world application"<br />
AUTHOR = "Bryce Leo"<br />
HOMEPAGE = ""<br />
SECTION = "console/applications"<br />
PRIORITY = "optional"<br />
LICENSE = "MIT"<br />
#DEPENDS = ""<br />
#RDEPENDS = ""<br />
#RRECOMMENDS = ""<br />
#RCONFLICTS = ""<br />
#SRCDATE = "20070729"<br />
#PV = "0.1"<br />
#PR = "r0"<br />
SRC_URI = "file://myhelloworld.c \<br />
file://README.txt "<br />
<br />
S = "${WORKDIR}/myhelloworld/"<br />
<br />
do_compile() {<br />
${CC} ${CFLAGS} ${LDFLAGS} ${WORKDIR}/myhelloworld.c -o myhelloworld<br />
}<br />
<br />
do_install() {<br />
install -m 0755 -d ${D}${bindir} ${D}${docdir}/myhelloworld<br />
install -m 0755 ${S}/myhelloworld ${D}${bindir}<br />
install -m 0644 ${WORKDIR}/README.txt ${D}${docdir}/myhelloworld<br />
}<br />
<br />
</pre><br />
<br />
=== Your First Compilation ===<br />
<br />
This is where the [[MokoMakefile]] comes in very very handy. Change to your ${OMDIR} directory, You'll know it by the fact that it is where <code>Makefile</code> resides.<br />
make build-package-myhelloworld<br />
This should all come back and not return any error messages, The output should end in something similar to<br />
<pre><br />
NOTE: package myhelloworld-1.0: completed<br />
NOTE: build 200707291926: completed<br />
Build statistics:<br />
Attempted builds: 1<br />
</pre><br />
<br />
Now that no errors were thrown we are happily done!<br />
<br />
== Adding Your Application to the Image ==<br />
<br />
So you've had an idea, you've setup the build environment, you've setup your local overlay, you've laid out your application tree, you've put code into those fantastic files of yours and now it compiles.There's only one thing left to do. Add that application to your image.<br />
<br />
Now lets go over in words and whys what we're about to do. First we need to make modify the <code>${OMDIR}/build/conf/local.conf</code>. We add in the variable <code>DISTRO_EXTRA_RDEPENDS</code> and set its value to include <code>myhelloworld</code>. If you'd like to include other packages from your own overlay or the OM tree just add them inseparated by spaces. After this gets added as a dependency to build the Distro (in this case OpenMoko). Now we have to re-build the task-base package. This essentially just generates an ipk file that will "Merge machine and distro options to create a basic machine task/package." It pretty much builds a file with a list of packages to be installed that are required for the distro to work correctly. So then you just go through and make <code>openmoko-devel-image, build-qemu, flash-qemu-local,</code> and <code>run-qemu</code>. Then calibrate your stylus, head over to the terminal, and run your application!<br />
<br />
=== Modifying Your local.conf ===<br />
Now, go into your build config directory <code>${OMDIR}/build/conf/</code> and now you'll be editing <code>local.conf</code><br />
Add this line to you <code>local.conf</code><br />
DISTRO_EXTRA_RDEPENDS += "myhelloworld"<br />
With this line you can also include other applications from the OE tree. For instance my <code>local.conf</code> looks like this.<br />
<pre><br />
MACHINE = "fic-gta01"<br />
DISTRO = "openmoko"<br />
BUILD_ARCH = "i686"<br />
SRCDATE_eds-dbus = "now"<br />
DISTRO_EXTRA_RDEPENDS += "lua dillo myhelloworld"<br />
</pre><br />
<br />
Now that you've fixed your <code>local.conf</code> it's time to go through all the necessary tasks to add and re-build you image and have your sweet package included.<br />
<br />
=== Building ===<br />
Now come the easy part thanks to [[MokoMakefile]]. <br />
<br />
make rebuild-package-task-base<br />
make openmoko-devel-image<br />
make build-qemu<br />
make flash-qemu-local<br />
<br />
Now all you have to do is run qemu.<br />
make run-qemu<br />
<br />
From here after you calibrate your stylus, you click onthe Menu in the top right, click down to terminal, then just run your program.<br />
<pre><br />
root@fic-gta02:/$ myhelloworld<br />
Ello Poppet!<br />
</pre><br />
<br />
[[Category:Applications]]<br />
[[Category:OpenMoko]]<br />
[[Category:Developer]]</div>Bryce.Leohttp://wiki.openmoko.org/wiki/Talk:Customizing_the_Openmoko_DistributionTalk:Customizing the Openmoko Distribution2007-07-31T01:23:32Z<p>Bryce.Leo: </p>
<hr />
<div>Thanks for creating this page. It's exactly what I needed to know next. I managed to build everything from scratch and got qemu up and running, but wasn't sure about the next steps. This looks like it will be very useful. <br />
<br />
I've followed the instructions and it's all gone well, however I have hit a snag. I don't have the "rebuild-package-task-base" target in my Makefile.<br />
I hope I'm not missing something obvious.<br />
- [[User:markb|Mark B.]]<br />
<br />
*Hey Mark, I added a nice big bolded section to the wiki for the makefile where the first thing you should do is <code>make update-makefile</code> and that will update your make file to the new version which will have the rebuild-package target! Enjoy! --[[User:Bryce.Leo|Bryce.Leo]] 03:23, 31 July 2007 (CEST)<br />
<br />
* The 'rebuild-package-%' target (replace % with package name) was added to the Mokomakefile very recently. Just do a 'make update-makefile' to update your Mokomakefile before retrying :-) --[[User:Aevin|aevin]] 03:49, 30 July 2007 (CEST)<br />
----<br />
<br />
== question about MokoMakefile modification ==<br />
<br />
The section about adding local to the MokoMakefile says:<br />
<br />
export BBPATH="${OMDIR}/build:${OMDIR}/local:${OMDIR}/oe:${OMDIR}/openembedded"<br />
<br />
But shouldn't we have $${OMDIR}? That's what the makefile has.<br />
<br />
Also, if I update the MokoMakefile, won't it wipe out my changes?<br />
<br />
:You are supposed to edit the <code>setup-env</code> file it creates, not the <code>Makefile</code> itself. This way, it will only be overwritten if you repeat the initial setup steps, which shouldn't be needed most of the time. --[[User:CesarB|CesarB]] 01:03, 31 July 2007 (CEST)</div>Bryce.Leohttp://wiki.openmoko.org/wiki/Talk:Customizing_the_Openmoko_DistributionTalk:Customizing the Openmoko Distribution2007-07-31T01:23:06Z<p>Bryce.Leo: </p>
<hr />
<div>Thanks for creating this page. It's exactly what I needed to know next. I managed to build everything from scratch and got qemu up and running, but wasn't sure about the next steps. This looks like it will be very useful. <br />
<br />
I've followed the instructions and it's all gone well, however I have hit a snag. I don't have the "rebuild-package-task-base" target in my Makefile.<br />
I hope I'm not missing something obvious.<br />
- [[User:markb|Mark B.]]<br />
<br />
*Hey Mark, I added a nice big bolded section to the wiki for the makefile where the first thing you should do is <code>make update-makefile</code> and that will update your make file to the new version which will have the rebuild-packgae target! Enjoy! --[[User:Bryce.Leo|Bryce.Leo]] 03:23, 31 July 2007 (CEST)<br />
<br />
* The 'rebuild-package-%' target (replace % with package name) was added to the Mokomakefile very recently. Just do a 'make update-makefile' to update your Mokomakefile before retrying :-) --[[User:Aevin|aevin]] 03:49, 30 July 2007 (CEST)<br />
----<br />
<br />
== question about MokoMakefile modification ==<br />
<br />
The section about adding local to the MokoMakefile says:<br />
<br />
export BBPATH="${OMDIR}/build:${OMDIR}/local:${OMDIR}/oe:${OMDIR}/openembedded"<br />
<br />
But shouldn't we have $${OMDIR}? That's what the makefile has.<br />
<br />
Also, if I update the MokoMakefile, won't it wipe out my changes?<br />
<br />
:You are supposed to edit the <code>setup-env</code> file it creates, not the <code>Makefile</code> itself. This way, it will only be overwritten if you repeat the initial setup steps, which shouldn't be needed most of the time. --[[User:CesarB|CesarB]] 01:03, 31 July 2007 (CEST)</div>Bryce.Leohttp://wiki.openmoko.org/wiki/Customizing_the_Openmoko_DistributionCustomizing the Openmoko Distribution2007-07-30T18:46:40Z<p>Bryce.Leo: </p>
<hr />
<div>== What's the goal? ==<br />
<br />
The goal of this page is to teach you how to take an application that you've coded (or the sample app) and properly get it included in your rootfs. This article is a bit of an aggregate page, it's going to take information from [[MokoMakefile]], [[User:CesarB/Using a local overlay|Using a local overlay]], [[Building a hello world application]], and [[Create a package from existing sources]]. So as you can see the goal is for it to be a very thorough introduction, and will take you from "Idea to Inclusion" of your application.<br />
<br />
<br />
== Setting Up the OpenMoko Environment ==<br />
<br />
{| border="1" cellspacing="0" cellpadding="5" <br />
|*If you already have the environment setup then it is imperative that you update your Makefile.<br />
Do this by running:<br />
<pre>make update-makefile</pre><br />
|}<br />
<br />
This part of the tutorial is going to be pretty basic. I absolutely love [[MokoMakefile]], it's fantastic, the creator has done and continues to do a fantastic job with this. I see absolutely no reason not to use it. However I cannot for the life of me understand why they create their working directory in /home/moko, the home directory is for home directories for users of your system, not for a development directory. I put my OpenMoko development directory in /home/bryce/mokodev/ and that works great for me, and also makes more sense so that multiple users on my machine could develop with no attempt to overlap.<br />
<br />
To get your environment setup please get it setup according to [[MokoMakefile]] however if you do have the build environment setup manually and you're sure you know what you're doing then feel free to go forward with this.<br />
<br />
== Setting Up a Local Overlay ==<br />
If you're at the point for setting up a local overlay this means a couple things. First: You've had a brilliant idea for an application that you just need to have on the OpenMoko platform. Second: You realize that this killer app of yours needs to be done properly and you're not going to do anything silly like include it in the actual tree for the OpenMoko distro because it would probably end up just getting overwritten eventually, or you just realize that it's bad practice!<br />
<br />
If you're wondering why and what a local overlay is then let me take this time to explain it to you. A local overlay is where you, as a developer keep your local files in an OE style setup so that you can simply pull your updated code into the tree. You add your overlay tree into the bitbake setup so that when you call bitbake it will pull your own or your customized packages before going to the OE or OpenMoko trees.This keeps everything nice and organized for you and also allows you to build/rebuild/include you apps by using the [[MokoMakefile]]<br />
<br />
Thank you to [[User:CesarB]] for this part of the wiki.<br />
<br />
To create a local overlay:<br />
<br />
* Create a "local" directory and its subdirectories<br />
<br />
mkdir local local/conf local/classes local/packages<br />
<br />
* Copy <code>site.conf</code> from the openmoko tree to <code>local/conf</code><br />
<br />
cp oe/conf/site.conf local/conf/site.conf<br />
<br />
* Edit the site.conf you copied to add the new tree as a source for bitbake recipes.<br />
<br />
Change the current <code>BBFILES</code> to look like this:<br />
BBFILES := "${OMDIR}/openembedded/packages/*/*.bb ${OMDIR}/oe/packages/*/*.bb ${OMDIR}/local/packages/*/*.bb"<br />
Change your <code>BBFILE_COLLECTIONS</code> line to look like this:<br />
BBFILE_COLLECTIONS = "upstream local overlay"<br />
Add this line:<br />
BBFILE_PATTERN_overlay = "^${OMDIR}/local/"<br />
Add this line:<br />
BBFILE_PRIORITY_overlay = "20"<br />
<br />
The <code>BBFILE_PRIORITY</code> should be greater than all the other <code>BBFILE_PRIORITY</code> variables on the same file.<br />
<br />
* Change your <code>BBPATH</code> environment variable to add the new tree ''before'' the two others for [[MokoMakefile]], the variable is on the <code>setup-env</code> file.<br />
<br />
export BBPATH="${OMDIR}/build:${OMDIR}/local:${OMDIR}/oe:${OMDIR}/openembedded"<br />
<br />
== Using Your New Local Overlay ==<br />
<br />
=== Changing files in conf/ ===<br />
<br />
To change a file in conf/, just copy the file to the overlay tree (preserving the directory structure) and edit it.<br />
<br />
=== Changing files in classes/ ===<br />
<br />
To change a file in classes/, just copy the file to the overlay tree and edit it.<br />
<br />
=== Changing packages ===<br />
<br />
Changing a package's recipe is a bit more complex. You have to copy over (or symlink) not only the .bb file for the package, but also ''all'' the files it includes with <code>require</code>, and the <code>FILESDIR</code> directories (all directories referred to by <code>FILESDIR</code>, usually named either ''package''-''version'' or <code>files</code>). If you forget one of them, the build will give an error (either when parsing the recipe in the case of <code>require</code>, or when trying to build in the case of the <code>FILESDIR</code> directories).<br />
<br />
=== Adding a new package ===<br />
<br />
You can add a new package (or a recipe for a new version of a package) to the overlay tree simply by creating it on the overlay tree.<br />
<br />
== Your First Application ==<br />
<br />
I know that I said I'd have a GDK application in here, however, I'd really like to get this whole course done first and have you guys starting to code instead of just looking at what I've written!<br />
<br />
This will be a very simple CLI hello world.<br />
<br />
=== Before We Code ===<br />
<br />
Like a good coder you want to make sure that you're not just doing things, but that you're doing them the right way! <br />
<br />
Now change directories into your <code>local/packages</code> directory.The following commands expect you'll be in that directory so don't change unless you know what you're doing!<br />
<br />
You'll want to make a directory with the name of your application, and a subdirectory called files.<br />
mkdir myhelloworld myhelloworld/files<br />
Now you'll want to create two files in the <code>files</code> directory<br />
touch myhelloworld/files/README.txt myhelloworld/files/myhelloworld.c<br />
And finally you'll want to create a bitbake file.<br />
touch myhelloworld/myhelloworld.bb<br />
<br />
Alrighty now all your necessary files are created so lets go over this real quick.<br />
<pre><br />
$HOME<br />
+- $OMDIR (contains the official openmoko tree)<br />
| +- local/<br />
| +- packages/<br />
| +- myhelloworld/<br />
| +- myhelloworld.bb<br />
| +- files/<br />
| +- myhelloworld.c<br />
| +- README.txt<br />
</pre><br />
<br />
That should be your structure, if it's not you should go and fix it up.<br />
=== Filling the Files ===<br />
<br />
So you've got your sample files all laid out now it's time to make them actually do something.<br />
<br />
myhelloworld.c<br />
<pre><br />
#include <stdio.h><br />
<br />
int main(int argc, char** argv)<br />
{<br />
printf("Ello Poppet!\n");<br />
return 0;<br />
}<br />
</pre><br />
<br />
README.txt<br />
<pre><br />
This is a command line application. It prints a simple Hello World! To stdout.<br />
</pre><br />
<br />
myhelloworld.bb<br />
<pre><br />
DESCRIPTION = "A killer hello world application"<br />
AUTHOR = "Bryce Leo"<br />
HOMEPAGE = ""<br />
SECTION = "console/applications"<br />
PRIORITY = "optional"<br />
LICENSE = "MIT"<br />
#DEPENDS = ""<br />
#RDEPENDS = ""<br />
#RRECOMMENDS = ""<br />
#RCONFLICTS = ""<br />
#SRCDATE = "20070729"<br />
#PV = "0.1"<br />
#PR = "r0"<br />
SRC_URI = "file://myhelloworld.c \<br />
file://README.txt "<br />
<br />
S = "${WORKDIR}/myhelloworld/"<br />
<br />
do_compile() {<br />
${CC} ${CFLAGS} ${LDFLAGS} ${WORKDIR}/myhelloworld.c -o myhelloworld<br />
}<br />
<br />
do_install() {<br />
install -m 0755 -d ${D}${bindir} ${D}${docdir}/myhelloworld<br />
install -m 0755 ${S}/myhelloworld ${D}${bindir}<br />
install -m 0644 ${WORKDIR}/README.txt ${D}${docdir}/myhelloworld<br />
}<br />
<br />
</pre><br />
<br />
=== Your First Compilation ===<br />
<br />
This is where the [[MokoMakefile]] comes in very very handy. Change to your ${OMDIR} directory, You'll know it by the fact that it is where <code>Makefile</code> resides.<br />
make build-package-myhelloworld<br />
This should all come back and not return any error messages, The output should end in something similar to<br />
<pre><br />
NOTE: package myhelloworld-1.0: completed<br />
NOTE: build 200707291926: completed<br />
Build statistics:<br />
Attempted builds: 1<br />
</pre><br />
<br />
Now that no errors were thrown we are happily done!<br />
<br />
== Adding Your Application to the Image ==<br />
<br />
So you've had an idea, you've setup the build environment, you've setup your local overlay, you've laid out your application tree, you've put code into those fantastic files of yours and now it compiles.There's only one thing left to do. Add that application to your image.<br />
<br />
Now lets go over in words and whys what we're about to do. First we need to make modify the <code>${OMDIR}/build/conf/local.conf</code>. We add in the variable <code>DISTRO_EXTRA_RDEPENDS</code> and set its value to include <code>myhelloworld</code>. If you'd like to include other packages from your own overlay or the OM tree just add them inseparated by spaces. After this gets added as a dependency to build the Distro (in this case OpenMoko). Now we have to re-build the task-base package. This essentially just generates an ipk file that will "Merge machine and distro options to create a basic machine task/package." It pretty much builds a file with a list of packages to be installed that are required for the distro to work correctly. So then you just go through and make <code>openmoko-devel-image, build-qemu, flash-qemu-local,</code> and <code>run-qemu</code>. Then calibrate your stylus, head over to the terminal, and run your application!<br />
<br />
=== Modifying Your local.conf ===<br />
Now, go into your build config directory <code>${OMDIR}/build/conf/</code> and now you'll be editing <code>local.conf</code><br />
Add this line to you <code>local.conf</code><br />
DISTRO_EXTRA_RDEPENDS += "myhelloworld"<br />
With this line you can also include other applications from the OE tree. For instance my <code>local.conf</code> looks like this.<br />
<pre><br />
MACHINE = "fic-gta01"<br />
DISTRO = "openmoko"<br />
BUILD_ARCH = "i686"<br />
SRCDATE_eds-dbus = "now"<br />
DISTRO_EXTRA_RDEPENDS += "lua dillo myhelloworld"<br />
</pre><br />
<br />
Now that you've fixed your <code>local.conf</code> it's time to go through all the necessary tasks to add and re-build you image and have your sweet package included.<br />
<br />
=== Building ===<br />
Now come the easy part thanks to [[MokoMakefile]]. <br />
<br />
make rebuild-package-task-base<br />
make openmoko-devel-image<br />
make build-qemu<br />
make flash-qemu-local<br />
<br />
Now all you have to do is run qemu.<br />
make run-qemu<br />
<br />
From here after you calibrate your stylus, you click onthe Menu in the top right, click down to terminal, then just run your program.<br />
<pre><br />
root@fic-gta02:/$ myhelloworld<br />
Ello Poppet!<br />
</pre><br />
<br />
[[Category:Applications]]<br />
[[Category:OpenMoko]]<br />
[[Category:Developer]]</div>Bryce.Leohttp://wiki.openmoko.org/wiki/Customizing_the_Openmoko_DistributionCustomizing the Openmoko Distribution2007-07-30T13:53:20Z<p>Bryce.Leo: </p>
<hr />
<div>== What's the goal? ==<br />
<br />
The goal of this page is to teach you how to take an application that you've coded (or the sample app) and properly get it included in your rootfs. This article is a bit of an aggregate page, it's going to take information from [[MokoMakefile]], [[User:CesarB/Using a local overlay|Using a local overlay]], [[Building a hello world application]], and [[Create a package from existing sources]]. So as you can see the goal is for it to be a very thorough introduction, and will take you from "Idea to Inclusion" of your application.<br />
<br />
<br />
== Setting Up the OpenMoko Environment ==<br />
<br />
{| border="1" cellspacing="0" cellpadding="5" <br />
|*If you already have the environment setup then it is imperative that you update your Makefile.<br />
Do this by running:<br />
<pre>make update-makefile</pre><br />
|}<br />
<br />
This part of the tutorial is going to be pretty basic. I absolutely love [[MokoMakefile]], it's fantastic, the creator has done and continues to do a fantastic job with this. I see absolutely no reason not to use it. However I cannot for the life of me understand why they create their working directory in /home/moko, the home directory is for home directories for users of your system, not for a development directory. I put my OpenMoko development directory in /home/bryce/mokodev/ and that works great for me, and also makes more sense so that multiple users on my machine could develop with no attempt to overlap.<br />
<br />
To get your environment setup please get it setup according to [[MokoMakefile]] however if you do have the build environment setup manually and you're sure you know what you're doing then feel free to go forward with this.<br />
<br />
== Setting Up a Local Overlay ==<br />
If you're at the point for setting up a local overlay this means a couple things. First: You've had a brilliant idea for an application that you just need to have on the OpenMoko platform. Second: You realize that this killer app of yours needs to be done properly and you're not going to do anything silly like include it in the actual tree for the OpenMoko distro because it would probably end up just getting overwritten eventually, or you just realize that it's bad practice!<br />
<br />
If you're wondering why and what a local overlay is then let me take this time to explain it to you. A local overlay is where you, as a developer keep your local files in an OE style setup so that you can simply pull your updated code into the tree. You add your overlay tree into the bitbake setup so that when you call bitbake it will pull your own or your customized packages before going to the OE or OpenMoko trees.This keeps everything nice and organized for you and also allows you to build/rebuild/include you apps by using the [[MokoMakefile]]<br />
<br />
Thank you to [[User:CesarB]] for this part of the wiki.<br />
<br />
To create a local overlay:<br />
<br />
* Create a "local" directory and its subdirectories<br />
<br />
mkdir local local/conf local/classes local/packages<br />
<br />
* Copy <code>site.conf</code> from the openmoko tree to <code>local/conf</code><br />
<br />
cp oe/conf/site.conf local/conf/site.conf<br />
<br />
* Edit the site.conf you copied to add the new tree as a source for bitbake recipes.<br />
<br />
Change the current <code>BBFILES</code> to look like this:<br />
BBFILES := "${OMDIR}/openembedded/packages/*/*.bb ${OMDIR}/oe/packages/*/*.bb ${OMDIR}/local/packages/*/*.bb"<br />
Change your <code>BBFILE_COLLECTIONS</code> line to look like this:<br />
BBFILE_COLLECTIONS = "upstream local overlay"<br />
Add this line:<br />
BBFILE_PATTERN_overlay = "^${OMDIR}/local/"<br />
Add this line:<br />
BBFILE_PRIORITY_overlay = "20"<br />
<br />
The <code>BBFILE_PRIORITY</code> should be greater than all the other <code>BBFILE_PRIORITY</code> variables on the same file.<br />
<br />
* Change your <code>BBPATH</code> environment variable to add the new tree ''before'' the two others for [[MokoMakefile]], the variable is on the <code>setup-env</code> file.<br />
<br />
export BBPATH="${OMDIR}/build:${OMDIR}/local:${OMDIR}/oe:${OMDIR}/openembedded"<br />
<br />
== Using Your New Local Overlay ==<br />
<br />
=== Changing files in conf/ ===<br />
<br />
To change a file in conf/, just copy the file to the overlay tree (preserving the directory structure) and edit it.<br />
<br />
=== Changing files in classes/ ===<br />
<br />
To change a file in classes/, just copy the file to the overlay tree and edit it.<br />
<br />
=== Changing packages ===<br />
<br />
Changing a package's recipe is a bit more complex. You have to copy over (or symlink) not only the .bb file for the package, but also ''all'' the files it includes with <code>require</code>, and the <code>FILESDIR</code> directories (all directories referred to by <code>FILESDIR</code>, usually named either ''package''-''version'' or <code>files</code>). If you forget one of them, the build will give an error (either when parsing the recipe in the case of <code>require</code>, or when trying to build in the case of the <code>FILESDIR</code> directories).<br />
<br />
=== Adding a new package ===<br />
<br />
You can add a new package (or a recipe for a new version of a package) to the overlay tree simply by creating it on the overlay tree.<br />
<br />
== Your First Application ==<br />
<br />
I know that I said I'd have a GDK application in here, however, I'd really like to get this whole course done first and have you guys starting to code instead of just looking at what I've written!<br />
<br />
This will be a very simple CLI hello world.<br />
<br />
=== Before We Code ===<br />
<br />
Like a good coder you want to make sure that you're not just doing things, but that you're doing them the right way! <br />
<br />
Now change directories into your <code>local/packages</code> directory.The following commands expect you'll be in that directory so don't change unless you know what you're doing!<br />
<br />
You'll want to make a directory with the name of your application, and a subdirectory called files.<br />
mkdir myhelloworld myhelloworld/files<br />
Now you'll want to create two files in the <code>files</code> directory<br />
touch myhelloworld/files/README.txt myhelloworld/files/myhelloworld.c<br />
And finally you'll want to create a bitbake file.<br />
touch myhelloworld/myhelloworld.bb<br />
<br />
Alrighty now all your necessary files are created so lets go over this real quick.<br />
<pre><br />
$HOME<br />
+- $OMDIR (contains the official openmoko tree)<br />
| +- local/<br />
| +- packages/<br />
| +- myhelloworld/<br />
| +- myhelloworld.bb<br />
| +- files/<br />
| +- myhelloworld.c<br />
| +- README.txt<br />
</pre><br />
<br />
That should be your structure, if it's not you should go and fix it up.<br />
=== Filling the Files ===<br />
<br />
So you've got your sample files all laid out now it's time to make them actually do something.<br />
<br />
myhelloworld.c<br />
<pre><br />
#include <stdio.h><br />
<br />
int main(int argc, char** argv)<br />
{<br />
printf("Ello Poppet!\n");<br />
return 0;<br />
}<br />
</pre><br />
<br />
README.txt<br />
<pre><br />
This is a command line application. It prints a simple Hello World! To stdout.<br />
</pre><br />
<br />
myhelloworld.bb<br />
<pre><br />
DESCRIPTION = "A killer hello world application"<br />
AUTHOR = "Bryce Leo"<br />
HOMEPAGE = ""<br />
SECTION = "console/applications"<br />
PRIORITY = "optional"<br />
LICENSE = "MIT"<br />
#DEPENDS = ""<br />
#RDEPENDS = ""<br />
#RRECOMMENDS = ""<br />
#RCONFLICTS = ""<br />
#SRCDATE = "20070729"<br />
#PV = "0.1"<br />
#PR = "r0"<br />
SRC_URI = "file://myhelloworld.c \<br />
file://README.txt "<br />
<br />
S = "${WORKDIR}/myhelloworld/"<br />
<br />
do_compile() {<br />
${CC} ${CFLAGS} ${LDFLAGS} ${WORKDIR}/myhelloworld.c -o myhelloworld<br />
}<br />
<br />
do_install() {<br />
install -m 0755 -d ${D}${bindir} ${D}${docdir}/myhelloworld<br />
install -m 0755 ${S}/myhelloworld ${D}${bindir}<br />
install -m 0644 ${WORKDIR}/README.txt ${D}${docdir}/myhelloworld<br />
}<br />
<br />
</pre><br />
<br />
=== Your First Compilation ===<br />
<br />
This is where the [[MokoMakefile]] comes in very very handy. Change to your ${OMDIR} directory, You'll know it by the fact that it is where <code>Makefile</code> resides.<br />
make build-package-myhelloworld<br />
This should all come back and not return any error messages, The output should end in something similar to<br />
<pre><br />
NOTE: package myhelloworld-1.0: completed<br />
NOTE: build 200707291926: completed<br />
Build statistics:<br />
Attempted builds: 1<br />
</pre><br />
<br />
Now that no errors were thrown we are happily done!<br />
<br />
== Adding Your Application to the Image ==<br />
<br />
So you've had an idea, you've setup the build environment, you've setup your local overlay, you've laid out your application tree, you've put code into those fantastic files of yours and now it compiles.There's only one thing left to do. Add that application to your image.<br />
<br />
Now lets go over in words and whys what we're about to do. First we need to make modify the <code>${OMDIR}/build/conf/local.conf</code>. We add in the variable <code>DISTRO_EXTRA_RDEPENDS</code> and set its value to include <code>myhelloworld</code>. If you'd like to include other packages from your own overlay or the OM tree just add them inseparated by spaces. After this gets added as a dependency to build the Distro (in this case OpenMoko). Now we have to re-build the task-base package. This essentially just generates an ipk file that will "Merge machine and distro options to create a basic machine task/package." It pretty much builds a file with a list of packages to be installed that are required for the distro to work correctly. So then you just go through and make <code>openmoko-devel-image, build-qemu, flash-qemu-local,</code> and <code>run-qemu</code>. Then calibrate your stylus, head over to the terminal, and run your application!<br />
<br />
=== Modifying Your local.conf ===<br />
Now, go into your build config directory <code>${OMDIR}/build/conf/</code> and now you'll be editing <code>local.conf</code><br />
Add this line to you <code>local.conf</code><br />
DISTRO_EXTRA_RDEPENDS += "myhelloworld"<br />
With this line you can also include other applications from the OE tree. For instance my <code>local.conf</code> looks like this.<br />
<pre><br />
MACHINE = "fic-gta01"<br />
DISTRO = "openmoko"<br />
BUILD_ARCH = "i686"<br />
SRCDATE_eds-dbus = "now"<br />
DISTRO_EXTRA_RDEPENDS += "lua dillo myhelloworld"<br />
</pre><br />
<br />
Now that you've fixed your <code>local.conf</code> it's time to go through all the necessary tasks to add and re-build you image and have your sweet package included.<br />
<br />
=== Building ===<br />
Now come the easy part thanks to [[MokoMakefile]]. <br />
<br />
make rebuild-package-task-base<br />
make openmoko-devel-image<br />
make build-qemu<br />
make flash-qemu-local<br />
<br />
Now all you have to do is run qemu.<br />
make run-qemu<br />
<br />
From here after you calibrate your stylus, you click onthe Menu in the top right, click down to terminal, then just run your program.<br />
<pre><br />
root@fic-gta02:/$ myhelloworld<br />
Ello Poppet!<br />
</pre><br />
<br />
[[Category:Applications]]<br />
[[Category:Developer]]</div>Bryce.Leohttp://wiki.openmoko.org/wiki/Customizing_the_Openmoko_DistributionCustomizing the Openmoko Distribution2007-07-30T01:47:30Z<p>Bryce.Leo: /* Setting Up the OpenMoko Environment */</p>
<hr />
<div>== What's the goal? ==<br />
<br />
The goal of this page is to teach you how to take an application that you've coded (or the sample app) and properly get it included in your rootfs. This article is a bit of an aggregate page, it's going to take information from [[MokoMakefile]], [[User:CesarB/Using a local overlay|Using a local overlay]], [[Building a hello world application]], and [[Create a package from existing sources]]. So as you can see the goal is for it to be a very thorough introduction, and will take you from "Idea to Inclusion" of your application.<br />
<br />
<br />
== Setting Up the OpenMoko Environment ==<br />
<br />
{| border="1" cellspacing="0" cellpadding="5" <br />
|*If you already have the environment setup then it is interpretive that you update your Makefile.<br />
Do this by running:<br />
<pre>make update-makefile</pre><br />
|}<br />
<br />
This part of the tutorial is going to be pretty basic. I absolutely love [[MokoMakefile]], it's fantastic, the creator has done and continues to do a fantastic job with this. I see absolutely no reason not to use it. However I cannot for the life of me understand why they create their working directory in /home/moko, the home directory is for home directories for users of your system, not for a development directory. I put my OpenMoko development directory in /home/bryce/mokodev/ and that works great for me, and also makes more sense so that multiple users on my machine could develop with no attempt to overlap.<br />
<br />
To get your environment setup please get it setup according to [[MokoMakefile]] however if you do have the build environment setup manually and you're sure you know what you're doing then feel free to go forward with this.<br />
<br />
== Setting Up a Local Overlay ==<br />
If you're at the point for setting up a local overlay this means a couple things. First: You've had a brilliant idea for an application that you just need to have on the OpenMoko platform. Second: You realize that this killer app of yours needs to be done properly and you're not going to do anything silly like include it in the actual tree for the OpenMoko distro because it would probably end up just getting overwritten eventually, or you just realize that it's bad practice!<br />
<br />
If you're wondering why and what a local overlay is then let me take this time to explain it to you. A local overlay is where you, as a developer keep your local files in an OE style setup so that you can simply pull your updated code into the tree. You add your overlay tree into the bitbake setup so that when you call bitbake it will pull your own or your customized packages before going to the OE or OpenMoko trees.This keeps everything nice and organized for you and also allows you to build/rebuild/include you apps by using the [[MokoMakefile]]<br />
<br />
Thank you to [[User:CesarB]] for this part of the wiki.<br />
<br />
To create a local overlay:<br />
<br />
* Create a "local" directory and its subdirectories<br />
<br />
mkdir local local/conf local/classes local/packages<br />
<br />
* Copy <code>site.conf</code> from the openmoko tree to <code>local/conf</code><br />
<br />
cp oe/conf/site.conf local/conf/site.conf<br />
<br />
* Edit the site.conf you copied to add the new tree as a source for bitbake recipes.<br />
<br />
Change the current <code>BBFILES</code> to look like this:<br />
BBFILES := "${OMDIR}/openembedded/packages/*/*.bb ${OMDIR}/oe/packages/*/*.bb ${OMDIR}/local/packages/*/*.bb"<br />
Change your <code>BBFILE_COLLECTIONS</code> line to look like this:<br />
BBFILE_COLLECTIONS = "upstream local overlay"<br />
Add this line:<br />
BBFILE_PATTERN_overlay = "^${OMDIR}/local/"<br />
Add this line:<br />
BBFILE_PRIORITY_overlay = "20"<br />
<br />
The <code>BBFILE_PRIORITY</code> should be greater than all the other <code>BBFILE_PRIORITY</code> variables on the same file.<br />
<br />
* Change your <code>BBPATH</code> environment variable to add the new tree ''before'' the two others for [[MokoMakefile]], the variable is on the <code>setup-env</code> file.<br />
<br />
export BBPATH="${OMDIR}/build:${OMDIR}/local:${OMDIR}/oe:${OMDIR}/openembedded"<br />
<br />
== Using Your New Local Overlay ==<br />
<br />
=== Changing files in conf/ ===<br />
<br />
To change a file in conf/, just copy the file to the overlay tree (preserving the directory structure) and edit it.<br />
<br />
=== Changing files in classes/ ===<br />
<br />
To change a file in classes/, just copy the file to the overlay tree and edit it.<br />
<br />
=== Changing packages ===<br />
<br />
Changing a package's recipe is a bit more complex. You have to copy over (or symlink) not only the .bb file for the package, but also ''all'' the files it includes with <code>require</code>, and the <code>FILESDIR</code> directories (all directories referred to by <code>FILESDIR</code>, usually named either ''package''-''version'' or <code>files</code>). If you forget one of them, the build will give an error (either when parsing the recipe in the case of <code>require</code>, or when trying to build in the case of the <code>FILESDIR</code> directories).<br />
<br />
=== Adding a new package ===<br />
<br />
You can add a new package (or a recipe for a new version of a package) to the overlay tree simply by creating it on the overlay tree.<br />
<br />
== Your First Application ==<br />
<br />
I know that I said I'd have a GDK application in here, however, I'd really like to get this whole course done first and have you guys starting to code instead of just looking at what I've written!<br />
<br />
This will be a very simple CLI hello world.<br />
<br />
=== Before We Code ===<br />
<br />
Like a good coder you want to make sure that you're not just doing things, but that you're doing them the right way! <br />
<br />
Now change directories into your <code>local/packages</code> directory.The following commands expect you'll be in that directory so don't change unless you know what you're doing!<br />
<br />
You'll want to make a directory with the name of your application, and a subdirectory called files.<br />
mkdir myhelloworld myhelloworld/files<br />
Now you'll want to create two files in the <code>files</code> directory<br />
touch myhelloworld/files/README.txt myhelloworld/files/myhelloworld.c<br />
And finally you'll want to create a bitbake file.<br />
touch myhelloworld/myhelloworld.bb<br />
<br />
Alrighty now all your necessary files are created so lets go over this real quick.<br />
<pre><br />
$HOME<br />
+- $OMDIR (contains the official openmoko tree)<br />
| +- local/<br />
| +- packages/<br />
| +- myhelloworld/<br />
| +- myhelloworld.bb<br />
| +- files/<br />
| +- myhelloworld.c<br />
| +- README.txt<br />
</pre><br />
<br />
That should be your structure, if it's not you should go and fix it up.<br />
=== Filling the Files ===<br />
<br />
So you've got your sample files all laid out now it's time to make them actually do something.<br />
<br />
myhelloworld.c<br />
<pre><br />
#include <stdio.h><br />
<br />
int main(int argc, char** argv)<br />
{<br />
printf("Ello Poppet!\n");<br />
return 0;<br />
}<br />
</pre><br />
<br />
README.txt<br />
<pre><br />
This is a command line application. It prints a simple Hello World! To stdout.<br />
</pre><br />
<br />
myhelloworld.bb<br />
<pre><br />
DESCRIPTION = "A killer hello world applicaiton"<br />
AUTHOR = "Bryce Leo"<br />
HOMEPAGE = ""<br />
SECTION = "console/applications"<br />
PRIORITY = "optional"<br />
LICENSE = "MIT"<br />
#DEPENDS = ""<br />
#RDEPENDS = ""<br />
#RRECOMMENDS = ""<br />
#RCONFLICTS = ""<br />
#SRCDATE = "20070729"<br />
#PV = "0.1"<br />
#PR = "r0"<br />
SRC_URI = "file://myhelloworld.c \<br />
file://README.txt "<br />
<br />
S = "${WORKDIR}/myhelloworld/"<br />
<br />
do_compile() {<br />
${CC} ${CFLAGS} ${LDFLAGS} ${WORKDIR}/myhelloworld.c -o myhelloworld<br />
}<br />
<br />
do_install() {<br />
install -m 0755 -d ${D}${bindir} ${D}${docdir}/myhelloworld<br />
install -m 0755 ${S}/myhelloworld ${D}${bindir}<br />
install -m 0644 ${WORKDIR}/README.txt ${D}${docdir}/myhelloworld<br />
}<br />
<br />
</pre><br />
<br />
=== Your First Compilation ===<br />
<br />
This is where the [[MokoMakefile]] comes in very very handy. Change to your ${OMDIR} directory, You'll now it by the fact that it is where <code>Makefile</code> resides.<br />
make build-package-myhelloworld<br />
This should all come back and not return any error messages, The output should end in something similar to<br />
<pre><br />
NOTE: package myhelloworld-1.0: completed<br />
NOTE: build 200707291926: completed<br />
Build statistics:<br />
Attempted builds: 1<br />
</pre><br />
<br />
Now that no errors were thrown we are happily done!<br />
<br />
== Adding Your Application to the Image ==<br />
<br />
So you've had an idea, you've setup the build environment, you've setup your local overlway, you've laid out your application tree, you've put code into those fantastic files of yours and now it compiles.There's only one thing left to do. Add that application to your image.<br />
<br />
Now lets go over in words and whys what we're about to do. First we need to make modify the <code>${OMDIR}/build/conf/local.conf</code>. We add in the variable <code>DISTRO_EXTRA_RDEPENDS</code> and set its value to include <code>myhelloworld</code>. If you'd like to include other packages from your own overlay or the OM tree just add them inseparated by spaces. After this gets added as a dependency to build the Distro (in this case OpenMoko). Now we have to re-build the task-base package. This essentially just generates an ipk file that will "Merge machine and distro options to create a basic machine task/package." It pretty much builds a file with a list of packages to be installed that are required for the distro to work correctly. So then you just go through and make <code>openmoko-devel-image, build-qemu, flash-qemu-local,</code> and <code>run-qemu</code>. Then calibrate your stylus, head over to the terminal, and run your application!<br />
<br />
=== Modifying Your local.conf ===<br />
Now, go into your build config directory <code>${OMDIR}/build/conf/</code> and now you'll be editing <code>local.conf</code><br />
Add this line to you <code>local.conf</code><br />
DISTRO_EXTRA_RDEPENDS += "myhelloworld"<br />
With this line you can also include other applications from the OE tree. For instance my <code>local.conf</code> looks like this.<br />
<pre><br />
MACHINE = "fic-gta01"<br />
DISTRO = "openmoko"<br />
BUILD_ARCH = "i686"<br />
SRCDATE_eds-dbus = "now"<br />
DISTRO_EXTRA_RDEPENDS += "lua dillo myhelloworld"<br />
</pre><br />
<br />
Now that you've fixed your <code>local.conf</code> it's time to go through all the necessary tasks to add and re-build you image and have your sweet package included.<br />
<br />
=== Building ===<br />
Now come the easy part thanks to [[MokoMakefile]]. <br />
<br />
make rebuild-package-task-base<br />
make openmoko-devel-image<br />
make build-qemu<br />
make flash-qemu-local<br />
<br />
Now all you have to do is run qemu.<br />
make run-qemu<br />
<br />
From here after you calibrate your stylus, you click onthe Menu in the top right, click down to terminal, then just run your program.<br />
<pre><br />
root@fic-gta02:/$ myhelloworld<br />
Ello Poppet!<br />
</pre></div>Bryce.Leohttp://wiki.openmoko.org/wiki/Customizing_the_Openmoko_DistributionCustomizing the Openmoko Distribution2007-07-30T01:43:52Z<p>Bryce.Leo: /* Setting Up a Local Overlay */</p>
<hr />
<div>== What's the goal? ==<br />
<br />
The goal of this page is to teach you how to take an application that you've coded (or the sample app) and properly get it included in your rootfs. This article is a bit of an aggregate page, it's going to take information from [[MokoMakefile]], [[User:CesarB/Using a local overlay|Using a local overlay]], [[Building a hello world application]], and [[Create a package from existing sources]]. So as you can see the goal is for it to be a very thorough introduction, and will take you from "Idea to Inclusion" of your application.<br />
<br />
<br />
== Setting Up the OpenMoko Environment ==<br />
<br />
This part of the tutorial is going to be pretty basic. I absolutely love [[MokoMakefile]], it's fantastic, the creator has done and continues to do a fantastic job with this. I see absolutely no reason not to use it. However I cannot for the life of me understand why they create their working directory in /home/moko, the home directory is for home directories for users of your system, not for a development directory. I put my OpenMoko development directory in /home/bryce/mokodev/ and that works great for me, and also makes more sense so that multiple users on my machine could develop with no attempt to overlap.<br />
<br />
To get your environment setup please get it setup according to [[MokoMakefile]] however if you do have the build environment setup manually and you're sure you know what you're doing then feel free to go forward with this.<br />
<br />
== Setting Up a Local Overlay ==<br />
If you're at the point for setting up a local overlay this means a couple things. First: You've had a brilliant idea for an application that you just need to have on the OpenMoko platform. Second: You realize that this killer app of yours needs to be done properly and you're not going to do anything silly like include it in the actual tree for the OpenMoko distro because it would probably end up just getting overwritten eventually, or you just realize that it's bad practice!<br />
<br />
If you're wondering why and what a local overlay is then let me take this time to explain it to you. A local overlay is where you, as a developer keep your local files in an OE style setup so that you can simply pull your updated code into the tree. You add your overlay tree into the bitbake setup so that when you call bitbake it will pull your own or your customized packages before going to the OE or OpenMoko trees.This keeps everything nice and organized for you and also allows you to build/rebuild/include you apps by using the [[MokoMakefile]]<br />
<br />
Thank you to [[User:CesarB]] for this part of the wiki.<br />
<br />
To create a local overlay:<br />
<br />
* Create a "local" directory and its subdirectories<br />
<br />
mkdir local local/conf local/classes local/packages<br />
<br />
* Copy <code>site.conf</code> from the openmoko tree to <code>local/conf</code><br />
<br />
cp oe/conf/site.conf local/conf/site.conf<br />
<br />
* Edit the site.conf you copied to add the new tree as a source for bitbake recipes.<br />
<br />
Change the current <code>BBFILES</code> to look like this:<br />
BBFILES := "${OMDIR}/openembedded/packages/*/*.bb ${OMDIR}/oe/packages/*/*.bb ${OMDIR}/local/packages/*/*.bb"<br />
Change your <code>BBFILE_COLLECTIONS</code> line to look like this:<br />
BBFILE_COLLECTIONS = "upstream local overlay"<br />
Add this line:<br />
BBFILE_PATTERN_overlay = "^${OMDIR}/local/"<br />
Add this line:<br />
BBFILE_PRIORITY_overlay = "20"<br />
<br />
The <code>BBFILE_PRIORITY</code> should be greater than all the other <code>BBFILE_PRIORITY</code> variables on the same file.<br />
<br />
* Change your <code>BBPATH</code> environment variable to add the new tree ''before'' the two others for [[MokoMakefile]], the variable is on the <code>setup-env</code> file.<br />
<br />
export BBPATH="${OMDIR}/build:${OMDIR}/local:${OMDIR}/oe:${OMDIR}/openembedded"<br />
<br />
== Using Your New Local Overlay ==<br />
<br />
=== Changing files in conf/ ===<br />
<br />
To change a file in conf/, just copy the file to the overlay tree (preserving the directory structure) and edit it.<br />
<br />
=== Changing files in classes/ ===<br />
<br />
To change a file in classes/, just copy the file to the overlay tree and edit it.<br />
<br />
=== Changing packages ===<br />
<br />
Changing a package's recipe is a bit more complex. You have to copy over (or symlink) not only the .bb file for the package, but also ''all'' the files it includes with <code>require</code>, and the <code>FILESDIR</code> directories (all directories referred to by <code>FILESDIR</code>, usually named either ''package''-''version'' or <code>files</code>). If you forget one of them, the build will give an error (either when parsing the recipe in the case of <code>require</code>, or when trying to build in the case of the <code>FILESDIR</code> directories).<br />
<br />
=== Adding a new package ===<br />
<br />
You can add a new package (or a recipe for a new version of a package) to the overlay tree simply by creating it on the overlay tree.<br />
<br />
== Your First Application ==<br />
<br />
I know that I said I'd have a GDK application in here, however, I'd really like to get this whole course done first and have you guys starting to code instead of just looking at what I've written!<br />
<br />
This will be a very simple CLI hello world.<br />
<br />
=== Before We Code ===<br />
<br />
Like a good coder you want to make sure that you're not just doing things, but that you're doing them the right way! <br />
<br />
Now change directories into your <code>local/packages</code> directory.The following commands expect you'll be in that directory so don't change unless you know what you're doing!<br />
<br />
You'll want to make a directory with the name of your application, and a subdirectory called files.<br />
mkdir myhelloworld myhelloworld/files<br />
Now you'll want to create two files in the <code>files</code> directory<br />
touch myhelloworld/files/README.txt myhelloworld/files/myhelloworld.c<br />
And finally you'll want to create a bitbake file.<br />
touch myhelloworld/myhelloworld.bb<br />
<br />
Alrighty now all your necessary files are created so lets go over this real quick.<br />
<pre><br />
$HOME<br />
+- $OMDIR (contains the official openmoko tree)<br />
| +- local/<br />
| +- packages/<br />
| +- myhelloworld/<br />
| +- myhelloworld.bb<br />
| +- files/<br />
| +- myhelloworld.c<br />
| +- README.txt<br />
</pre><br />
<br />
That should be your structure, if it's not you should go and fix it up.<br />
=== Filling the Files ===<br />
<br />
So you've got your sample files all laid out now it's time to make them actually do something.<br />
<br />
myhelloworld.c<br />
<pre><br />
#include <stdio.h><br />
<br />
int main(int argc, char** argv)<br />
{<br />
printf("Ello Poppet!\n");<br />
return 0;<br />
}<br />
</pre><br />
<br />
README.txt<br />
<pre><br />
This is a command line application. It prints a simple Hello World! To stdout.<br />
</pre><br />
<br />
myhelloworld.bb<br />
<pre><br />
DESCRIPTION = "A killer hello world applicaiton"<br />
AUTHOR = "Bryce Leo"<br />
HOMEPAGE = ""<br />
SECTION = "console/applications"<br />
PRIORITY = "optional"<br />
LICENSE = "MIT"<br />
#DEPENDS = ""<br />
#RDEPENDS = ""<br />
#RRECOMMENDS = ""<br />
#RCONFLICTS = ""<br />
#SRCDATE = "20070729"<br />
#PV = "0.1"<br />
#PR = "r0"<br />
SRC_URI = "file://myhelloworld.c \<br />
file://README.txt "<br />
<br />
S = "${WORKDIR}/myhelloworld/"<br />
<br />
do_compile() {<br />
${CC} ${CFLAGS} ${LDFLAGS} ${WORKDIR}/myhelloworld.c -o myhelloworld<br />
}<br />
<br />
do_install() {<br />
install -m 0755 -d ${D}${bindir} ${D}${docdir}/myhelloworld<br />
install -m 0755 ${S}/myhelloworld ${D}${bindir}<br />
install -m 0644 ${WORKDIR}/README.txt ${D}${docdir}/myhelloworld<br />
}<br />
<br />
</pre><br />
<br />
=== Your First Compilation ===<br />
<br />
This is where the [[MokoMakefile]] comes in very very handy. Change to your ${OMDIR} directory, You'll now it by the fact that it is where <code>Makefile</code> resides.<br />
make build-package-myhelloworld<br />
This should all come back and not return any error messages, The output should end in something similar to<br />
<pre><br />
NOTE: package myhelloworld-1.0: completed<br />
NOTE: build 200707291926: completed<br />
Build statistics:<br />
Attempted builds: 1<br />
</pre><br />
<br />
Now that no errors were thrown we are happily done!<br />
<br />
== Adding Your Application to the Image ==<br />
<br />
So you've had an idea, you've setup the build environment, you've setup your local overlway, you've laid out your application tree, you've put code into those fantastic files of yours and now it compiles.There's only one thing left to do. Add that application to your image.<br />
<br />
Now lets go over in words and whys what we're about to do. First we need to make modify the <code>${OMDIR}/build/conf/local.conf</code>. We add in the variable <code>DISTRO_EXTRA_RDEPENDS</code> and set its value to include <code>myhelloworld</code>. If you'd like to include other packages from your own overlay or the OM tree just add them inseparated by spaces. After this gets added as a dependency to build the Distro (in this case OpenMoko). Now we have to re-build the task-base package. This essentially just generates an ipk file that will "Merge machine and distro options to create a basic machine task/package." It pretty much builds a file with a list of packages to be installed that are required for the distro to work correctly. So then you just go through and make <code>openmoko-devel-image, build-qemu, flash-qemu-local,</code> and <code>run-qemu</code>. Then calibrate your stylus, head over to the terminal, and run your application!<br />
<br />
=== Modifying Your local.conf ===<br />
Now, go into your build config directory <code>${OMDIR}/build/conf/</code> and now you'll be editing <code>local.conf</code><br />
Add this line to you <code>local.conf</code><br />
DISTRO_EXTRA_RDEPENDS += "myhelloworld"<br />
With this line you can also include other applications from the OE tree. For instance my <code>local.conf</code> looks like this.<br />
<pre><br />
MACHINE = "fic-gta01"<br />
DISTRO = "openmoko"<br />
BUILD_ARCH = "i686"<br />
SRCDATE_eds-dbus = "now"<br />
DISTRO_EXTRA_RDEPENDS += "lua dillo myhelloworld"<br />
</pre><br />
<br />
Now that you've fixed your <code>local.conf</code> it's time to go through all the necessary tasks to add and re-build you image and have your sweet package included.<br />
<br />
=== Building ===<br />
Now come the easy part thanks to [[MokoMakefile]]. <br />
<br />
make rebuild-package-task-base<br />
make openmoko-devel-image<br />
make build-qemu<br />
make flash-qemu-local<br />
<br />
Now all you have to do is run qemu.<br />
make run-qemu<br />
<br />
From here after you calibrate your stylus, you click onthe Menu in the top right, click down to terminal, then just run your program.<br />
<pre><br />
root@fic-gta02:/$ myhelloworld<br />
Ello Poppet!<br />
</pre></div>Bryce.Leohttp://wiki.openmoko.org/wiki/Customizing_the_Openmoko_DistributionCustomizing the Openmoko Distribution2007-07-30T00:36:10Z<p>Bryce.Leo: /* Setting Up a Local Overlay */</p>
<hr />
<div>== What's the goal? ==<br />
<br />
The goal of this page is to teach you how to take an application that you've coded (or the sample app) and properly get it included in your rootfs. This article is a bit of an aggregate page, it's going to take information from [[MokoMakefile]] [http://wiki.openmoko.org/wiki/User:CesarB/Using_a_local_overlay Using_a_local_overlay] [[Building_a_hello_world_application]] and [[Create_a_package_from_existing_sources]]. So as you can see the goal is for it to be a very thorough introduction, and will take you from "Idea to Inclusion" of your application.<br />
<br />
<br />
== Setting Up the OpenMoko Environment ==<br />
<br />
This part of the tutorial is going to be pretty basic. I absolutely love [[MokoMakefile]], it's fantastic, the creator has done and continues to do a fantastic job with this. I see absolutely no reason not to use it. However I cannot for the life of me understand why they create their working directory in /home/moko, the home directory is for home directories for users of your system, not for a development directory. I put my OpenMoko development directory in /home/bryce/mokodev/ and that works great for me, and also makes more sense so that multiple users on my machine could develop with no attempt to overlap.<br />
<br />
To get your environment setup please get it setup according to [[MokoMakefile]] however if you do have the build environment setup manually and you're sure you know what you're doing then feel free to go forward with this.<br />
<br />
== Setting Up a Local Overlay ==<br />
If you're at the point for setting up a local overlay this means a couple things. First: You've had a brilliant idea for an application that you just need to have on the OpenMoko platform. Second: You realize that this killer app of yours needs to be done properly and you're not going to do anything silly like include it in the actual tree for the OpenMoko distro because it would probably end up just getting overwritten eventually, or you just realize that it's bad practice!<br />
<br />
Thank you to [[User:CesarB]] for this part of the wiki.<br />
<br />
To create a local overlay:<br />
<br />
* Create a "local" directory and its subdirectories<br />
<br />
mkdir local local/conf local/classes local/packages<br />
<br />
* Copy <code>site.conf</code> from the openmoko tree to <code>local/conf</code><br />
<br />
cp oe/conf/site.conf local/conf/site.conf<br />
<br />
* Edit the site.conf you copied to add the new tree as a source for bitbake recipes.<br />
<br />
Change the current <code>BBFILES</code> to look like this:<br />
BBFILES := "${OMDIR}/openembedded/packages/*/*.bb ${OMDIR}/oe/packages/*/*.bb ${OMDIR}/local/packages/*/*.bb"<br />
Change your <code>BBFILE_COLLECTIONS</code> line to look like this:<br />
BBFILE_COLLECTIONS = "upstream local overlay"<br />
Add this line:<br />
BBFILE_PATTERN_overlay = "^${OMDIR}/local/"<br />
Add this line:<br />
BBFILE_PRIORITY_overlay = "20"<br />
<br />
The <code>BBFILE_PRIORITY</code> should be greater than all the other <code>BBFILE_PRIORITY</code> variables on the same file.<br />
<br />
* Change your <code>BBPATH</code> environment variable to add the new tree ''before'' the two others for [[MokoMakefile]], the variable is on the <code>setup-env</code> file.<br />
<br />
export BBPATH="${OMDIR}/build:${OMDIR}/local:${OMDIR}/oe:${OMDIR}/openembedded"<br />
<br />
== Using Your New Local Overlay ==<br />
<br />
=== Changing files in conf/ ===<br />
<br />
To change a file in conf/, just copy the file to the overlay tree (preserving the directory structure) and edit it.<br />
<br />
=== Changing files in classes/ ===<br />
<br />
To change a file in classes/, just copy the file to the overlay tree and edit it.<br />
<br />
=== Changing packages ===<br />
<br />
Changing a package's recipe is a bit more complex. You have to copy over (or symlink) not only the .bb file for the package, but also ''all'' the files it includes with <code>require</code>, and the <code>FILESDIR</code> directories (all directories referred to by <code>FILESDIR</code>, usually named either ''package''-''version'' or <code>files</code>). If you forget one of them, the build will give an error (either when parsing the recipe in the case of <code>require</code>, or when trying to build in the case of the <code>FILESDIR</code> directories).<br />
<br />
=== Adding a new package ===<br />
<br />
You can add a new package (or a recipe for a new version of a package) to the overlay tree simply by creating it on the overlay tree.<br />
<br />
== Your First Application ==<br />
<br />
I know that I said I'd have a GDK application in here, however, I'd really like to get this whole course done first and have you guys starting to code instead of just looking at what I've written!<br />
<br />
This will be a very simple CLI hello world.<br />
<br />
=== Before We Code ===<br />
<br />
Like a good coder you want to make sure that you're not just doing things, but that you're doing them the right way! <br />
<br />
Now change directories into your <code>local/packages</code> directory.The following commands expect you'll be in that directory so don't change unless you know what you're doing!<br />
<br />
You'll want to make a directory with the name of your application, and a subdirectory called files.<br />
mkdir myhelloworld myhelloworld/files<br />
Now you'll want to create two files in the <code>files</code> directory<br />
touch myhelloworld/files/READEME.txt myhelloworld/files/myhelloworld.c<br />
And finally you'll want to create a bitbake file.<br />
touch myhelloworld/myhelloworld.bb<br />
<br />
Alrighty now all your necessary files are created so lets go over this real quick.<br />
<pre><br />
$HOME<br />
+- $OMDIR (contains the official openmoko tree)<br />
| +- local/<br />
| +- packages/<br />
| +- myhelloworld/<br />
| +- myhelloworld.bb<br />
| +- files/<br />
| +- myhelloworld.c<br />
| +- README.txt<br />
</pre><br />
<br />
That should be your structure, if it's not you should go and fix it up.<br />
=== Filling the Files ===<br />
<br />
So you've got your sample files all laid out now it's time to make them actually do something.<br />
<br />
myhelloworld.c<br />
<pre><br />
#include <stdio.h><br />
<br />
int main(int argc, char** argv)<br />
{<br />
printf("Ello Poppet!\n");<br />
return 0;<br />
}<br />
</pre><br />
<br />
README.txt<br />
<pre><br />
This is a command line application. It prints a simple Hello World! To stdout.<br />
</pre><br />
<br />
myhelloworld.bb<br />
<pre><br />
DESCRIPTION = "A killer hello world applicaiton"<br />
AUTHOR = "Bryce Leo"<br />
HOMEPAGE = ""<br />
SECTION = "console/applications"<br />
PRIORITY = "optional"<br />
LICENSE = "MIT"<br />
#DEPENDS = ""<br />
#RDEPENDS = ""<br />
#RRECOMMENDS = ""<br />
#RCONFLICTS = ""<br />
#SRCDATE = "20070729"<br />
#PV = "0.1"<br />
#PR = "r0"<br />
SRC_URI = "file://myhelloworld.c \<br />
file://README.txt "<br />
<br />
S = "${WORKDIR}/myhelloworld/"<br />
<br />
do_compile() {<br />
${CC} ${CFLAGS} ${LDFLAGS} ${WORKDIR}/myhelloworld.c -o myhelloworld<br />
}<br />
<br />
do_install() {<br />
install -m 0755 -d ${D}${bindir} ${D}${docdir}/myhelloworld<br />
install -m 0755 ${S}/myhelloworld ${D}${bindir}<br />
install -m 0644 ${WORKDIR}/README.txt ${D}${docdir}/myhelloworld<br />
}<br />
<br />
</pre><br />
<br />
=== Your First Compilation ===<br />
<br />
This is where the [[MokoMakefile]] comes in very very handy. Change to your ${OMDIR} directory, You'll now it by the fact that it is where <code>Makefile</code> resides.<br />
make build-package-myhelloworld<br />
This should all come back and not return any error messages, The output should end in something similar to<br />
<pre><br />
NOTE: package myhelloworld-1.0: completed<br />
NOTE: build 200707291926: completed<br />
Build statistics:<br />
Attempted builds: 1<br />
</pre><br />
<br />
Now that no errors were thrown we are happily done!<br />
<br />
== Adding Your Application to the Image ==<br />
<br />
So you've had an idea, you've setup the build environment, you've setup your local overlway, you've laid out your application tree, you've put code into those fantastic files of yours and now it compiles.There's only one thing left to do. Add that application to your image.<br />
<br />
Now lets go over in words and whys what we're about to do. First we need to make modify the <code>${OMDIR}/build/conf/local.conf</code>. We add in the variable <code>DISTRO_EXTRA_RDEPENDS</code> and set its value to include <code>myhelloworld</code>. If you'd like to include other packages from your own overlay or the OM tree just add them inseparated by spaces. After this gets added as a dependency to build the Distro (in this case OpenMoko). Now we have to re-build the task-base package. This essentially just generates an ipk file that will "Merge machine and distro options to create a basic machine task/package." It pretty much builds a file with a list of packages to be installed that are required for the distro to work correctly. So then you just go through and make <code>openmoko-devel-image, build-qemu, flash-qemu-local,</code> and <code>run-qemu</code>. Then calibrate your stylus, head over to the terminal, and run your application!<br />
<br />
=== Modifying Your local.conf ===<br />
Now, go into your build config directory <code>${OMDIR}/build/conf/</code> and now you'll be editing <code>local.conf</code><br />
Add this line to you <code>local.conf</code><br />
DISTRO_EXTRA_RDEPENDS += "myhelloworld"<br />
With this line you can also include other applications from the OE tree. For instance my <code>local.conf</code> looks like this.<br />
<pre><br />
MACHINE = "fic-gta01"<br />
DISTRO = "openmoko"<br />
BUILD_ARCH = "i686"<br />
SRCDATE_eds-dbus = "now"<br />
DISTRO_EXTRA_RDEPENDS += "lua dillo myhelloworld"<br />
</pre><br />
<br />
Now that you've fixed your <code>local.conf</code> it's time to go through all the necessary tasks to add and re-build you image and have your sweet package included.<br />
<br />
=== Building ===<br />
Now come the easy part thanks to [[MokoMakefile]]. <br />
<br />
make rebuild-package-task-base<br />
make openmoko-devel-image<br />
make build-qemu<br />
make flash-qemu-local<br />
<br />
Now all you have to do is run qemu.<br />
make run-qemu<br />
<br />
From here after you calibrate your stylus, you click onthe Menu in the top right, click down to terminal, then just run your program.<br />
<pre><br />
root@fic-gta02:/$ myhelloworld<br />
Ello Poppet!<br />
</pre></div>Bryce.Leohttp://wiki.openmoko.org/wiki/Customizing_the_Openmoko_DistributionCustomizing the Openmoko Distribution2007-07-30T00:34:43Z<p>Bryce.Leo: /* Adding Your Application to the Image */</p>
<hr />
<div>== What's the goal? ==<br />
<br />
The goal of this page is to teach you how to take an application that you've coded (or the sample app) and properly get it included in your rootfs. This article is a bit of an aggregate page, it's going to take information from [[MokoMakefile]] [http://wiki.openmoko.org/wiki/User:CesarB/Using_a_local_overlay Using_a_local_overlay] [[Building_a_hello_world_application]] and [[Create_a_package_from_existing_sources]]. So as you can see the goal is for it to be a very thorough introduction, and will take you from "Idea to Inclusion" of your application.<br />
<br />
<br />
== Setting Up the OpenMoko Environment ==<br />
<br />
This part of the tutorial is going to be pretty basic. I absolutely love [[MokoMakefile]], it's fantastic, the creator has done and continues to do a fantastic job with this. I see absolutely no reason not to use it. However I cannot for the life of me understand why they create their working directory in /home/moko, the home directory is for home directories for users of your system, not for a development directory. I put my OpenMoko development directory in /home/bryce/mokodev/ and that works great for me, and also makes more sense so that multiple users on my machine could develop with no attempt to overlap.<br />
<br />
To get your environment setup please get it setup according to [[MokoMakefile]] however if you do have the build environment setup manually and you're sure you know what you're doing then feel free to go forward with this.<br />
<br />
== Setting Up a Local Overlay ==<br />
If you're at the point for setting up a local overlay this means a couple things. First: You've had a brilliant idea for an application that you just need to have on the OpenMoko platform. Second: You realize that this killer app of yours needs to be done properly and you're not going to do anything silly like include it in the actual tree for the OpenMoko distro because it would probably end up just getting overwritten eventually, or you just realize taht it's bad practice!<br />
<br />
Thank you to [[User:CesarB]] for this part of the wiki.<br />
<br />
To create a local overlay:<br />
<br />
* Create a "local" directory and its subdirectories<br />
<br />
mkdir local local/conf local/classes local/packages<br />
<br />
* Copy <code>site.conf</code> from the openmoko tree to <code>local/conf</code><br />
<br />
cp oe/conf/site.conf local/conf/site.conf<br />
<br />
* Edit the site.conf you copied to add the new tree as a source for bitbake recipes.<br />
<br />
Change the current <code>BBFILES</code> to look like this:<br />
BBFILES := "${OMDIR}/openembedded/packages/*/*.bb ${OMDIR}/oe/packages/*/*.bb ${OMDIR}/local/packages/*/*.bb"<br />
Change your <code>BBFILE_COLLECTIONS</code> line to look like this:<br />
BBFILE_COLLECTIONS = "upstream local overlay"<br />
Add this line:<br />
BBFILE_PATTERN_overlay = "^${OMDIR}/local/"<br />
Add this line:<br />
BBFILE_PRIORITY_overlay = "20"<br />
<br />
The <code>BBFILE_PRIORITY</code> should be greater than all the other <code>BBFILE_PRIORITY</code> variables on the same file.<br />
<br />
* Change your <code>BBPATH</code> environment variable to add the new tree ''before'' the two others for [[MokoMakefile]], the variable is on the <code>setup-env</code> file.<br />
<br />
export BBPATH="${OMDIR}/build:${OMDIR}/local:${OMDIR}/oe:${OMDIR}/openembedded"<br />
<br />
== Using Your New Local Overlay ==<br />
<br />
=== Changing files in conf/ ===<br />
<br />
To change a file in conf/, just copy the file to the overlay tree (preserving the directory structure) and edit it.<br />
<br />
=== Changing files in classes/ ===<br />
<br />
To change a file in classes/, just copy the file to the overlay tree and edit it.<br />
<br />
=== Changing packages ===<br />
<br />
Changing a package's recipe is a bit more complex. You have to copy over (or symlink) not only the .bb file for the package, but also ''all'' the files it includes with <code>require</code>, and the <code>FILESDIR</code> directories (all directories referred to by <code>FILESDIR</code>, usually named either ''package''-''version'' or <code>files</code>). If you forget one of them, the build will give an error (either when parsing the recipe in the case of <code>require</code>, or when trying to build in the case of the <code>FILESDIR</code> directories).<br />
<br />
=== Adding a new package ===<br />
<br />
You can add a new package (or a recipe for a new version of a package) to the overlay tree simply by creating it on the overlay tree.<br />
<br />
== Your First Application ==<br />
<br />
I know that I said I'd have a GDK application in here, however, I'd really like to get this whole course done first and have you guys starting to code instead of just looking at what I've written!<br />
<br />
This will be a very simple CLI hello world.<br />
<br />
=== Before We Code ===<br />
<br />
Like a good coder you want to make sure that you're not just doing things, but that you're doing them the right way! <br />
<br />
Now change directories into your <code>local/packages</code> directory.The following commands expect you'll be in that directory so don't change unless you know what you're doing!<br />
<br />
You'll want to make a directory with the name of your application, and a subdirectory called files.<br />
mkdir myhelloworld myhelloworld/files<br />
Now you'll want to create two files in the <code>files</code> directory<br />
touch myhelloworld/files/READEME.txt myhelloworld/files/myhelloworld.c<br />
And finally you'll want to create a bitbake file.<br />
touch myhelloworld/myhelloworld.bb<br />
<br />
Alrighty now all your necessary files are created so lets go over this real quick.<br />
<pre><br />
$HOME<br />
+- $OMDIR (contains the official openmoko tree)<br />
| +- local/<br />
| +- packages/<br />
| +- myhelloworld/<br />
| +- myhelloworld.bb<br />
| +- files/<br />
| +- myhelloworld.c<br />
| +- README.txt<br />
</pre><br />
<br />
That should be your structure, if it's not you should go and fix it up.<br />
=== Filling the Files ===<br />
<br />
So you've got your sample files all laid out now it's time to make them actually do something.<br />
<br />
myhelloworld.c<br />
<pre><br />
#include <stdio.h><br />
<br />
int main(int argc, char** argv)<br />
{<br />
printf("Ello Poppet!\n");<br />
return 0;<br />
}<br />
</pre><br />
<br />
README.txt<br />
<pre><br />
This is a command line application. It prints a simple Hello World! To stdout.<br />
</pre><br />
<br />
myhelloworld.bb<br />
<pre><br />
DESCRIPTION = "A killer hello world applicaiton"<br />
AUTHOR = "Bryce Leo"<br />
HOMEPAGE = ""<br />
SECTION = "console/applications"<br />
PRIORITY = "optional"<br />
LICENSE = "MIT"<br />
#DEPENDS = ""<br />
#RDEPENDS = ""<br />
#RRECOMMENDS = ""<br />
#RCONFLICTS = ""<br />
#SRCDATE = "20070729"<br />
#PV = "0.1"<br />
#PR = "r0"<br />
SRC_URI = "file://myhelloworld.c \<br />
file://README.txt "<br />
<br />
S = "${WORKDIR}/myhelloworld/"<br />
<br />
do_compile() {<br />
${CC} ${CFLAGS} ${LDFLAGS} ${WORKDIR}/myhelloworld.c -o myhelloworld<br />
}<br />
<br />
do_install() {<br />
install -m 0755 -d ${D}${bindir} ${D}${docdir}/myhelloworld<br />
install -m 0755 ${S}/myhelloworld ${D}${bindir}<br />
install -m 0644 ${WORKDIR}/README.txt ${D}${docdir}/myhelloworld<br />
}<br />
<br />
</pre><br />
<br />
=== Your First Compilation ===<br />
<br />
This is where the [[MokoMakefile]] comes in very very handy. Change to your ${OMDIR} directory, You'll now it by the fact that it is where <code>Makefile</code> resides.<br />
make build-package-myhelloworld<br />
This should all come back and not return any error messages, The output should end in something similar to<br />
<pre><br />
NOTE: package myhelloworld-1.0: completed<br />
NOTE: build 200707291926: completed<br />
Build statistics:<br />
Attempted builds: 1<br />
</pre><br />
<br />
Now that no errors were thrown we are happily done!<br />
<br />
== Adding Your Application to the Image ==<br />
<br />
So you've had an idea, you've setup the build environment, you've setup your local overlway, you've laid out your application tree, you've put code into those fantastic files of yours and now it compiles.There's only one thing left to do. Add that application to your image.<br />
<br />
Now lets go over in words and whys what we're about to do. First we need to make modify the <code>${OMDIR}/build/conf/local.conf</code>. We add in the variable <code>DISTRO_EXTRA_RDEPENDS</code> and set its value to include <code>myhelloworld</code>. If you'd like to include other packages from your own overlay or the OM tree just add them inseparated by spaces. After this gets added as a dependency to build the Distro (in this case OpenMoko). Now we have to re-build the task-base package. This essentially just generates an ipk file that will "Merge machine and distro options to create a basic machine task/package." It pretty much builds a file with a list of packages to be installed that are required for the distro to work correctly. So then you just go through and make <code>openmoko-devel-image, build-qemu, flash-qemu-local,</code> and <code>run-qemu</code>. Then calibrate your stylus, head over to the terminal, and run your application!<br />
<br />
=== Modifying Your local.conf ===<br />
Now, go into your build config directory <code>${OMDIR}/build/conf/</code> and now you'll be editing <code>local.conf</code><br />
Add this line to you <code>local.conf</code><br />
DISTRO_EXTRA_RDEPENDS += "myhelloworld"<br />
With this line you can also include other applications from the OE tree. For instance my <code>local.conf</code> looks like this.<br />
<pre><br />
MACHINE = "fic-gta01"<br />
DISTRO = "openmoko"<br />
BUILD_ARCH = "i686"<br />
SRCDATE_eds-dbus = "now"<br />
DISTRO_EXTRA_RDEPENDS += "lua dillo myhelloworld"<br />
</pre><br />
<br />
Now that you've fixed your <code>local.conf</code> it's time to go through all the necessary tasks to add and re-build you image and have your sweet package included.<br />
<br />
=== Building ===<br />
Now come the easy part thanks to [[MokoMakefile]]. <br />
<br />
make rebuild-package-task-base<br />
make openmoko-devel-image<br />
make build-qemu<br />
make flash-qemu-local<br />
<br />
Now all you have to do is run qemu.<br />
make run-qemu<br />
<br />
From here after you calibrate your stylus, you click onthe Menu in the top right, click down to terminal, then just run your program.<br />
<pre><br />
root@fic-gta02:/$ myhelloworld<br />
Ello Poppet!<br />
</pre></div>Bryce.Leohttp://wiki.openmoko.org/wiki/Customizing_the_Openmoko_DistributionCustomizing the Openmoko Distribution2007-07-30T00:00:27Z<p>Bryce.Leo: /* Adding Your App to the Image */</p>
<hr />
<div>== What's the goal? ==<br />
<br />
The goal of this page is to teach you how to take an application that you've coded (or the sample app) and properly get it included in your rootfs. This article is a bit of an aggregate page, it's going to take information from [[MokoMakefile]] [http://wiki.openmoko.org/wiki/User:CesarB/Using_a_local_overlay Using_a_local_overlay] [[Building_a_hello_world_application]] and [[Create_a_package_from_existing_sources]]. So as you can see the goal is for it to be a very thorough introduction, and will take you from "Idea to Inclusion" of your application.<br />
<br />
<br />
== Setting Up the OpenMoko Environment ==<br />
<br />
This part of the tutorial is going to be pretty basic. I absolutely love [[MokoMakefile]], it's fantastic, the creator has done and continues to do a fantastic job with this. I see absolutely no reason not to use it. However I cannot for the life of me understand why they create their working directory in /home/moko, the home directory is for home directories for users of your system, not for a development directory. I put my OpenMoko development directory in /home/bryce/mokodev/ and that works great for me, and also makes more sense so that multiple users on my machine could develop with no attempt to overlap.<br />
<br />
To get your environment setup please get it setup according to [[MokoMakefile]] however if you do have the build environment setup manually and you're sure you know what you're doing then feel free to go forward with this.<br />
<br />
== Setting Up a Local Overlay ==<br />
If you're at the point for setting up a local overlay this means a couple things. First: You've had a brilliant idea for an application that you just need to have on the OpenMoko platform. Second: You realize that this killer app of yours needs to be done properly and you're not going to do anything silly like include it in the actual tree for the OpenMoko distro because it would probably end up just getting overwritten eventually, or you just realize taht it's bad practice!<br />
<br />
Thank you to [[User:CesarB]] for this part of the wiki.<br />
<br />
To create a local overlay:<br />
<br />
* Create a "local" directory and its subdirectories<br />
<br />
mkdir local local/conf local/classes local/packages<br />
<br />
* Copy <code>site.conf</code> from the openmoko tree to <code>local/conf</code><br />
<br />
cp oe/conf/site.conf local/conf/site.conf<br />
<br />
* Edit the site.conf you copied to add the new tree as a source for bitbake recipes.<br />
<br />
Change the current <code>BBFILES</code> to look like this:<br />
BBFILES := "${OMDIR}/openembedded/packages/*/*.bb ${OMDIR}/oe/packages/*/*.bb ${OMDIR}/local/packages/*/*.bb"<br />
Change your <code>BBFILE_COLLECTIONS</code> line to look like this:<br />
BBFILE_COLLECTIONS = "upstream local overlay"<br />
Add this line:<br />
BBFILE_PATTERN_overlay = "^${OMDIR}/local/"<br />
Add this line:<br />
BBFILE_PRIORITY_overlay = "20"<br />
<br />
The <code>BBFILE_PRIORITY</code> should be greater than all the other <code>BBFILE_PRIORITY</code> variables on the same file.<br />
<br />
* Change your <code>BBPATH</code> environment variable to add the new tree ''before'' the two others for [[MokoMakefile]], the variable is on the <code>setup-env</code> file.<br />
<br />
export BBPATH="${OMDIR}/build:${OMDIR}/local:${OMDIR}/oe:${OMDIR}/openembedded"<br />
<br />
== Using Your New Local Overlay ==<br />
<br />
=== Changing files in conf/ ===<br />
<br />
To change a file in conf/, just copy the file to the overlay tree (preserving the directory structure) and edit it.<br />
<br />
=== Changing files in classes/ ===<br />
<br />
To change a file in classes/, just copy the file to the overlay tree and edit it.<br />
<br />
=== Changing packages ===<br />
<br />
Changing a package's recipe is a bit more complex. You have to copy over (or symlink) not only the .bb file for the package, but also ''all'' the files it includes with <code>require</code>, and the <code>FILESDIR</code> directories (all directories referred to by <code>FILESDIR</code>, usually named either ''package''-''version'' or <code>files</code>). If you forget one of them, the build will give an error (either when parsing the recipe in the case of <code>require</code>, or when trying to build in the case of the <code>FILESDIR</code> directories).<br />
<br />
=== Adding a new package ===<br />
<br />
You can add a new package (or a recipe for a new version of a package) to the overlay tree simply by creating it on the overlay tree.<br />
<br />
== Your First Application ==<br />
<br />
I know that I said I'd have a GDK application in here, however, I'd really like to get this whole course done first and have you guys starting to code instead of just looking at what I've written!<br />
<br />
This will be a very simple CLI hello world.<br />
<br />
=== Before We Code ===<br />
<br />
Like a good coder you want to make sure that you're not just doing things, but that you're doing them the right way! <br />
<br />
Now change directories into your <code>local/packages</code> directory.The following commands expect you'll be in that directory so don't change unless you know what you're doing!<br />
<br />
You'll want to make a directory with the name of your application, and a subdirectory called files.<br />
mkdir myhelloworld myhelloworld/files<br />
Now you'll want to create two files in the <code>files</code> directory<br />
touch myhelloworld/files/READEME.txt myhelloworld/files/myhelloworld.c<br />
And finally you'll want to create a bitbake file.<br />
touch myhelloworld/myhelloworld.bb<br />
<br />
Alrighty now all your necessary files are created so lets go over this real quick.<br />
<pre><br />
$HOME<br />
+- $OMDIR (contains the official openmoko tree)<br />
| +- local/<br />
| +- packages/<br />
| +- myhelloworld/<br />
| +- myhelloworld.bb<br />
| +- files/<br />
| +- myhelloworld.c<br />
| +- README.txt<br />
</pre><br />
<br />
That should be your structure, if it's not you should go and fix it up.<br />
=== Filling the Files ===<br />
<br />
So you've got your sample files all laid out now it's time to make them actually do something.<br />
<br />
myhelloworld.c<br />
<pre><br />
#include <stdio.h><br />
<br />
int main(int argc, char** argv)<br />
{<br />
printf("Ello Poppet!\n");<br />
return 0;<br />
}<br />
</pre><br />
<br />
README.txt<br />
<pre><br />
This is a command line application. It prints a simple Hello World! To stdout.<br />
</pre><br />
<br />
myhelloworld.bb<br />
<pre><br />
DESCRIPTION = "A killer hello world applicaiton"<br />
AUTHOR = "Bryce Leo"<br />
HOMEPAGE = ""<br />
SECTION = "console/applications"<br />
PRIORITY = "optional"<br />
LICENSE = "MIT"<br />
#DEPENDS = ""<br />
#RDEPENDS = ""<br />
#RRECOMMENDS = ""<br />
#RCONFLICTS = ""<br />
#SRCDATE = "20070729"<br />
#PV = "0.1"<br />
#PR = "r0"<br />
SRC_URI = "file://myhelloworld.c \<br />
file://README.txt "<br />
<br />
S = "${WORKDIR}/myhelloworld/"<br />
<br />
do_compile() {<br />
${CC} ${CFLAGS} ${LDFLAGS} ${WORKDIR}/myhelloworld.c -o myhelloworld<br />
}<br />
<br />
do_install() {<br />
install -m 0755 -d ${D}${bindir} ${D}${docdir}/myhelloworld<br />
install -m 0755 ${S}/myhelloworld ${D}${bindir}<br />
install -m 0644 ${WORKDIR}/README.txt ${D}${docdir}/myhelloworld<br />
}<br />
<br />
</pre><br />
<br />
=== Your First Compilation ===<br />
<br />
This is where the [[MokoMakefile]] comes in very very handy. Change to your ${OMDIR} directory, You'll now it by the fact that it is where <code>Makefile</code> resides.<br />
make build-package-myhelloworld<br />
This should all come back and not return any error messages, The output should end in something similar to<br />
<pre><br />
NOTE: package myhelloworld-1.0: completed<br />
NOTE: build 200707291926: completed<br />
Build statistics:<br />
Attempted builds: 1<br />
</pre><br />
<br />
Now that no errors were thrown we are happily done!<br />
<br />
== Adding Your Application to the Image ==<br />
<br />
So you've had an idea, you've setup the build environment, you've setup your local overlway, you've laid out your application tree, you've put code into those fantastic files of yours and now it compiles.There's only one thing left to do. Add that application to your image.<br />
<br />
=== Modifying Your local.conf ===<br />
Now, go into your build config directory <code>${OMDIR}/build/conf/</code> and now you'll be editing <code>local.conf</code><br />
Add this line to you <code>local.conf</code><br />
DISTRO_EXTRA_RDEPENDS += "myhelloworld"<br />
With this line you can also include other applications from the OE tree. For instance my <code>local.conf</code> looks like this.<br />
<pre><br />
MACHINE = "fic-gta01"<br />
DISTRO = "openmoko"<br />
BUILD_ARCH = "i686"<br />
SRCDATE_eds-dbus = "now"<br />
DISTRO_EXTRA_RDEPENDS += "lua dillo myhelloworld"<br />
</pre><br />
<br />
Now that you've fixed your <code>local.conf</code> it's time to go through all the necessary tasks to add and re-build you image and have your sweet package included.<br />
<br />
=== Building ===<br />
Now come the easy part thanks to [[MokoMakefile]]. <br />
<br />
make rebuild-package-task-base<br />
make openmoko-devel-image<br />
make build-qemu<br />
make flash-qemu-local<br />
<br />
Now all you have to do is run qemu.<br />
make run-qemu<br />
<br />
From here after you calibrate your stylus, you click onthe Menu in the top right, click down to terminal, then just run your program.<br />
<pre><br />
root@fic-gta02:/$ myhelloworld<br />
Ello Poppet!<br />
</pre></div>Bryce.Leohttp://wiki.openmoko.org/wiki/Customizing_the_Openmoko_DistributionCustomizing the Openmoko Distribution2007-07-29T23:33:35Z<p>Bryce.Leo: /* Your First Compilation */</p>
<hr />
<div>== What's the goal? ==<br />
<br />
The goal of this page is to teach you how to take an application that you've coded (or the sample app) and properly get it included in your rootfs. This article is a bit of an aggregate page, it's going to take information from [[MokoMakefile]] [http://wiki.openmoko.org/wiki/User:CesarB/Using_a_local_overlay Using_a_local_overlay] [[Building_a_hello_world_application]] and [[Create_a_package_from_existing_sources]]. So as you can see the goal is for it to be a very thorough introduction, and will take you from "Idea to Inclusion" of your application.<br />
<br />
<br />
== Setting Up the OpenMoko Environment ==<br />
<br />
This part of the tutorial is going to be pretty basic. I absolutely love [[MokoMakefile]], it's fantastic, the creator has done and continues to do a fantastic job with this. I see absolutely no reason not to use it. However I cannot for the life of me understand why they create their working directory in /home/moko, the home directory is for home directories for users of your system, not for a development directory. I put my OpenMoko development directory in /home/bryce/mokodev/ and that works great for me, and also makes more sense so that multiple users on my machine could develop with no attempt to overlap.<br />
<br />
To get your environment setup please get it setup according to [[MokoMakefile]] however if you do have the build environment setup manually and you're sure you know what you're doing then feel free to go forward with this.<br />
<br />
== Setting Up a Local Overlay ==<br />
If you're at the point for setting up a local overlay this means a couple things. First: You've had a brilliant idea for an application that you just need to have on the OpenMoko platform. Second: You realize that this killer app of yours needs to be done properly and you're not going to do anything silly like include it in the actual tree for the OpenMoko distro because it would probably end up just getting overwritten eventually, or you just realize taht it's bad practice!<br />
<br />
Thank you to [[User:CesarB]] for this part of the wiki.<br />
<br />
To create a local overlay:<br />
<br />
* Create a "local" directory and its subdirectories<br />
<br />
mkdir local local/conf local/classes local/packages<br />
<br />
* Copy <code>site.conf</code> from the openmoko tree to <code>local/conf</code><br />
<br />
cp oe/conf/site.conf local/conf/site.conf<br />
<br />
* Edit the site.conf you copied to add the new tree as a source for bitbake recipes.<br />
<br />
Change the current <code>BBFILES</code> to look like this:<br />
BBFILES := "${OMDIR}/openembedded/packages/*/*.bb ${OMDIR}/oe/packages/*/*.bb ${OMDIR}/local/packages/*/*.bb"<br />
Change your <code>BBFILE_COLLECTIONS</code> line to look like this:<br />
BBFILE_COLLECTIONS = "upstream local overlay"<br />
Add this line:<br />
BBFILE_PATTERN_overlay = "^${OMDIR}/local/"<br />
Add this line:<br />
BBFILE_PRIORITY_overlay = "20"<br />
<br />
The <code>BBFILE_PRIORITY</code> should be greater than all the other <code>BBFILE_PRIORITY</code> variables on the same file.<br />
<br />
* Change your <code>BBPATH</code> environment variable to add the new tree ''before'' the two others for [[MokoMakefile]], the variable is on the <code>setup-env</code> file.<br />
<br />
export BBPATH="${OMDIR}/build:${OMDIR}/local:${OMDIR}/oe:${OMDIR}/openembedded"<br />
<br />
== Using Your New Local Overlay ==<br />
<br />
=== Changing files in conf/ ===<br />
<br />
To change a file in conf/, just copy the file to the overlay tree (preserving the directory structure) and edit it.<br />
<br />
=== Changing files in classes/ ===<br />
<br />
To change a file in classes/, just copy the file to the overlay tree and edit it.<br />
<br />
=== Changing packages ===<br />
<br />
Changing a package's recipe is a bit more complex. You have to copy over (or symlink) not only the .bb file for the package, but also ''all'' the files it includes with <code>require</code>, and the <code>FILESDIR</code> directories (all directories referred to by <code>FILESDIR</code>, usually named either ''package''-''version'' or <code>files</code>). If you forget one of them, the build will give an error (either when parsing the recipe in the case of <code>require</code>, or when trying to build in the case of the <code>FILESDIR</code> directories).<br />
<br />
=== Adding a new package ===<br />
<br />
You can add a new package (or a recipe for a new version of a package) to the overlay tree simply by creating it on the overlay tree.<br />
<br />
== Your First Application ==<br />
<br />
I know that I said I'd have a GDK application in here, however, I'd really like to get this whole course done first and have you guys starting to code instead of just looking at what I've written!<br />
<br />
This will be a very simple CLI hello world.<br />
<br />
=== Before We Code ===<br />
<br />
Like a good coder you want to make sure that you're not just doing things, but that you're doing them the right way! <br />
<br />
Now change directories into your <code>local/packages</code> directory.The following commands expect you'll be in that directory so don't change unless you know what you're doing!<br />
<br />
You'll want to make a directory with the name of your application, and a subdirectory called files.<br />
mkdir myhelloworld myhelloworld/files<br />
Now you'll want to create two files in the <code>files</code> directory<br />
touch myhelloworld/files/READEME.txt myhelloworld/files/myhelloworld.c<br />
And finally you'll want to create a bitbake file.<br />
touch myhelloworld/myhelloworld.bb<br />
<br />
Alrighty now all your necessary files are created so lets go over this real quick.<br />
<pre><br />
$HOME<br />
+- $OMDIR (contains the official openmoko tree)<br />
| +- local/<br />
| +- packages/<br />
| +- myhelloworld/<br />
| +- myhelloworld.bb<br />
| +- files/<br />
| +- myhelloworld.c<br />
| +- README.txt<br />
</pre><br />
<br />
That should be your structure, if it's not you should go and fix it up.<br />
=== Filling the Files ===<br />
<br />
So you've got your sample files all laid out now it's time to make them actually do something.<br />
<br />
myhelloworld.c<br />
<pre><br />
#include <stdio.h><br />
<br />
int main(int argc, char** argv)<br />
{<br />
printf("Ello Poppet!\n");<br />
return 0;<br />
}<br />
</pre><br />
<br />
README.txt<br />
<pre><br />
This is a command line application. It prints a simple Hello World! To stdout.<br />
</pre><br />
<br />
myhelloworld.bb<br />
<pre><br />
DESCRIPTION = "A killer hello world applicaiton"<br />
AUTHOR = "Bryce Leo"<br />
HOMEPAGE = ""<br />
SECTION = "console/applications"<br />
PRIORITY = "optional"<br />
LICENSE = "MIT"<br />
#DEPENDS = ""<br />
#RDEPENDS = ""<br />
#RRECOMMENDS = ""<br />
#RCONFLICTS = ""<br />
#SRCDATE = "20070729"<br />
#PV = "0.1"<br />
#PR = "r0"<br />
SRC_URI = "file://myhelloworld.c \<br />
file://README.txt "<br />
<br />
S = "${WORKDIR}/myhelloworld/"<br />
<br />
do_compile() {<br />
${CC} ${CFLAGS} ${LDFLAGS} ${WORKDIR}/myhelloworld.c -o myhelloworld<br />
}<br />
<br />
do_install() {<br />
install -m 0755 -d ${D}${bindir} ${D}${docdir}/myhelloworld<br />
install -m 0755 ${S}/myhelloworld ${D}${bindir}<br />
install -m 0644 ${WORKDIR}/README.txt ${D}${docdir}/myhelloworld<br />
}<br />
<br />
</pre><br />
<br />
=== Your First Compilation ===<br />
<br />
This is where the [[MokoMakefile]] comes in very very handy. Change to your ${OMDIR} directory, You'll now it by the fact that it is where <code>Makefile</code> resides.<br />
make build-package-myhelloworld<br />
This should all come back and not return any error messages, The output should end in something similar to<br />
<pre><br />
NOTE: package myhelloworld-1.0: completed<br />
NOTE: build 200707291926: completed<br />
Build statistics:<br />
Attempted builds: 1<br />
</pre><br />
<br />
Now that no errors were thrown we are happily done!<br />
<br />
== Adding Your App to the Image ==</div>Bryce.Leohttp://wiki.openmoko.org/wiki/Customizing_the_Openmoko_DistributionCustomizing the Openmoko Distribution2007-07-29T23:33:11Z<p>Bryce.Leo: /* Your First Application */</p>
<hr />
<div>== What's the goal? ==<br />
<br />
The goal of this page is to teach you how to take an application that you've coded (or the sample app) and properly get it included in your rootfs. This article is a bit of an aggregate page, it's going to take information from [[MokoMakefile]] [http://wiki.openmoko.org/wiki/User:CesarB/Using_a_local_overlay Using_a_local_overlay] [[Building_a_hello_world_application]] and [[Create_a_package_from_existing_sources]]. So as you can see the goal is for it to be a very thorough introduction, and will take you from "Idea to Inclusion" of your application.<br />
<br />
<br />
== Setting Up the OpenMoko Environment ==<br />
<br />
This part of the tutorial is going to be pretty basic. I absolutely love [[MokoMakefile]], it's fantastic, the creator has done and continues to do a fantastic job with this. I see absolutely no reason not to use it. However I cannot for the life of me understand why they create their working directory in /home/moko, the home directory is for home directories for users of your system, not for a development directory. I put my OpenMoko development directory in /home/bryce/mokodev/ and that works great for me, and also makes more sense so that multiple users on my machine could develop with no attempt to overlap.<br />
<br />
To get your environment setup please get it setup according to [[MokoMakefile]] however if you do have the build environment setup manually and you're sure you know what you're doing then feel free to go forward with this.<br />
<br />
== Setting Up a Local Overlay ==<br />
If you're at the point for setting up a local overlay this means a couple things. First: You've had a brilliant idea for an application that you just need to have on the OpenMoko platform. Second: You realize that this killer app of yours needs to be done properly and you're not going to do anything silly like include it in the actual tree for the OpenMoko distro because it would probably end up just getting overwritten eventually, or you just realize taht it's bad practice!<br />
<br />
Thank you to [[User:CesarB]] for this part of the wiki.<br />
<br />
To create a local overlay:<br />
<br />
* Create a "local" directory and its subdirectories<br />
<br />
mkdir local local/conf local/classes local/packages<br />
<br />
* Copy <code>site.conf</code> from the openmoko tree to <code>local/conf</code><br />
<br />
cp oe/conf/site.conf local/conf/site.conf<br />
<br />
* Edit the site.conf you copied to add the new tree as a source for bitbake recipes.<br />
<br />
Change the current <code>BBFILES</code> to look like this:<br />
BBFILES := "${OMDIR}/openembedded/packages/*/*.bb ${OMDIR}/oe/packages/*/*.bb ${OMDIR}/local/packages/*/*.bb"<br />
Change your <code>BBFILE_COLLECTIONS</code> line to look like this:<br />
BBFILE_COLLECTIONS = "upstream local overlay"<br />
Add this line:<br />
BBFILE_PATTERN_overlay = "^${OMDIR}/local/"<br />
Add this line:<br />
BBFILE_PRIORITY_overlay = "20"<br />
<br />
The <code>BBFILE_PRIORITY</code> should be greater than all the other <code>BBFILE_PRIORITY</code> variables on the same file.<br />
<br />
* Change your <code>BBPATH</code> environment variable to add the new tree ''before'' the two others for [[MokoMakefile]], the variable is on the <code>setup-env</code> file.<br />
<br />
export BBPATH="${OMDIR}/build:${OMDIR}/local:${OMDIR}/oe:${OMDIR}/openembedded"<br />
<br />
== Using Your New Local Overlay ==<br />
<br />
=== Changing files in conf/ ===<br />
<br />
To change a file in conf/, just copy the file to the overlay tree (preserving the directory structure) and edit it.<br />
<br />
=== Changing files in classes/ ===<br />
<br />
To change a file in classes/, just copy the file to the overlay tree and edit it.<br />
<br />
=== Changing packages ===<br />
<br />
Changing a package's recipe is a bit more complex. You have to copy over (or symlink) not only the .bb file for the package, but also ''all'' the files it includes with <code>require</code>, and the <code>FILESDIR</code> directories (all directories referred to by <code>FILESDIR</code>, usually named either ''package''-''version'' or <code>files</code>). If you forget one of them, the build will give an error (either when parsing the recipe in the case of <code>require</code>, or when trying to build in the case of the <code>FILESDIR</code> directories).<br />
<br />
=== Adding a new package ===<br />
<br />
You can add a new package (or a recipe for a new version of a package) to the overlay tree simply by creating it on the overlay tree.<br />
<br />
== Your First Application ==<br />
<br />
I know that I said I'd have a GDK application in here, however, I'd really like to get this whole course done first and have you guys starting to code instead of just looking at what I've written!<br />
<br />
This will be a very simple CLI hello world.<br />
<br />
=== Before We Code ===<br />
<br />
Like a good coder you want to make sure that you're not just doing things, but that you're doing them the right way! <br />
<br />
Now change directories into your <code>local/packages</code> directory.The following commands expect you'll be in that directory so don't change unless you know what you're doing!<br />
<br />
You'll want to make a directory with the name of your application, and a subdirectory called files.<br />
mkdir myhelloworld myhelloworld/files<br />
Now you'll want to create two files in the <code>files</code> directory<br />
touch myhelloworld/files/READEME.txt myhelloworld/files/myhelloworld.c<br />
And finally you'll want to create a bitbake file.<br />
touch myhelloworld/myhelloworld.bb<br />
<br />
Alrighty now all your necessary files are created so lets go over this real quick.<br />
<pre><br />
$HOME<br />
+- $OMDIR (contains the official openmoko tree)<br />
| +- local/<br />
| +- packages/<br />
| +- myhelloworld/<br />
| +- myhelloworld.bb<br />
| +- files/<br />
| +- myhelloworld.c<br />
| +- README.txt<br />
</pre><br />
<br />
That should be your structure, if it's not you should go and fix it up.<br />
=== Filling the Files ===<br />
<br />
So you've got your sample files all laid out now it's time to make them actually do something.<br />
<br />
myhelloworld.c<br />
<pre><br />
#include <stdio.h><br />
<br />
int main(int argc, char** argv)<br />
{<br />
printf("Ello Poppet!\n");<br />
return 0;<br />
}<br />
</pre><br />
<br />
README.txt<br />
<pre><br />
This is a command line application. It prints a simple Hello World! To stdout.<br />
</pre><br />
<br />
myhelloworld.bb<br />
<pre><br />
DESCRIPTION = "A killer hello world applicaiton"<br />
AUTHOR = "Bryce Leo"<br />
HOMEPAGE = ""<br />
SECTION = "console/applications"<br />
PRIORITY = "optional"<br />
LICENSE = "MIT"<br />
#DEPENDS = ""<br />
#RDEPENDS = ""<br />
#RRECOMMENDS = ""<br />
#RCONFLICTS = ""<br />
#SRCDATE = "20070729"<br />
#PV = "0.1"<br />
#PR = "r0"<br />
SRC_URI = "file://myhelloworld.c \<br />
file://README.txt "<br />
<br />
S = "${WORKDIR}/myhelloworld/"<br />
<br />
do_compile() {<br />
${CC} ${CFLAGS} ${LDFLAGS} ${WORKDIR}/myhelloworld.c -o myhelloworld<br />
}<br />
<br />
do_install() {<br />
install -m 0755 -d ${D}${bindir} ${D}${docdir}/myhelloworld<br />
install -m 0755 ${S}/myhelloworld ${D}${bindir}<br />
install -m 0644 ${WORKDIR}/README.txt ${D}${docdir}/myhelloworld<br />
}<br />
<br />
</pre><br />
<br />
=== Your First Compilation ===<br />
<br />
This is where the [[MokoMakefile]] comes in very very handy. Change to your ${OMDIR} directory, You'll now it by the fact that it is where <code>Makefile</code> resides.<br />
make build-package-myhelloworld<br />
This should all come back and not return any error messages, The output should end in something similar to<br />
<pre><br />
NOTE: package myhelloworld-1.0: completed<br />
NOTE: build 200707291926: completed<br />
Build statistics:<br />
Attempted builds: 1<br />
<pre><br />
<br />
Now that no errors were thrown we are happily done!<br />
<br />
== Adding Your App to the Image ==</div>Bryce.Leohttp://wiki.openmoko.org/wiki/Customizing_the_Openmoko_DistributionCustomizing the Openmoko Distribution2007-07-29T23:32:30Z<p>Bryce.Leo: /* Your First Compilation */</p>
<hr />
<div>== What's the goal? ==<br />
<br />
The goal of this page is to teach you how to take an application that you've coded (or the sample app) and properly get it included in your rootfs. This article is a bit of an aggregate page, it's going to take information from [[MokoMakefile]] [http://wiki.openmoko.org/wiki/User:CesarB/Using_a_local_overlay Using_a_local_overlay] [[Building_a_hello_world_application]] and [[Create_a_package_from_existing_sources]]. So as you can see the goal is for it to be a very thorough introduction, and will take you from "Idea to Inclusion" of your application.<br />
<br />
<br />
== Setting Up the OpenMoko Environment ==<br />
<br />
This part of the tutorial is going to be pretty basic. I absolutely love [[MokoMakefile]], it's fantastic, the creator has done and continues to do a fantastic job with this. I see absolutely no reason not to use it. However I cannot for the life of me understand why they create their working directory in /home/moko, the home directory is for home directories for users of your system, not for a development directory. I put my OpenMoko development directory in /home/bryce/mokodev/ and that works great for me, and also makes more sense so that multiple users on my machine could develop with no attempt to overlap.<br />
<br />
To get your environment setup please get it setup according to [[MokoMakefile]] however if you do have the build environment setup manually and you're sure you know what you're doing then feel free to go forward with this.<br />
<br />
== Setting Up a Local Overlay ==<br />
If you're at the point for setting up a local overlay this means a couple things. First: You've had a brilliant idea for an application that you just need to have on the OpenMoko platform. Second: You realize that this killer app of yours needs to be done properly and you're not going to do anything silly like include it in the actual tree for the OpenMoko distro because it would probably end up just getting overwritten eventually, or you just realize taht it's bad practice!<br />
<br />
Thank you to [[User:CesarB]] for this part of the wiki.<br />
<br />
To create a local overlay:<br />
<br />
* Create a "local" directory and its subdirectories<br />
<br />
mkdir local local/conf local/classes local/packages<br />
<br />
* Copy <code>site.conf</code> from the openmoko tree to <code>local/conf</code><br />
<br />
cp oe/conf/site.conf local/conf/site.conf<br />
<br />
* Edit the site.conf you copied to add the new tree as a source for bitbake recipes.<br />
<br />
Change the current <code>BBFILES</code> to look like this:<br />
BBFILES := "${OMDIR}/openembedded/packages/*/*.bb ${OMDIR}/oe/packages/*/*.bb ${OMDIR}/local/packages/*/*.bb"<br />
Change your <code>BBFILE_COLLECTIONS</code> line to look like this:<br />
BBFILE_COLLECTIONS = "upstream local overlay"<br />
Add this line:<br />
BBFILE_PATTERN_overlay = "^${OMDIR}/local/"<br />
Add this line:<br />
BBFILE_PRIORITY_overlay = "20"<br />
<br />
The <code>BBFILE_PRIORITY</code> should be greater than all the other <code>BBFILE_PRIORITY</code> variables on the same file.<br />
<br />
* Change your <code>BBPATH</code> environment variable to add the new tree ''before'' the two others for [[MokoMakefile]], the variable is on the <code>setup-env</code> file.<br />
<br />
export BBPATH="${OMDIR}/build:${OMDIR}/local:${OMDIR}/oe:${OMDIR}/openembedded"<br />
<br />
== Using Your New Local Overlay ==<br />
<br />
=== Changing files in conf/ ===<br />
<br />
To change a file in conf/, just copy the file to the overlay tree (preserving the directory structure) and edit it.<br />
<br />
=== Changing files in classes/ ===<br />
<br />
To change a file in classes/, just copy the file to the overlay tree and edit it.<br />
<br />
=== Changing packages ===<br />
<br />
Changing a package's recipe is a bit more complex. You have to copy over (or symlink) not only the .bb file for the package, but also ''all'' the files it includes with <code>require</code>, and the <code>FILESDIR</code> directories (all directories referred to by <code>FILESDIR</code>, usually named either ''package''-''version'' or <code>files</code>). If you forget one of them, the build will give an error (either when parsing the recipe in the case of <code>require</code>, or when trying to build in the case of the <code>FILESDIR</code> directories).<br />
<br />
=== Adding a new package ===<br />
<br />
You can add a new package (or a recipe for a new version of a package) to the overlay tree simply by creating it on the overlay tree.<br />
<br />
== Your First Application ==<br />
<br />
I know that I said I'd have a GDK application in here, however, I'd really like to get this whole course done first and have you guys starting to code instead of just looking at what I've written!<br />
<br />
This will be a very simple CLI hello world.<br />
<br />
=== Before We Code ===<br />
<br />
Like a good coder you want to make sure that you're not just doing things, but that you're doing them the right way! <br />
<br />
Now change directories into your <code>local/packages</code> directory.The following commands expect you'll be in that directory so don't change unless you know what you're doing!<br />
<br />
You'll want to make a directory with the name of your application, and a subdirectory called files.<br />
mkdir myhelloworld myhelloworld/files<br />
Now you'll want to create two files in the <code>files</code> directory<br />
touch myhelloworld/files/READEME.txt myhelloworld/files/myhelloworld.c<br />
And finally you'll want to create a bitbake file.<br />
touch myhelloworld/myhelloworld.bb<br />
<br />
Alrighty now all your necessary files are created so lets go over this real quick.<br />
<pre><br />
$HOME<br />
+- $OMDIR (contains the official openmoko tree)<br />
| +- local/<br />
| +- packages/<br />
| +- myhelloworld/<br />
| +- myhelloworld.bb<br />
| +- files/<br />
| +- myhelloworld.c<br />
| +- README.txt<br />
</pre><br />
<br />
That should be your structure, if it's not you should go and fix it up.<br />
=== Filling the Files ===<br />
<br />
So you've got your sample files all laid out now it's time to make them actually do something.<br />
<br />
myhelloworld.c<br />
<pre><br />
#include <stdio.h><br />
<br />
int main(int argc, char** argv)<br />
{<br />
printf("Ello Poppet!\n");<br />
return 0;<br />
}<br />
</pre><br />
<br />
README.txt<br />
<pre><br />
This is a command line application. It prints a simple Hello World! To stdout.<br />
</pre><br />
<br />
myhelloworld.bb<br />
<pre><br />
DESCRIPTION = "A killer hello world applicaiton"<br />
AUTHOR = "Bryce Leo"<br />
HOMEPAGE = ""<br />
SECTION = "console/applications"<br />
PRIORITY = "optional"<br />
LICENSE = "MIT"<br />
#DEPENDS = ""<br />
#RDEPENDS = ""<br />
#RRECOMMENDS = ""<br />
#RCONFLICTS = ""<br />
#SRCDATE = "20070729"<br />
#PV = "0.1"<br />
#PR = "r0"<br />
SRC_URI = "file://myhelloworld.c \<br />
file://README.txt "<br />
<br />
S = "${WORKDIR}/myhelloworld/"<br />
<br />
do_compile() {<br />
${CC} ${CFLAGS} ${LDFLAGS} ${WORKDIR}/myhelloworld.c -o myhelloworld<br />
}<br />
<br />
do_install() {<br />
install -m 0755 -d ${D}${bindir} ${D}${docdir}/myhelloworld<br />
install -m 0755 ${S}/myhelloworld ${D}${bindir}<br />
install -m 0644 ${WORKDIR}/README.txt ${D}${docdir}/myhelloworld<br />
}<br />
<br />
</pre><br />
<br />
=== Your First Compilation ===<br />
<br />
This is where the [[MokoMakefile]] comes in very very handy. Change to your ${OMDIR} directory, You'll now it by the fact that it is where <code>Makefile</code> resides.<br />
make build-package-myhelloworld<br />
This should all come back and not return any error messages, The output should end in something similar to<br />
<pre><br />
NOTE: package myhelloworld-1.0: completed<br />
NOTE: build 200707291926: completed<br />
Build statistics:<br />
Attempted builds: 1<br />
<pre><br />
<br />
Now that no errors were thrown we are happily done!<br />
<br />
== Adding Your App to the Image ==</div>Bryce.Leohttp://wiki.openmoko.org/wiki/Customizing_the_Openmoko_DistributionCustomizing the Openmoko Distribution2007-07-29T23:31:55Z<p>Bryce.Leo: /* Your First Compilation */</p>
<hr />
<div>== What's the goal? ==<br />
<br />
The goal of this page is to teach you how to take an application that you've coded (or the sample app) and properly get it included in your rootfs. This article is a bit of an aggregate page, it's going to take information from [[MokoMakefile]] [http://wiki.openmoko.org/wiki/User:CesarB/Using_a_local_overlay Using_a_local_overlay] [[Building_a_hello_world_application]] and [[Create_a_package_from_existing_sources]]. So as you can see the goal is for it to be a very thorough introduction, and will take you from "Idea to Inclusion" of your application.<br />
<br />
<br />
== Setting Up the OpenMoko Environment ==<br />
<br />
This part of the tutorial is going to be pretty basic. I absolutely love [[MokoMakefile]], it's fantastic, the creator has done and continues to do a fantastic job with this. I see absolutely no reason not to use it. However I cannot for the life of me understand why they create their working directory in /home/moko, the home directory is for home directories for users of your system, not for a development directory. I put my OpenMoko development directory in /home/bryce/mokodev/ and that works great for me, and also makes more sense so that multiple users on my machine could develop with no attempt to overlap.<br />
<br />
To get your environment setup please get it setup according to [[MokoMakefile]] however if you do have the build environment setup manually and you're sure you know what you're doing then feel free to go forward with this.<br />
<br />
== Setting Up a Local Overlay ==<br />
If you're at the point for setting up a local overlay this means a couple things. First: You've had a brilliant idea for an application that you just need to have on the OpenMoko platform. Second: You realize that this killer app of yours needs to be done properly and you're not going to do anything silly like include it in the actual tree for the OpenMoko distro because it would probably end up just getting overwritten eventually, or you just realize taht it's bad practice!<br />
<br />
Thank you to [[User:CesarB]] for this part of the wiki.<br />
<br />
To create a local overlay:<br />
<br />
* Create a "local" directory and its subdirectories<br />
<br />
mkdir local local/conf local/classes local/packages<br />
<br />
* Copy <code>site.conf</code> from the openmoko tree to <code>local/conf</code><br />
<br />
cp oe/conf/site.conf local/conf/site.conf<br />
<br />
* Edit the site.conf you copied to add the new tree as a source for bitbake recipes.<br />
<br />
Change the current <code>BBFILES</code> to look like this:<br />
BBFILES := "${OMDIR}/openembedded/packages/*/*.bb ${OMDIR}/oe/packages/*/*.bb ${OMDIR}/local/packages/*/*.bb"<br />
Change your <code>BBFILE_COLLECTIONS</code> line to look like this:<br />
BBFILE_COLLECTIONS = "upstream local overlay"<br />
Add this line:<br />
BBFILE_PATTERN_overlay = "^${OMDIR}/local/"<br />
Add this line:<br />
BBFILE_PRIORITY_overlay = "20"<br />
<br />
The <code>BBFILE_PRIORITY</code> should be greater than all the other <code>BBFILE_PRIORITY</code> variables on the same file.<br />
<br />
* Change your <code>BBPATH</code> environment variable to add the new tree ''before'' the two others for [[MokoMakefile]], the variable is on the <code>setup-env</code> file.<br />
<br />
export BBPATH="${OMDIR}/build:${OMDIR}/local:${OMDIR}/oe:${OMDIR}/openembedded"<br />
<br />
== Using Your New Local Overlay ==<br />
<br />
=== Changing files in conf/ ===<br />
<br />
To change a file in conf/, just copy the file to the overlay tree (preserving the directory structure) and edit it.<br />
<br />
=== Changing files in classes/ ===<br />
<br />
To change a file in classes/, just copy the file to the overlay tree and edit it.<br />
<br />
=== Changing packages ===<br />
<br />
Changing a package's recipe is a bit more complex. You have to copy over (or symlink) not only the .bb file for the package, but also ''all'' the files it includes with <code>require</code>, and the <code>FILESDIR</code> directories (all directories referred to by <code>FILESDIR</code>, usually named either ''package''-''version'' or <code>files</code>). If you forget one of them, the build will give an error (either when parsing the recipe in the case of <code>require</code>, or when trying to build in the case of the <code>FILESDIR</code> directories).<br />
<br />
=== Adding a new package ===<br />
<br />
You can add a new package (or a recipe for a new version of a package) to the overlay tree simply by creating it on the overlay tree.<br />
<br />
== Your First Application ==<br />
<br />
I know that I said I'd have a GDK application in here, however, I'd really like to get this whole course done first and have you guys starting to code instead of just looking at what I've written!<br />
<br />
This will be a very simple CLI hello world.<br />
<br />
=== Before We Code ===<br />
<br />
Like a good coder you want to make sure that you're not just doing things, but that you're doing them the right way! <br />
<br />
Now change directories into your <code>local/packages</code> directory.The following commands expect you'll be in that directory so don't change unless you know what you're doing!<br />
<br />
You'll want to make a directory with the name of your application, and a subdirectory called files.<br />
mkdir myhelloworld myhelloworld/files<br />
Now you'll want to create two files in the <code>files</code> directory<br />
touch myhelloworld/files/READEME.txt myhelloworld/files/myhelloworld.c<br />
And finally you'll want to create a bitbake file.<br />
touch myhelloworld/myhelloworld.bb<br />
<br />
Alrighty now all your necessary files are created so lets go over this real quick.<br />
<pre><br />
$HOME<br />
+- $OMDIR (contains the official openmoko tree)<br />
| +- local/<br />
| +- packages/<br />
| +- myhelloworld/<br />
| +- myhelloworld.bb<br />
| +- files/<br />
| +- myhelloworld.c<br />
| +- README.txt<br />
</pre><br />
<br />
That should be your structure, if it's not you should go and fix it up.<br />
=== Filling the Files ===<br />
<br />
So you've got your sample files all laid out now it's time to make them actually do something.<br />
<br />
myhelloworld.c<br />
<pre><br />
#include <stdio.h><br />
<br />
int main(int argc, char** argv)<br />
{<br />
printf("Ello Poppet!\n");<br />
return 0;<br />
}<br />
</pre><br />
<br />
README.txt<br />
<pre><br />
This is a command line application. It prints a simple Hello World! To stdout.<br />
</pre><br />
<br />
myhelloworld.bb<br />
<pre><br />
DESCRIPTION = "A killer hello world applicaiton"<br />
AUTHOR = "Bryce Leo"<br />
HOMEPAGE = ""<br />
SECTION = "console/applications"<br />
PRIORITY = "optional"<br />
LICENSE = "MIT"<br />
#DEPENDS = ""<br />
#RDEPENDS = ""<br />
#RRECOMMENDS = ""<br />
#RCONFLICTS = ""<br />
#SRCDATE = "20070729"<br />
#PV = "0.1"<br />
#PR = "r0"<br />
SRC_URI = "file://myhelloworld.c \<br />
file://README.txt "<br />
<br />
S = "${WORKDIR}/myhelloworld/"<br />
<br />
do_compile() {<br />
${CC} ${CFLAGS} ${LDFLAGS} ${WORKDIR}/myhelloworld.c -o myhelloworld<br />
}<br />
<br />
do_install() {<br />
install -m 0755 -d ${D}${bindir} ${D}${docdir}/myhelloworld<br />
install -m 0755 ${S}/myhelloworld ${D}${bindir}<br />
install -m 0644 ${WORKDIR}/README.txt ${D}${docdir}/myhelloworld<br />
}<br />
<br />
</pre><br />
<br />
=== Your First Compilation ===<br />
<br />
This is where the [[MokoMakefile]] comes in very very handy. Change to your ${OMDIR} directory, You'll now it by the fact that it is where <code>Makefile</code> resides.<br />
make build-package-myhelloworld<br />
This should all come back and not return any error messages, The output should end in something similar to<br />
<pre><br />
NOTE: package myhelloworld-1.0: completed<br />
NOTE: build 200707291926: completed<br />
Build statistics:<br />
Attempted builds: 1<br />
<pre><br />
<br />
Now that no errors were thrown we are happily done!<br />
<br />
== Adding Your App to the Image ==</div>Bryce.Leohttp://wiki.openmoko.org/wiki/Customizing_the_Openmoko_DistributionCustomizing the Openmoko Distribution2007-07-29T23:31:05Z<p>Bryce.Leo: /* Your First Compilation */</p>
<hr />
<div>== What's the goal? ==<br />
<br />
The goal of this page is to teach you how to take an application that you've coded (or the sample app) and properly get it included in your rootfs. This article is a bit of an aggregate page, it's going to take information from [[MokoMakefile]] [http://wiki.openmoko.org/wiki/User:CesarB/Using_a_local_overlay Using_a_local_overlay] [[Building_a_hello_world_application]] and [[Create_a_package_from_existing_sources]]. So as you can see the goal is for it to be a very thorough introduction, and will take you from "Idea to Inclusion" of your application.<br />
<br />
<br />
== Setting Up the OpenMoko Environment ==<br />
<br />
This part of the tutorial is going to be pretty basic. I absolutely love [[MokoMakefile]], it's fantastic, the creator has done and continues to do a fantastic job with this. I see absolutely no reason not to use it. However I cannot for the life of me understand why they create their working directory in /home/moko, the home directory is for home directories for users of your system, not for a development directory. I put my OpenMoko development directory in /home/bryce/mokodev/ and that works great for me, and also makes more sense so that multiple users on my machine could develop with no attempt to overlap.<br />
<br />
To get your environment setup please get it setup according to [[MokoMakefile]] however if you do have the build environment setup manually and you're sure you know what you're doing then feel free to go forward with this.<br />
<br />
== Setting Up a Local Overlay ==<br />
If you're at the point for setting up a local overlay this means a couple things. First: You've had a brilliant idea for an application that you just need to have on the OpenMoko platform. Second: You realize that this killer app of yours needs to be done properly and you're not going to do anything silly like include it in the actual tree for the OpenMoko distro because it would probably end up just getting overwritten eventually, or you just realize taht it's bad practice!<br />
<br />
Thank you to [[User:CesarB]] for this part of the wiki.<br />
<br />
To create a local overlay:<br />
<br />
* Create a "local" directory and its subdirectories<br />
<br />
mkdir local local/conf local/classes local/packages<br />
<br />
* Copy <code>site.conf</code> from the openmoko tree to <code>local/conf</code><br />
<br />
cp oe/conf/site.conf local/conf/site.conf<br />
<br />
* Edit the site.conf you copied to add the new tree as a source for bitbake recipes.<br />
<br />
Change the current <code>BBFILES</code> to look like this:<br />
BBFILES := "${OMDIR}/openembedded/packages/*/*.bb ${OMDIR}/oe/packages/*/*.bb ${OMDIR}/local/packages/*/*.bb"<br />
Change your <code>BBFILE_COLLECTIONS</code> line to look like this:<br />
BBFILE_COLLECTIONS = "upstream local overlay"<br />
Add this line:<br />
BBFILE_PATTERN_overlay = "^${OMDIR}/local/"<br />
Add this line:<br />
BBFILE_PRIORITY_overlay = "20"<br />
<br />
The <code>BBFILE_PRIORITY</code> should be greater than all the other <code>BBFILE_PRIORITY</code> variables on the same file.<br />
<br />
* Change your <code>BBPATH</code> environment variable to add the new tree ''before'' the two others for [[MokoMakefile]], the variable is on the <code>setup-env</code> file.<br />
<br />
export BBPATH="${OMDIR}/build:${OMDIR}/local:${OMDIR}/oe:${OMDIR}/openembedded"<br />
<br />
== Using Your New Local Overlay ==<br />
<br />
=== Changing files in conf/ ===<br />
<br />
To change a file in conf/, just copy the file to the overlay tree (preserving the directory structure) and edit it.<br />
<br />
=== Changing files in classes/ ===<br />
<br />
To change a file in classes/, just copy the file to the overlay tree and edit it.<br />
<br />
=== Changing packages ===<br />
<br />
Changing a package's recipe is a bit more complex. You have to copy over (or symlink) not only the .bb file for the package, but also ''all'' the files it includes with <code>require</code>, and the <code>FILESDIR</code> directories (all directories referred to by <code>FILESDIR</code>, usually named either ''package''-''version'' or <code>files</code>). If you forget one of them, the build will give an error (either when parsing the recipe in the case of <code>require</code>, or when trying to build in the case of the <code>FILESDIR</code> directories).<br />
<br />
=== Adding a new package ===<br />
<br />
You can add a new package (or a recipe for a new version of a package) to the overlay tree simply by creating it on the overlay tree.<br />
<br />
== Your First Application ==<br />
<br />
I know that I said I'd have a GDK application in here, however, I'd really like to get this whole course done first and have you guys starting to code instead of just looking at what I've written!<br />
<br />
This will be a very simple CLI hello world.<br />
<br />
=== Before We Code ===<br />
<br />
Like a good coder you want to make sure that you're not just doing things, but that you're doing them the right way! <br />
<br />
Now change directories into your <code>local/packages</code> directory.The following commands expect you'll be in that directory so don't change unless you know what you're doing!<br />
<br />
You'll want to make a directory with the name of your application, and a subdirectory called files.<br />
mkdir myhelloworld myhelloworld/files<br />
Now you'll want to create two files in the <code>files</code> directory<br />
touch myhelloworld/files/READEME.txt myhelloworld/files/myhelloworld.c<br />
And finally you'll want to create a bitbake file.<br />
touch myhelloworld/myhelloworld.bb<br />
<br />
Alrighty now all your necessary files are created so lets go over this real quick.<br />
<pre><br />
$HOME<br />
+- $OMDIR (contains the official openmoko tree)<br />
| +- local/<br />
| +- packages/<br />
| +- myhelloworld/<br />
| +- myhelloworld.bb<br />
| +- files/<br />
| +- myhelloworld.c<br />
| +- README.txt<br />
</pre><br />
<br />
That should be your structure, if it's not you should go and fix it up.<br />
=== Filling the Files ===<br />
<br />
So you've got your sample files all laid out now it's time to make them actually do something.<br />
<br />
myhelloworld.c<br />
<pre><br />
#include <stdio.h><br />
<br />
int main(int argc, char** argv)<br />
{<br />
printf("Ello Poppet!\n");<br />
return 0;<br />
}<br />
</pre><br />
<br />
README.txt<br />
<pre><br />
This is a command line application. It prints a simple Hello World! To stdout.<br />
</pre><br />
<br />
myhelloworld.bb<br />
<pre><br />
DESCRIPTION = "A killer hello world applicaiton"<br />
AUTHOR = "Bryce Leo"<br />
HOMEPAGE = ""<br />
SECTION = "console/applications"<br />
PRIORITY = "optional"<br />
LICENSE = "MIT"<br />
#DEPENDS = ""<br />
#RDEPENDS = ""<br />
#RRECOMMENDS = ""<br />
#RCONFLICTS = ""<br />
#SRCDATE = "20070729"<br />
#PV = "0.1"<br />
#PR = "r0"<br />
SRC_URI = "file://myhelloworld.c \<br />
file://README.txt "<br />
<br />
S = "${WORKDIR}/myhelloworld/"<br />
<br />
do_compile() {<br />
${CC} ${CFLAGS} ${LDFLAGS} ${WORKDIR}/myhelloworld.c -o myhelloworld<br />
}<br />
<br />
do_install() {<br />
install -m 0755 -d ${D}${bindir} ${D}${docdir}/myhelloworld<br />
install -m 0755 ${S}/myhelloworld ${D}${bindir}<br />
install -m 0644 ${WORKDIR}/README.txt ${D}${docdir}/myhelloworld<br />
}<br />
<br />
</pre><br />
<br />
=== Your First Compilation ===<br />
<br />
This is where the [[MokoMakefile]] comes in very very handy. Change to your ${OMDIR} directory, You'll now it by the fact that it is where <code>Makefile</code> resides.<br />
make build-package-myhelloworld<br />
This should all come back and not return any error messages, The output should end in something similar to<br />
<pre><br />
NOTE: package myhelloworld-1.0: completed<br />
NOTE: build 200707291926: completed<br />
Build statistics:<br />
Attempted builds: 1<br />
<pre><br />
<br />
Now that no errors were thrown we are happily done!</div>Bryce.Leohttp://wiki.openmoko.org/wiki/Customizing_the_Openmoko_DistributionCustomizing the Openmoko Distribution2007-07-29T22:48:51Z<p>Bryce.Leo: /* Filling the Files */</p>
<hr />
<div>== What's the goal? ==<br />
<br />
The goal of this page is to teach you how to take an application that you've coded (or the sample app) and properly get it included in your rootfs. This article is a bit of an aggregate page, it's going to take information from [[MokoMakefile]] [http://wiki.openmoko.org/wiki/User:CesarB/Using_a_local_overlay Using_a_local_overlay] [[Building_a_hello_world_application]] and [[Create_a_package_from_existing_sources]]. So as you can see the goal is for it to be a very thorough introduction, and will take you from "Idea to Inclusion" of your application.<br />
<br />
<br />
== Setting Up the OpenMoko Environment ==<br />
<br />
This part of the tutorial is going to be pretty basic. I absolutely love [[MokoMakefile]], it's fantastic, the creator has done and continues to do a fantastic job with this. I see absolutely no reason not to use it. However I cannot for the life of me understand why they create their working directory in /home/moko, the home directory is for home directories for users of your system, not for a development directory. I put my OpenMoko development directory in /home/bryce/mokodev/ and that works great for me, and also makes more sense so that multiple users on my machine could develop with no attempt to overlap.<br />
<br />
To get your environment setup please get it setup according to [[MokoMakefile]] however if you do have the build environment setup manually and you're sure you know what you're doing then feel free to go forward with this.<br />
<br />
== Setting Up a Local Overlay ==<br />
If you're at the point for setting up a local overlay this means a couple things. First: You've had a brilliant idea for an application that you just need to have on the OpenMoko platform. Second: You realize that this killer app of yours needs to be done properly and you're not going to do anything silly like include it in the actual tree for the OpenMoko distro because it would probably end up just getting overwritten eventually, or you just realize taht it's bad practice!<br />
<br />
Thank you to [[User:CesarB]] for this part of the wiki.<br />
<br />
To create a local overlay:<br />
<br />
* Create a "local" directory and its subdirectories<br />
<br />
mkdir local local/conf local/classes local/packages<br />
<br />
* Copy <code>site.conf</code> from the openmoko tree to <code>local/conf</code><br />
<br />
cp oe/conf/site.conf local/conf/site.conf<br />
<br />
* Edit the site.conf you copied to add the new tree as a source for bitbake recipes.<br />
<br />
Change the current <code>BBFILES</code> to look like this:<br />
BBFILES := "${OMDIR}/openembedded/packages/*/*.bb ${OMDIR}/oe/packages/*/*.bb ${OMDIR}/local/packages/*/*.bb"<br />
Change your <code>BBFILE_COLLECTIONS</code> line to look like this:<br />
BBFILE_COLLECTIONS = "upstream local overlay"<br />
Add this line:<br />
BBFILE_PATTERN_overlay = "^${OMDIR}/local/"<br />
Add this line:<br />
BBFILE_PRIORITY_overlay = "20"<br />
<br />
The <code>BBFILE_PRIORITY</code> should be greater than all the other <code>BBFILE_PRIORITY</code> variables on the same file.<br />
<br />
* Change your <code>BBPATH</code> environment variable to add the new tree ''before'' the two others for [[MokoMakefile]], the variable is on the <code>setup-env</code> file.<br />
<br />
export BBPATH="${OMDIR}/build:${OMDIR}/local:${OMDIR}/oe:${OMDIR}/openembedded"<br />
<br />
== Using Your New Local Overlay ==<br />
<br />
=== Changing files in conf/ ===<br />
<br />
To change a file in conf/, just copy the file to the overlay tree (preserving the directory structure) and edit it.<br />
<br />
=== Changing files in classes/ ===<br />
<br />
To change a file in classes/, just copy the file to the overlay tree and edit it.<br />
<br />
=== Changing packages ===<br />
<br />
Changing a package's recipe is a bit more complex. You have to copy over (or symlink) not only the .bb file for the package, but also ''all'' the files it includes with <code>require</code>, and the <code>FILESDIR</code> directories (all directories referred to by <code>FILESDIR</code>, usually named either ''package''-''version'' or <code>files</code>). If you forget one of them, the build will give an error (either when parsing the recipe in the case of <code>require</code>, or when trying to build in the case of the <code>FILESDIR</code> directories).<br />
<br />
=== Adding a new package ===<br />
<br />
You can add a new package (or a recipe for a new version of a package) to the overlay tree simply by creating it on the overlay tree.<br />
<br />
== Your First Application ==<br />
<br />
I know that I said I'd have a GDK application in here, however, I'd really like to get this whole course done first and have you guys starting to code instead of just looking at what I've written!<br />
<br />
This will be a very simple CLI hello world.<br />
<br />
=== Before We Code ===<br />
<br />
Like a good coder you want to make sure that you're not just doing things, but that you're doing them the right way! <br />
<br />
Now change directories into your <code>local/packages</code> directory.The following commands expect you'll be in that directory so don't change unless you know what you're doing!<br />
<br />
You'll want to make a directory with the name of your application, and a subdirectory called files.<br />
mkdir myhelloworld myhelloworld/files<br />
Now you'll want to create two files in the <code>files</code> directory<br />
touch myhelloworld/files/READEME.txt myhelloworld/files/myhelloworld.c<br />
And finally you'll want to create a bitbake file.<br />
touch myhelloworld/myhelloworld.bb<br />
<br />
Alrighty now all your necessary files are created so lets go over this real quick.<br />
<pre><br />
$HOME<br />
+- $OMDIR (contains the official openmoko tree)<br />
| +- local/<br />
| +- packages/<br />
| +- myhelloworld/<br />
| +- myhelloworld.bb<br />
| +- files/<br />
| +- myhelloworld.c<br />
| +- README.txt<br />
</pre><br />
<br />
That should be your structure, if it's not you should go and fix it up.<br />
=== Filling the Files ===<br />
<br />
So you've got your sample files all laid out now it's time to make them actually do something.<br />
<br />
myhelloworld.c<br />
<pre><br />
#include <stdio.h><br />
<br />
int main(int argc, char** argv)<br />
{<br />
printf("Ello Poppet!\n");<br />
return 0;<br />
}<br />
</pre><br />
<br />
README.txt<br />
<pre><br />
This is a command line application. It prints a simple Hello World! To stdout.<br />
</pre><br />
<br />
myhelloworld.bb<br />
<pre><br />
DESCRIPTION = "A killer hello world applicaiton"<br />
AUTHOR = "Bryce Leo"<br />
HOMEPAGE = ""<br />
SECTION = "console/applications"<br />
PRIORITY = "optional"<br />
LICENSE = "MIT"<br />
#DEPENDS = ""<br />
#RDEPENDS = ""<br />
#RRECOMMENDS = ""<br />
#RCONFLICTS = ""<br />
#SRCDATE = "20070729"<br />
#PV = "0.1"<br />
#PR = "r0"<br />
SRC_URI = "file://myhelloworld.c \<br />
file://README.txt "<br />
<br />
S = "${WORKDIR}/myhelloworld/"<br />
<br />
do_compile() {<br />
${CC} ${CFLAGS} ${LDFLAGS} ${WORKDIR}/myhelloworld.c -o myhelloworld<br />
}<br />
<br />
do_install() {<br />
install -m 0755 -d ${D}${bindir} ${D}${docdir}/myhelloworld<br />
install -m 0755 ${S}/myhelloworld ${D}${bindir}<br />
install -m 0644 ${WORKDIR}/README.txt ${D}${docdir}/myhelloworld<br />
}<br />
<br />
</pre><br />
<br />
=== Your First Compilation ===</div>Bryce.Leohttp://wiki.openmoko.org/wiki/Customizing_the_Openmoko_DistributionCustomizing the Openmoko Distribution2007-07-29T22:47:47Z<p>Bryce.Leo: /* Filling the Files */</p>
<hr />
<div>== What's the goal? ==<br />
<br />
The goal of this page is to teach you how to take an application that you've coded (or the sample app) and properly get it included in your rootfs. This article is a bit of an aggregate page, it's going to take information from [[MokoMakefile]] [http://wiki.openmoko.org/wiki/User:CesarB/Using_a_local_overlay Using_a_local_overlay] [[Building_a_hello_world_application]] and [[Create_a_package_from_existing_sources]]. So as you can see the goal is for it to be a very thorough introduction, and will take you from "Idea to Inclusion" of your application.<br />
<br />
<br />
== Setting Up the OpenMoko Environment ==<br />
<br />
This part of the tutorial is going to be pretty basic. I absolutely love [[MokoMakefile]], it's fantastic, the creator has done and continues to do a fantastic job with this. I see absolutely no reason not to use it. However I cannot for the life of me understand why they create their working directory in /home/moko, the home directory is for home directories for users of your system, not for a development directory. I put my OpenMoko development directory in /home/bryce/mokodev/ and that works great for me, and also makes more sense so that multiple users on my machine could develop with no attempt to overlap.<br />
<br />
To get your environment setup please get it setup according to [[MokoMakefile]] however if you do have the build environment setup manually and you're sure you know what you're doing then feel free to go forward with this.<br />
<br />
== Setting Up a Local Overlay ==<br />
If you're at the point for setting up a local overlay this means a couple things. First: You've had a brilliant idea for an application that you just need to have on the OpenMoko platform. Second: You realize that this killer app of yours needs to be done properly and you're not going to do anything silly like include it in the actual tree for the OpenMoko distro because it would probably end up just getting overwritten eventually, or you just realize taht it's bad practice!<br />
<br />
Thank you to [[User:CesarB]] for this part of the wiki.<br />
<br />
To create a local overlay:<br />
<br />
* Create a "local" directory and its subdirectories<br />
<br />
mkdir local local/conf local/classes local/packages<br />
<br />
* Copy <code>site.conf</code> from the openmoko tree to <code>local/conf</code><br />
<br />
cp oe/conf/site.conf local/conf/site.conf<br />
<br />
* Edit the site.conf you copied to add the new tree as a source for bitbake recipes.<br />
<br />
Change the current <code>BBFILES</code> to look like this:<br />
BBFILES := "${OMDIR}/openembedded/packages/*/*.bb ${OMDIR}/oe/packages/*/*.bb ${OMDIR}/local/packages/*/*.bb"<br />
Change your <code>BBFILE_COLLECTIONS</code> line to look like this:<br />
BBFILE_COLLECTIONS = "upstream local overlay"<br />
Add this line:<br />
BBFILE_PATTERN_overlay = "^${OMDIR}/local/"<br />
Add this line:<br />
BBFILE_PRIORITY_overlay = "20"<br />
<br />
The <code>BBFILE_PRIORITY</code> should be greater than all the other <code>BBFILE_PRIORITY</code> variables on the same file.<br />
<br />
* Change your <code>BBPATH</code> environment variable to add the new tree ''before'' the two others for [[MokoMakefile]], the variable is on the <code>setup-env</code> file.<br />
<br />
export BBPATH="${OMDIR}/build:${OMDIR}/local:${OMDIR}/oe:${OMDIR}/openembedded"<br />
<br />
== Using Your New Local Overlay ==<br />
<br />
=== Changing files in conf/ ===<br />
<br />
To change a file in conf/, just copy the file to the overlay tree (preserving the directory structure) and edit it.<br />
<br />
=== Changing files in classes/ ===<br />
<br />
To change a file in classes/, just copy the file to the overlay tree and edit it.<br />
<br />
=== Changing packages ===<br />
<br />
Changing a package's recipe is a bit more complex. You have to copy over (or symlink) not only the .bb file for the package, but also ''all'' the files it includes with <code>require</code>, and the <code>FILESDIR</code> directories (all directories referred to by <code>FILESDIR</code>, usually named either ''package''-''version'' or <code>files</code>). If you forget one of them, the build will give an error (either when parsing the recipe in the case of <code>require</code>, or when trying to build in the case of the <code>FILESDIR</code> directories).<br />
<br />
=== Adding a new package ===<br />
<br />
You can add a new package (or a recipe for a new version of a package) to the overlay tree simply by creating it on the overlay tree.<br />
<br />
== Your First Application ==<br />
<br />
I know that I said I'd have a GDK application in here, however, I'd really like to get this whole course done first and have you guys starting to code instead of just looking at what I've written!<br />
<br />
This will be a very simple CLI hello world.<br />
<br />
=== Before We Code ===<br />
<br />
Like a good coder you want to make sure that you're not just doing things, but that you're doing them the right way! <br />
<br />
Now change directories into your <code>local/packages</code> directory.The following commands expect you'll be in that directory so don't change unless you know what you're doing!<br />
<br />
You'll want to make a directory with the name of your application, and a subdirectory called files.<br />
mkdir myhelloworld myhelloworld/files<br />
Now you'll want to create two files in the <code>files</code> directory<br />
touch myhelloworld/files/READEME.txt myhelloworld/files/myhelloworld.c<br />
And finally you'll want to create a bitbake file.<br />
touch myhelloworld/myhelloworld.bb<br />
<br />
Alrighty now all your necessary files are created so lets go over this real quick.<br />
<pre><br />
$HOME<br />
+- $OMDIR (contains the official openmoko tree)<br />
| +- local/<br />
| +- packages/<br />
| +- myhelloworld/<br />
| +- myhelloworld.bb<br />
| +- files/<br />
| +- myhelloworld.c<br />
| +- README.txt<br />
</pre><br />
<br />
That should be your structure, if it's not you should go and fix it up.<br />
=== Filling the Files ===<br />
<br />
So you've got your sample files all laid out now it's time to make them actually do something.<br />
<br />
myhelloworld.c<br />
<pre><br />
#include <stdio.h><br />
<br />
int main(int argc, char** argv)<br />
{<br />
printf("Hello world!\n");<br />
return 0;<br />
}<br />
</pre><br />
<br />
README.txt<br />
<pre><br />
This is a command line application. It prints a simple Hello World! To stdout.<br />
</pre><br />
<br />
myhelloworld.bb<br />
<pre><br />
DESCRIPTION = "A killer hello world applicaiton"<br />
AUTHOR = "Bryce Leo"<br />
HOMEPAGE = ""<br />
SECTION = "console/applications"<br />
PRIORITY = "optional"<br />
LICENSE = "MIT"<br />
#DEPENDS = ""<br />
#RDEPENDS = ""<br />
#RRECOMMENDS = ""<br />
#RCONFLICTS = ""<br />
#SRCDATE = "20070729"<br />
#PV = "0.1"<br />
#PR = "r0"<br />
SRC_URI = "file://myhelloworld.c \<br />
file://README.txt "<br />
<br />
S = "${WORKDIR}/myhelloworld/"<br />
<br />
do_compile() {<br />
${CC} ${CFLAGS} ${LDFLAGS} ${WORKDIR}/myhelloworld.c -o myhelloworld<br />
}<br />
<br />
do_install() {<br />
install -m 0755 -d ${D}${bindir} ${D}${docdir}/myhelloworld<br />
install -m 0755 ${S}/myhelloworld ${D}${bindir}<br />
install -m 0644 ${WORKDIR}/README.txt ${D}${docdir}/myhelloworld<br />
}<br />
<br />
</pre><br />
<br />
=== Your First Compilation ===</div>Bryce.Leohttp://wiki.openmoko.org/wiki/Customizing_the_Openmoko_DistributionCustomizing the Openmoko Distribution2007-07-29T22:42:24Z<p>Bryce.Leo: /* Filling the Files */</p>
<hr />
<div>== What's the goal? ==<br />
<br />
The goal of this page is to teach you how to take an application that you've coded (or the sample app) and properly get it included in your rootfs. This article is a bit of an aggregate page, it's going to take information from [[MokoMakefile]] [http://wiki.openmoko.org/wiki/User:CesarB/Using_a_local_overlay Using_a_local_overlay] [[Building_a_hello_world_application]] and [[Create_a_package_from_existing_sources]]. So as you can see the goal is for it to be a very thorough introduction, and will take you from "Idea to Inclusion" of your application.<br />
<br />
<br />
== Setting Up the OpenMoko Environment ==<br />
<br />
This part of the tutorial is going to be pretty basic. I absolutely love [[MokoMakefile]], it's fantastic, the creator has done and continues to do a fantastic job with this. I see absolutely no reason not to use it. However I cannot for the life of me understand why they create their working directory in /home/moko, the home directory is for home directories for users of your system, not for a development directory. I put my OpenMoko development directory in /home/bryce/mokodev/ and that works great for me, and also makes more sense so that multiple users on my machine could develop with no attempt to overlap.<br />
<br />
To get your environment setup please get it setup according to [[MokoMakefile]] however if you do have the build environment setup manually and you're sure you know what you're doing then feel free to go forward with this.<br />
<br />
== Setting Up a Local Overlay ==<br />
If you're at the point for setting up a local overlay this means a couple things. First: You've had a brilliant idea for an application that you just need to have on the OpenMoko platform. Second: You realize that this killer app of yours needs to be done properly and you're not going to do anything silly like include it in the actual tree for the OpenMoko distro because it would probably end up just getting overwritten eventually, or you just realize taht it's bad practice!<br />
<br />
Thank you to [[User:CesarB]] for this part of the wiki.<br />
<br />
To create a local overlay:<br />
<br />
* Create a "local" directory and its subdirectories<br />
<br />
mkdir local local/conf local/classes local/packages<br />
<br />
* Copy <code>site.conf</code> from the openmoko tree to <code>local/conf</code><br />
<br />
cp oe/conf/site.conf local/conf/site.conf<br />
<br />
* Edit the site.conf you copied to add the new tree as a source for bitbake recipes.<br />
<br />
Change the current <code>BBFILES</code> to look like this:<br />
BBFILES := "${OMDIR}/openembedded/packages/*/*.bb ${OMDIR}/oe/packages/*/*.bb ${OMDIR}/local/packages/*/*.bb"<br />
Change your <code>BBFILE_COLLECTIONS</code> line to look like this:<br />
BBFILE_COLLECTIONS = "upstream local overlay"<br />
Add this line:<br />
BBFILE_PATTERN_overlay = "^${OMDIR}/local/"<br />
Add this line:<br />
BBFILE_PRIORITY_overlay = "20"<br />
<br />
The <code>BBFILE_PRIORITY</code> should be greater than all the other <code>BBFILE_PRIORITY</code> variables on the same file.<br />
<br />
* Change your <code>BBPATH</code> environment variable to add the new tree ''before'' the two others for [[MokoMakefile]], the variable is on the <code>setup-env</code> file.<br />
<br />
export BBPATH="${OMDIR}/build:${OMDIR}/local:${OMDIR}/oe:${OMDIR}/openembedded"<br />
<br />
== Using Your New Local Overlay ==<br />
<br />
=== Changing files in conf/ ===<br />
<br />
To change a file in conf/, just copy the file to the overlay tree (preserving the directory structure) and edit it.<br />
<br />
=== Changing files in classes/ ===<br />
<br />
To change a file in classes/, just copy the file to the overlay tree and edit it.<br />
<br />
=== Changing packages ===<br />
<br />
Changing a package's recipe is a bit more complex. You have to copy over (or symlink) not only the .bb file for the package, but also ''all'' the files it includes with <code>require</code>, and the <code>FILESDIR</code> directories (all directories referred to by <code>FILESDIR</code>, usually named either ''package''-''version'' or <code>files</code>). If you forget one of them, the build will give an error (either when parsing the recipe in the case of <code>require</code>, or when trying to build in the case of the <code>FILESDIR</code> directories).<br />
<br />
=== Adding a new package ===<br />
<br />
You can add a new package (or a recipe for a new version of a package) to the overlay tree simply by creating it on the overlay tree.<br />
<br />
== Your First Application ==<br />
<br />
I know that I said I'd have a GDK application in here, however, I'd really like to get this whole course done first and have you guys starting to code instead of just looking at what I've written!<br />
<br />
This will be a very simple CLI hello world.<br />
<br />
=== Before We Code ===<br />
<br />
Like a good coder you want to make sure that you're not just doing things, but that you're doing them the right way! <br />
<br />
Now change directories into your <code>local/packages</code> directory.The following commands expect you'll be in that directory so don't change unless you know what you're doing!<br />
<br />
You'll want to make a directory with the name of your application, and a subdirectory called files.<br />
mkdir myhelloworld myhelloworld/files<br />
Now you'll want to create two files in the <code>files</code> directory<br />
touch myhelloworld/files/READEME.txt myhelloworld/files/myhelloworld.c<br />
And finally you'll want to create a bitbake file.<br />
touch myhelloworld/myhelloworld.bb<br />
<br />
Alrighty now all your necessary files are created so lets go over this real quick.<br />
<pre><br />
$HOME<br />
+- $OMDIR (contains the official openmoko tree)<br />
| +- local/<br />
| +- packages/<br />
| +- myhelloworld/<br />
| +- myhelloworld.bb<br />
| +- files/<br />
| +- myhelloworld.c<br />
| +- README.txt<br />
</pre><br />
<br />
That should be your structure, if it's not you should go and fix it up.<br />
=== Filling the Files ===<br />
<br />
So you've got your sample files all laid out now it's time to make them actually do something.<br />
<br />
myhelloworld.c<br />
<pre><br />
#include <stdio.h><br />
<br />
int main(int argc, char** argv)<br />
{<br />
printf("Hello world!\n");<br />
return 0;<br />
}<br />
</pre><br />
<br />
README.txt<br />
<pre><br />
This is a command line application. It prints a simple Hello World! To stdout.<br />
</pre><br />
<br />
myhelloworld.bb<br />
<pre><br />
DESCRIPTION = "A killer hello world applicaiton"<br />
AUTHOR = "Bryce Leo"<br />
HOMEPAGE = ""<br />
SECTION = "console/applications"<br />
PRIORITY = "optional"<br />
LICENSE = "MIT"<br />
#DEPENDS = ""<br />
#RDEPENDS = ""<br />
#RRECOMMENDS = ""<br />
#RCONFLICTS = ""<br />
#SRCDATE = "20070729"<br />
#PV = "0.1"<br />
#PR = "r0"<br />
SRC_URI = "file://myhelloworld.c \<br />
file://README.txt "<br />
<br />
S = "${WORKDIR}/myhelloworld/"<br />
<br />
do_compile() {<br />
${CC} ${CFLAGS} ${LDFLAGS} ${WORKDIR}/myhelloworld.c -o myhelloworld<br />
}<br />
<br />
do_install() {<br />
install -m 0755 -d ${D}${bindir} ${D}${docdir}/myhelloworld<br />
install -m 0755 ${S}/myhelloworld ${D}${bindir}<br />
install -m 0644 ${WORKDIR}/README.txt ${D}${docdir}/myhelloworld<br />
}<br />
<br />
</pre></div>Bryce.Leohttp://wiki.openmoko.org/wiki/Customizing_the_Openmoko_DistributionCustomizing the Openmoko Distribution2007-07-29T18:32:14Z<p>Bryce.Leo: /* Before We Code */</p>
<hr />
<div>== What's the goal? ==<br />
<br />
The goal of this page is to teach you how to take an application that you've coded (or the sample app) and properly get it included in your rootfs. This article is a bit of an aggregate page, it's going to take information from [[MokoMakefile]] [http://wiki.openmoko.org/wiki/User:CesarB/Using_a_local_overlay Using_a_local_overlay] [[Building_a_hello_world_application]] and [[Create_a_package_from_existing_sources]]. So as you can see the goal is for it to be a very thorough introduction, and will take you from "Idea to Inclusion" of your application.<br />
<br />
<br />
== Setting Up the OpenMoko Environment ==<br />
<br />
This part of the tutorial is going to be pretty basic. I absolutely love [[MokoMakefile]], it's fantastic, the creator has done and continues to do a fantastic job with this. I see absolutely no reason not to use it. However I cannot for the life of me understand why they create their working directory in /home/moko, the home directory is for home directories for users of your system, not for a development directory. I put my OpenMoko development directory in /home/bryce/mokodev/ and that works great for me, and also makes more sense so that multiple users on my machine could develop with no attempt to overlap.<br />
<br />
To get your environment setup please get it setup according to [[MokoMakefile]] however if you do have the build environment setup manually and you're sure you know what you're doing then feel free to go forward with this.<br />
<br />
== Setting Up a Local Overlay ==<br />
If you're at the point for setting up a local overlay this means a couple things. First: You've had a brilliant idea for an application that you just need to have on the OpenMoko platform. Second: You realize that this killer app of yours needs to be done properly and you're not going to do anything silly like include it in the actual tree for the OpenMoko distro because it would probably end up just getting overwritten eventually, or you just realize taht it's bad practice!<br />
<br />
Thank you to [[User:CesarB]] for this part of the wiki.<br />
<br />
To create a local overlay:<br />
<br />
* Create a "local" directory and its subdirectories<br />
<br />
mkdir local local/conf local/classes local/packages<br />
<br />
* Copy <code>site.conf</code> from the openmoko tree to <code>local/conf</code><br />
<br />
cp oe/conf/site.conf local/conf/site.conf<br />
<br />
* Edit the site.conf you copied to add the new tree as a source for bitbake recipes.<br />
<br />
Change the current <code>BBFILES</code> to look like this:<br />
BBFILES := "${OMDIR}/openembedded/packages/*/*.bb ${OMDIR}/oe/packages/*/*.bb ${OMDIR}/local/packages/*/*.bb"<br />
Change your <code>BBFILE_COLLECTIONS</code> line to look like this:<br />
BBFILE_COLLECTIONS = "upstream local overlay"<br />
Add this line:<br />
BBFILE_PATTERN_overlay = "^${OMDIR}/local/"<br />
Add this line:<br />
BBFILE_PRIORITY_overlay = "20"<br />
<br />
The <code>BBFILE_PRIORITY</code> should be greater than all the other <code>BBFILE_PRIORITY</code> variables on the same file.<br />
<br />
* Change your <code>BBPATH</code> environment variable to add the new tree ''before'' the two others for [[MokoMakefile]], the variable is on the <code>setup-env</code> file.<br />
<br />
export BBPATH="${OMDIR}/build:${OMDIR}/local:${OMDIR}/oe:${OMDIR}/openembedded"<br />
<br />
== Using Your New Local Overlay ==<br />
<br />
=== Changing files in conf/ ===<br />
<br />
To change a file in conf/, just copy the file to the overlay tree (preserving the directory structure) and edit it.<br />
<br />
=== Changing files in classes/ ===<br />
<br />
To change a file in classes/, just copy the file to the overlay tree and edit it.<br />
<br />
=== Changing packages ===<br />
<br />
Changing a package's recipe is a bit more complex. You have to copy over (or symlink) not only the .bb file for the package, but also ''all'' the files it includes with <code>require</code>, and the <code>FILESDIR</code> directories (all directories referred to by <code>FILESDIR</code>, usually named either ''package''-''version'' or <code>files</code>). If you forget one of them, the build will give an error (either when parsing the recipe in the case of <code>require</code>, or when trying to build in the case of the <code>FILESDIR</code> directories).<br />
<br />
=== Adding a new package ===<br />
<br />
You can add a new package (or a recipe for a new version of a package) to the overlay tree simply by creating it on the overlay tree.<br />
<br />
== Your First Application ==<br />
<br />
I know that I said I'd have a GDK application in here, however, I'd really like to get this whole course done first and have you guys starting to code instead of just looking at what I've written!<br />
<br />
This will be a very simple CLI hello world.<br />
<br />
=== Before We Code ===<br />
<br />
Like a good coder you want to make sure that you're not just doing things, but that you're doing them the right way! <br />
<br />
Now change directories into your <code>local/packages</code> directory.The following commands expect you'll be in that directory so don't change unless you know what you're doing!<br />
<br />
You'll want to make a directory with the name of your application, and a subdirectory called files.<br />
mkdir myhelloworld myhelloworld/files<br />
Now you'll want to create two files in the <code>files</code> directory<br />
touch myhelloworld/files/READEME.txt myhelloworld/files/myhelloworld.c<br />
And finally you'll want to create a bitbake file.<br />
touch myhelloworld/myhelloworld.bb<br />
<br />
Alrighty now all your necessary files are created so lets go over this real quick.<br />
<pre><br />
$HOME<br />
+- $OMDIR (contains the official openmoko tree)<br />
| +- local/<br />
| +- packages/<br />
| +- myhelloworld/<br />
| +- myhelloworld.bb<br />
| +- files/<br />
| +- myhelloworld.c<br />
| +- README.txt<br />
</pre><br />
<br />
That should be your structure, if it's not you should go and fix it up.<br />
=== Filling the Files ===</div>Bryce.Leohttp://wiki.openmoko.org/wiki/Customizing_the_Openmoko_DistributionCustomizing the Openmoko Distribution2007-07-29T18:30:45Z<p>Bryce.Leo: /* Before We Code */</p>
<hr />
<div>== What's the goal? ==<br />
<br />
The goal of this page is to teach you how to take an application that you've coded (or the sample app) and properly get it included in your rootfs. This article is a bit of an aggregate page, it's going to take information from [[MokoMakefile]] [http://wiki.openmoko.org/wiki/User:CesarB/Using_a_local_overlay Using_a_local_overlay] [[Building_a_hello_world_application]] and [[Create_a_package_from_existing_sources]]. So as you can see the goal is for it to be a very thorough introduction, and will take you from "Idea to Inclusion" of your application.<br />
<br />
<br />
== Setting Up the OpenMoko Environment ==<br />
<br />
This part of the tutorial is going to be pretty basic. I absolutely love [[MokoMakefile]], it's fantastic, the creator has done and continues to do a fantastic job with this. I see absolutely no reason not to use it. However I cannot for the life of me understand why they create their working directory in /home/moko, the home directory is for home directories for users of your system, not for a development directory. I put my OpenMoko development directory in /home/bryce/mokodev/ and that works great for me, and also makes more sense so that multiple users on my machine could develop with no attempt to overlap.<br />
<br />
To get your environment setup please get it setup according to [[MokoMakefile]] however if you do have the build environment setup manually and you're sure you know what you're doing then feel free to go forward with this.<br />
<br />
== Setting Up a Local Overlay ==<br />
If you're at the point for setting up a local overlay this means a couple things. First: You've had a brilliant idea for an application that you just need to have on the OpenMoko platform. Second: You realize that this killer app of yours needs to be done properly and you're not going to do anything silly like include it in the actual tree for the OpenMoko distro because it would probably end up just getting overwritten eventually, or you just realize taht it's bad practice!<br />
<br />
Thank you to [[User:CesarB]] for this part of the wiki.<br />
<br />
To create a local overlay:<br />
<br />
* Create a "local" directory and its subdirectories<br />
<br />
mkdir local local/conf local/classes local/packages<br />
<br />
* Copy <code>site.conf</code> from the openmoko tree to <code>local/conf</code><br />
<br />
cp oe/conf/site.conf local/conf/site.conf<br />
<br />
* Edit the site.conf you copied to add the new tree as a source for bitbake recipes.<br />
<br />
Change the current <code>BBFILES</code> to look like this:<br />
BBFILES := "${OMDIR}/openembedded/packages/*/*.bb ${OMDIR}/oe/packages/*/*.bb ${OMDIR}/local/packages/*/*.bb"<br />
Change your <code>BBFILE_COLLECTIONS</code> line to look like this:<br />
BBFILE_COLLECTIONS = "upstream local overlay"<br />
Add this line:<br />
BBFILE_PATTERN_overlay = "^${OMDIR}/local/"<br />
Add this line:<br />
BBFILE_PRIORITY_overlay = "20"<br />
<br />
The <code>BBFILE_PRIORITY</code> should be greater than all the other <code>BBFILE_PRIORITY</code> variables on the same file.<br />
<br />
* Change your <code>BBPATH</code> environment variable to add the new tree ''before'' the two others for [[MokoMakefile]], the variable is on the <code>setup-env</code> file.<br />
<br />
export BBPATH="${OMDIR}/build:${OMDIR}/local:${OMDIR}/oe:${OMDIR}/openembedded"<br />
<br />
== Using Your New Local Overlay ==<br />
<br />
=== Changing files in conf/ ===<br />
<br />
To change a file in conf/, just copy the file to the overlay tree (preserving the directory structure) and edit it.<br />
<br />
=== Changing files in classes/ ===<br />
<br />
To change a file in classes/, just copy the file to the overlay tree and edit it.<br />
<br />
=== Changing packages ===<br />
<br />
Changing a package's recipe is a bit more complex. You have to copy over (or symlink) not only the .bb file for the package, but also ''all'' the files it includes with <code>require</code>, and the <code>FILESDIR</code> directories (all directories referred to by <code>FILESDIR</code>, usually named either ''package''-''version'' or <code>files</code>). If you forget one of them, the build will give an error (either when parsing the recipe in the case of <code>require</code>, or when trying to build in the case of the <code>FILESDIR</code> directories).<br />
<br />
=== Adding a new package ===<br />
<br />
You can add a new package (or a recipe for a new version of a package) to the overlay tree simply by creating it on the overlay tree.<br />
<br />
== Your First Application ==<br />
<br />
I know that I said I'd have a GDK application in here, however, I'd really like to get this whole course done first and have you guys starting to code instead of just looking at what I've written!<br />
<br />
This will be a very simple CLI hello world.<br />
<br />
=== Before We Code ===<br />
<br />
Like a good coder you want to make sure that you're not just doing things, but that you're doing them the right way! <br />
<br />
Now change directories into your <code>local/packages</code> directory.The following commands expect you'll be in that directory so don't change unless you know what you're doing!<br />
<br />
You'll want to make a directory with the name of your application, and a subdirectory called files.<br />
mkdir myhelloworld myhelloworld/files<br />
Now you'll want to create two files in the <code>files</code> directory<br />
touch myhelloworld/files/READEME.txt myhelloworld/files/myhelloworld.c<br />
And finally you'll want to create a bitbake file.<br />
touch myhelloworld/myhelloworld.bb<br />
<br />
Alrighty now all your necessary files are created so lets go over this real quick.<br />
<pre><br />
$HOME<br />
+- $OMDIR (contains the official openmoko tree)<br />
| +- local/<br />
| +- packages/<br />
| +- myhelloworld/<br />
| +- myhelloworld.bb<br />
| +- files/<br />
| +- myhelloworld.c<br />
| +- README.txt<br />
</pre><br />
<br />
That should be your structure, if it's not you should go and fix it up.</div>Bryce.Leohttp://wiki.openmoko.org/wiki/Customizing_the_Openmoko_DistributionCustomizing the Openmoko Distribution2007-07-29T16:57:01Z<p>Bryce.Leo: /* Before We Code */</p>
<hr />
<div>== What's the goal? ==<br />
<br />
The goal of this page is to teach you how to take an application that you've coded (or the sample app) and properly get it included in your rootfs. This article is a bit of an aggregate page, it's going to take information from [[MokoMakefile]] [http://wiki.openmoko.org/wiki/User:CesarB/Using_a_local_overlay Using_a_local_overlay] [[Building_a_hello_world_application]] and [[Create_a_package_from_existing_sources]]. So as you can see the goal is for it to be a very thorough introduction, and will take you from "Idea to Inclusion" of your application.<br />
<br />
<br />
== Setting Up the OpenMoko Environment ==<br />
<br />
This part of the tutorial is going to be pretty basic. I absolutely love [[MokoMakefile]], it's fantastic, the creator has done and continues to do a fantastic job with this. I see absolutely no reason not to use it. However I cannot for the life of me understand why they create their working directory in /home/moko, the home directory is for home directories for users of your system, not for a development directory. I put my OpenMoko development directory in /home/bryce/mokodev/ and that works great for me, and also makes more sense so that multiple users on my machine could develop with no attempt to overlap.<br />
<br />
To get your environment setup please get it setup according to [[MokoMakefile]] however if you do have the build environment setup manually and you're sure you know what you're doing then feel free to go forward with this.<br />
<br />
== Setting Up a Local Overlay ==<br />
If you're at the point for setting up a local overlay this means a couple things. First: You've had a brilliant idea for an application that you just need to have on the OpenMoko platform. Second: You realize that this killer app of yours needs to be done properly and you're not going to do anything silly like include it in the actual tree for the OpenMoko distro because it would probably end up just getting overwritten eventually, or you just realize taht it's bad practice!<br />
<br />
Thank you to [[User:CesarB]] for this part of the wiki.<br />
<br />
To create a local overlay:<br />
<br />
* Create a "local" directory and its subdirectories<br />
<br />
mkdir local local/conf local/classes local/packages<br />
<br />
* Copy <code>site.conf</code> from the openmoko tree to <code>local/conf</code><br />
<br />
cp oe/conf/site.conf local/conf/site.conf<br />
<br />
* Edit the site.conf you copied to add the new tree as a source for bitbake recipes.<br />
<br />
Change the current <code>BBFILES</code> to look like this:<br />
BBFILES := "${OMDIR}/openembedded/packages/*/*.bb ${OMDIR}/oe/packages/*/*.bb ${OMDIR}/local/packages/*/*.bb"<br />
Change your <code>BBFILE_COLLECTIONS</code> line to look like this:<br />
BBFILE_COLLECTIONS = "upstream local overlay"<br />
Add this line:<br />
BBFILE_PATTERN_overlay = "^${OMDIR}/local/"<br />
Add this line:<br />
BBFILE_PRIORITY_overlay = "20"<br />
<br />
The <code>BBFILE_PRIORITY</code> should be greater than all the other <code>BBFILE_PRIORITY</code> variables on the same file.<br />
<br />
* Change your <code>BBPATH</code> environment variable to add the new tree ''before'' the two others for [[MokoMakefile]], the variable is on the <code>setup-env</code> file.<br />
<br />
export BBPATH="${OMDIR}/build:${OMDIR}/local:${OMDIR}/oe:${OMDIR}/openembedded"<br />
<br />
== Using Your New Local Overlay ==<br />
<br />
=== Changing files in conf/ ===<br />
<br />
To change a file in conf/, just copy the file to the overlay tree (preserving the directory structure) and edit it.<br />
<br />
=== Changing files in classes/ ===<br />
<br />
To change a file in classes/, just copy the file to the overlay tree and edit it.<br />
<br />
=== Changing packages ===<br />
<br />
Changing a package's recipe is a bit more complex. You have to copy over (or symlink) not only the .bb file for the package, but also ''all'' the files it includes with <code>require</code>, and the <code>FILESDIR</code> directories (all directories referred to by <code>FILESDIR</code>, usually named either ''package''-''version'' or <code>files</code>). If you forget one of them, the build will give an error (either when parsing the recipe in the case of <code>require</code>, or when trying to build in the case of the <code>FILESDIR</code> directories).<br />
<br />
=== Adding a new package ===<br />
<br />
You can add a new package (or a recipe for a new version of a package) to the overlay tree simply by creating it on the overlay tree.<br />
<br />
== Your First Application ==<br />
<br />
I know that I said I'd have a GDK application in here, however, I'd really like to get this whole course done first and have you guys starting to code instead of just looking at what I've written!<br />
<br />
This will be a very simple CLI hello world.<br />
<br />
=== Before We Code ===<br />
<br />
Like a good coder you want to make sure that you're not just doing things, but that you're doing them the right way! <br />
<br />
Now change directories into your <code>local/packages</code> directory.The following commands expect you'll be in that directory so don't change unless you know what you're doing!<br />
<br />
You'll want to make a directory with the name of your application, and a subdirectory called files.<br />
mkdir myhelloworld myhelloworld/files<br />
Now you'll want to create two files in the <code>files</code> directory<br />
touch myhelloworld/files/READEME.txt myhelloworld/files/myhelloworld.c<br />
And finally you'll want to create a bitbake file.<br />
touch myhelloworld/myhelloworld.bb<br />
<br />
Alrighty no all your necessary files are created so lets go over this real quick.<br />
<pre><br />
$HOME<br />
+- $OMDIR (contains the official openmoko tree)<br />
| +- local/<br />
| +- packages/<br />
| +- myhelloworld/<br />
| +- myhelloworld.bb<br />
| +- files/<br />
| +- myhelloworld.c<br />
| +- README.txt<br />
</pre></div>Bryce.Leohttp://wiki.openmoko.org/wiki/Customizing_the_Openmoko_DistributionCustomizing the Openmoko Distribution2007-07-29T15:57:25Z<p>Bryce.Leo: /* Your First Application */</p>
<hr />
<div>== What's the goal? ==<br />
<br />
The goal of this page is to teach you how to take an application that you've coded (or the sample app) and properly get it included in your rootfs. This article is a bit of an aggregate page, it's going to take information from [[MokoMakefile]] [http://wiki.openmoko.org/wiki/User:CesarB/Using_a_local_overlay Using_a_local_overlay] [[Building_a_hello_world_application]] and [[Create_a_package_from_existing_sources]]. So as you can see the goal is for it to be a very thorough introduction, and will take you from "Idea to Inclusion" of your application.<br />
<br />
<br />
== Setting Up the OpenMoko Environment ==<br />
<br />
This part of the tutorial is going to be pretty basic. I absolutely love [[MokoMakefile]], it's fantastic, the creator has done and continues to do a fantastic job with this. I see absolutely no reason not to use it. However I cannot for the life of me understand why they create their working directory in /home/moko, the home directory is for home directories for users of your system, not for a development directory. I put my OpenMoko development directory in /home/bryce/mokodev/ and that works great for me, and also makes more sense so that multiple users on my machine could develop with no attempt to overlap.<br />
<br />
To get your environment setup please get it setup according to [[MokoMakefile]] however if you do have the build environment setup manually and you're sure you know what you're doing then feel free to go forward with this.<br />
<br />
== Setting Up a Local Overlay ==<br />
If you're at the point for setting up a local overlay this means a couple things. First: You've had a brilliant idea for an application that you just need to have on the OpenMoko platform. Second: You realize that this killer app of yours needs to be done properly and you're not going to do anything silly like include it in the actual tree for the OpenMoko distro because it would probably end up just getting overwritten eventually, or you just realize taht it's bad practice!<br />
<br />
Thank you to [[User:CesarB]] for this part of the wiki.<br />
<br />
To create a local overlay:<br />
<br />
* Create a "local" directory and its subdirectories<br />
<br />
mkdir local local/conf local/classes local/packages<br />
<br />
* Copy <code>site.conf</code> from the openmoko tree to <code>local/conf</code><br />
<br />
cp oe/conf/site.conf local/conf/site.conf<br />
<br />
* Edit the site.conf you copied to add the new tree as a source for bitbake recipes.<br />
<br />
Change the current <code>BBFILES</code> to look like this:<br />
BBFILES := "${OMDIR}/openembedded/packages/*/*.bb ${OMDIR}/oe/packages/*/*.bb ${OMDIR}/local/packages/*/*.bb"<br />
Change your <code>BBFILE_COLLECTIONS</code> line to look like this:<br />
BBFILE_COLLECTIONS = "upstream local overlay"<br />
Add this line:<br />
BBFILE_PATTERN_overlay = "^${OMDIR}/local/"<br />
Add this line:<br />
BBFILE_PRIORITY_overlay = "20"<br />
<br />
The <code>BBFILE_PRIORITY</code> should be greater than all the other <code>BBFILE_PRIORITY</code> variables on the same file.<br />
<br />
* Change your <code>BBPATH</code> environment variable to add the new tree ''before'' the two others for [[MokoMakefile]], the variable is on the <code>setup-env</code> file.<br />
<br />
export BBPATH="${OMDIR}/build:${OMDIR}/local:${OMDIR}/oe:${OMDIR}/openembedded"<br />
<br />
== Using Your New Local Overlay ==<br />
<br />
=== Changing files in conf/ ===<br />
<br />
To change a file in conf/, just copy the file to the overlay tree (preserving the directory structure) and edit it.<br />
<br />
=== Changing files in classes/ ===<br />
<br />
To change a file in classes/, just copy the file to the overlay tree and edit it.<br />
<br />
=== Changing packages ===<br />
<br />
Changing a package's recipe is a bit more complex. You have to copy over (or symlink) not only the .bb file for the package, but also ''all'' the files it includes with <code>require</code>, and the <code>FILESDIR</code> directories (all directories referred to by <code>FILESDIR</code>, usually named either ''package''-''version'' or <code>files</code>). If you forget one of them, the build will give an error (either when parsing the recipe in the case of <code>require</code>, or when trying to build in the case of the <code>FILESDIR</code> directories).<br />
<br />
=== Adding a new package ===<br />
<br />
You can add a new package (or a recipe for a new version of a package) to the overlay tree simply by creating it on the overlay tree.<br />
<br />
== Your First Application ==<br />
<br />
I know that I said I'd have a GDK application in here, however, I'd really like to get this whole course done first and have you guys starting to code instead of just looking at what I've written!<br />
<br />
This will be a very simple CLI hello world.<br />
<br />
=== Before We Code ===</div>Bryce.Leohttp://wiki.openmoko.org/wiki/Create_an_ipk_package_from_sourcesCreate an ipk package from sources2007-07-29T14:42:36Z<p>Bryce.Leo: /* Get this package included in the rootfs image */</p>
<hr />
<div>This is a small tutorial to help people that want to write new software for Openmoko, eg. to port existing programs.<br />
<br />
==Theory==<br />
OpenMoko uses OpenEmbedded, a package and root image build system.<br />
<br />
OpenEmbedded provides patches and Bitbake Recipes, that are similar to .spec files to build RPM packages. Bitbake is used to process recipes and obtain packages and FS images. For example, bitbake can fetch sources, apply patches, configure, make and install compiled sources. Other steps are user definable, but this is not the scope of this tutorial.<br />
<br />
A standard use of bitbake is to download an existing "vanilla" package, ie "gcc" or "binutils" or "linux kernel", apply platform patches (adding bugfixes, porting fixes, drivers, etc...) then compile and package the resulting binaries.<br />
<br />
==Software versionning==<br />
Versions management is a very wide topic, there are tons of different opinions about it, I'll try to be quick.<br />
<br />
Packages versions are important in a distribution building mechanism, and package versions are a complete part of the full package name. They are obviously used to track important changes made to your package, and isolate each version. Here we must be a little aware of basic version management.<br />
Current (most advanced) version is named the "trunk". Additions, fixes, etc. are done to the trunk.<br />
<br />
Once a certain level of functionality is achieved, a copy of the trunk (a "snapshot") is taken, and named with a version number. As a result, current development continues on the trunk, but users can download well defined "releases", with known bugs and functionnality level. This is called "branching". If version specific bugs are found in version a.b, then we can update this branch independently.<br />
<br />
In bitbake, we must specify which release of our software we are going to package. This may not be an habit, especially if you only develop small programs, not maintained by more than one or two person. If your software is named "myprogram" but has no real version number attached, you can just rename your project directory to "myprogram-1.0".<br />
<br />
This is a good practice; If you are packaging a software, then it will be used by other people, so when you modify it next time, put it in a folder named "myprogram-1.1" :) This brings clarity to users, ease of management to you, and ability to plan future releases to your team.<br />
<br />
==Example==<br />
Say you have a working software package, ie a file system directory with sources, Makefile, etc...<br />
Because this is a common method, I will base my presentation on a project generated using autotools. This implies that the software can be installed somewhere by following the magical steps ./configure && make && make install.<br />
<br />
===Prerequisites===<br />
You need a configured openmoko development tree. All details are in [[Building OpenMoko from scratch]]<br />
<br />
You may also do this with [[MokoMakeFile]], see instructions at the bottom.<br />
<br />
The following commands will give you one, they are copied from the above page. Just copy and paste in a shell.<br />
<br />
<pre><br />
#prepare<br />
cd $HOME<br />
mkdir OM<br />
cd OM<br />
<br />
#get openembedded<br />
wget http://www.openembedded.org/snapshots/OE.mtn.bz2<br />
bunzip2 OE.mtn.bz2<br />
mtn --db=OE.mtn pull monotone.openembedded.org org.openembedded.dev<br />
mtn --db=OE.mtn checkout --branch=org.openembedded.dev -r e2dbb52fe39df7ef786b6068f6178f29508dfded openembedded<br />
<br />
#get openmoko<br />
svn co http://svn.openmoko.org/ openmoko<br />
<br />
#create local config<br />
mkdir -p sources build/conf<br />
cat <<EOF >build/conf/local.conf<br />
MACHINE = "fic-gta01"<br />
DISTRO = "openmoko"<br />
BUILD_ARCH = "`uname -m`"<br />
EOF<br />
<br />
#fixes (didnt try without them)<br />
ln -s openmoko/trunk/oe ./oe<br />
cd sources<br />
mkdir -p ../build/tmp/stamps/armv4t-linux<br />
wget http://ftp.mozilla.org/pub/mozilla.org/js/older-packages/js-1.5.tar.gz<br />
touch ../build/tmp/stamps/armv4t-linux/js-1.5-r0.do_fetch<br />
wget http://us4.samba.org/samba/ftp/stable/samba-3.0.14a.tar.gz<br />
touch ../build/tmp/stamps/armv4t-linux/samba-3.0.14a-r15.do_fetch<br />
perl -pi.orig -e 's/ *$//;s/\r//g' ../openembedded/packages/gcc/gcc-4.1.1/gcc-4.1.1-pr13685-1.patch<br />
</pre><br />
<br />
Then, you need the environment variables described here: [[Building_OpenMoko_from_scratch#Environment_variables]]<br />
Put the given lines in a script, then go to your build/ dir and source it:<br />
<pre><br />
cat <<EOF >doenv.sh<br />
#!/bin/sh<br />
export OMDIR=`pwd`<br />
export BBPATH=$OMDIR/build:$OMDIR/openmoko/trunk/oe:$OMDIR/openembedded<br />
EOF<br />
. ./doenv.sh<br />
</pre><br />
<br />
After this, your tree will look like that:<br />
<pre><br />
$HOME/OM<br />
+- build<br />
| +- conf<br />
| | +- local.conf<br />
+- openmoko<br />
+- openembedded<br />
+- sources<br />
+- env.sh<br />
</pre><br />
etc...<br />
<br />
<br />
Follow the link to [[MokoMakefile]] and follow the instructions.<br />
You're now all set to start building. Remember to run the setup-env command for each time you open a terminal. This sets your environment variables, however it is easier to include them in the rc file of your shell.<br />
<br />
===Proposed directory layout for our new packages===<br />
Bitbake recipes are single files describing how to build a package. I recommend to have a recipe for each package version (myprogram-1.0.bb, myprogram-1.1.bb, etc.) all stored in a directory named "myprogram"<br />
<br />
Our personal tree can be everywhere else:<br />
<pre><br />
$HOME<br />
+- $OMDIR (contains the official openmoko tree)<br />
| +- ...<br />
+- My_personal_OpenMoko_Packages<br />
| +- packages<br />
| +- myhello<br />
| +- myhello-1.0.bb<br />
+- My_Personal_Projects_Folder<br />
+- myhello<br />
+- myhello-1.0<br />
+- configure.ac<br />
+- Makefile.am<br />
+- ...<br />
</pre><br />
<br />
To do a simple test, pack your sources in a tar, and put this tar on a web server:<br />
<pre><br />
cd My_personal_Projects_Folder/myhello<br />
tar cvfz myhello-1.0.tar.gz myhello-1.0/<br />
</pre><br />
This is correct, ie the tarball will have a NAME-VERSION subdirectory, that's what we need.<br />
<br />
===The recipe===<br />
In the bitbake file, you need to give<br />
* a description for your package, variable name is DESCRIPTION<br />
* a package name (PN)<br />
* a package version (PV)<br />
* a source URI, I'll give details later<br />
* a source version, to checkout a particular revision of versionned trees<br />
* Please see the [http://www.openembedded.org/wiki/StyleGuide Open Embedded StyleGuide] which should answer most if not all questions about .bb file conventions.<br />
<br />
here's an example:<br />
<br />
<pre>#package description<br />
DESCRIPTION = "An example application for openmoko, depending on a custom source repository"<br />
SECTION = "squalyl/myhello"<br />
<br />
#this is optional<br />
LICENSE = "GPLv2"<br />
<br />
PN = "myhello"<br />
PV = "1.0"<br />
<br />
#use "now" to force svn updates at each build<br />
#Using now is a very dangerous way to do it. ONLY use this in your<br />
#personal recipes when you're doing heavy testing, otherwise<br />
#choose a stable date and stick with it that way when you distribute your recipe<br />
#you don't have all sorts of versions getting built out in the wild.<br />
SRCDATE_${PN} = "now"<br />
SRC_URI = "svn://repo/path/myhello;proto=https;module=${PN}-${PV}"<br />
<br />
#for a tarball use:<br />
#SRC_URI = "http://server/path/package/${PN}-${PV}.tar.gz"<br />
<br />
#include standard rules to build a autoconf/automake package<br />
inherit autotools<br />
</pre><br />
<br />
Expressions starting by ${} are substituted, this allows you to download a tarball named "mypackage-1.0.tar.gz" for example<br />
<br />
=== Source URIs ===<br />
bitbake can get the source code for your project from a variety of locations including tarball, subversion and git.<br />
<br />
All of this is explained in the [http://bitbake.berlios.de/manual/ bitbake manual], particulary [http://bitbake.berlios.de/manual/ch03.html#id869590 here].<br />
<br />
The package build directory, the one where bitbake will run "configure" et al, will follow the name template: "PACKAGE_NAME-PACKAGE_VERSION", so<br />
<br />
* tarballs must extract to a subdirectory with this name<br />
* svn top directory must have this name<br />
<br />
It's very important. I spent 3 days blocking on this!<br />
<br />
===Tell bitbake to build our package===<br />
The only and one thing to do is edit $OMDIR/build/local.conf to tell bitbake to search our folders for .bb files:<br />
<pre><br />
BBFILES+="${HOME}/MypersonalOpenMokoPackages/packages/*/*.bb"<br />
</pre><br />
There is no need to change BBPATH or something else, this is only needed to add new configuration files, not recipes.<br />
<br />
Running<br />
<pre><br />
$ cd $OMDIR/build<br />
$ bitbake mypackage<br />
</pre><br />
will bring all the necessary operations to create a package in $OMDIR/build/tmp/deploy/ipk/armv4t/myhello .....<br />
<br />
The following is an example build log:<br />
<pre><br />
OE Build Configuration:<br />
BB_VERSION = "1.6.9"<br />
OE_REVISION = "<unknown>"<br />
TARGET_ARCH = "arm"<br />
TARGET_OS = "linux"<br />
MACHINE = "fic-gta01"<br />
DISTRO = "openmoko"<br />
DISTRO_VERSION = ".dev-snapshot-20070723"<br />
TARGET_FPU = "soft"<br />
<br />
NOTE: This BitBake doesn't support revision fetching, falling back to current date<br />
NOTE: preferred version 2.4 of glibc not available<br />
NOTE: preferred version 2.4 of glibc-intermediate not available<br />
NOTE: preferred version 2.4 of glibc not available<br />
NOTE: package myhello-1.0: started<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_fetch: started<br />
NOTE: Fetch svn://svn.unsads.com/squalyl/om/src/myhello;proto=https;module=myhello-1.0<br />
A myhello-1.0/configure.ac<br />
A myhello-1.0/include<br />
A myhello-1.0/include/config.h.in<br />
A myhello-1.0/cleanall.sh<br />
A myhello-1.0/AUTHORS<br />
A myhello-1.0/bootstrap.sh<br />
A myhello-1.0/ChangeLog<br />
A myhello-1.0/src<br />
A myhello-1.0/src/hello.c<br />
A myhello-1.0/Makefile.am<br />
A myhello-1.0/NEWS<br />
A myhello-1.0/README<br />
Révision 2116 extraite.<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_fetch: completed<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_unpack: started<br />
NOTE: Unpacking /home/squalyl/OM/sources/myhello-1.0_svn.unsads.com_.squalyl.om.src.myhello__now.tar.gz to /home/squalyl/OM/build/tmp/work/armv4t-linux/myhello-1.0-r0_0_200707231759/<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_unpack: completed<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_patch: started<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_patch: completed<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_configure: started<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_configure: completed<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_compile: started<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_compile: completed<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_install: started<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_install: completed<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_package: started<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_package: completed<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_package_write: started<br />
Packaged contents of myhello-dbg into /home/squalyl/OM/build/tmp/deploy/ipk/armv4t/myhello-dbg_1.0-r0_0_200707231759_armv4t.ipk<br />
Packaged contents of myhello into /home/squalyl/OM/build/tmp/deploy/ipk/armv4t/myhello_1.0-r0_0_200707231759_armv4t.ipk<br />
NOTE: Not creating empty archive for myhello-doc-1.0-r0_0_200707231759<br />
NOTE: Not creating empty archive for myhello-dev-1.0-r0_0_200707231759<br />
NOTE: Not creating empty archive for myhello-locale-1.0-r0_0_200707231759<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_package_write: completed<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_populate_staging: started<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_populate_staging: completed<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_build: started<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_build: completed<br />
NOTE: package myhello-1.0: completed<br />
NOTE: build 200707231952: completed<br />
Build statistics:<br />
Attempted builds: 1<br />
</pre><br />
<br />
===Get this package included in the rootfs image===<br />
<br />
<blockquote><br />
{| border="1" cellspacing="0" cellpadding="5" align="center"<br />
|*This method is not a standard or normal way to include a package. The proper method follows the improper method.<br />
|}<br />
</blockquote><br />
bitbake openmoko-devel-image is used to build the entire distribution, but it does not include your new package in the rootfs image.<br />
<br />
To do this, use:<br />
<br />
<pre>bitbake openmoko-devel-image -crebuild</pre><br />
<br />
This will actually rebuild the rootfs, including your new packages.<br />
<br />
<blockquote><br />
{| border="1" cellspacing="0" cellpadding="5" align="center"<br />
|*The suggested method follows below.<br />
|}<br />
</blockquote><br />
<br />
To include the package in the image there are two steps.<br />
<br />
First: Modify your local.conf. $OMDIR/build/conf/local.conf<br />
<pre><br />
DISTRO_EXTRA_RDEPENDS += "<app name>"<br />
</pre><br />
This adds your application as a dependency for building the distro.<br />
<br />
Second: Update the task-base.<br />
<pre><br />
bitbake task-base -crebuild<br />
</pre><br />
When you update the task base it re-builds and ipk file which will: "Merge machine and distro options to create a basic machine task/package" <br />
<br />
You could also add your package by modifying the openmoko/trunk/oe/packages/tasks/task-openmoko.bb and adding your application name with the trailing backslash right before the update-alternatives line.<br />
<pre><br />
modutils-initscripts \<br />
module-init-tools-depmod \<br />
udev \<br />
rsync \<br />
screen \<br />
<My application Name> \ <br />
# update-alternatives \<br />
</pre><br />
<br />
Then to test this out (if you're using the [[MokoMakefile]]) it's pretty simple.<br />
<pre><br />
make openmoko-devel-image<br />
make build-qemu<br />
make flash-qemu-local<br />
</pre><br />
And now you're running qemu with that fancy new image you just made!<br />
<br />
<br />
[[Category:Applications]]<br />
[[Category:Platform]]</div>Bryce.Leohttp://wiki.openmoko.org/wiki/Customizing_the_Openmoko_DistributionCustomizing the Openmoko Distribution2007-07-29T14:37:40Z<p>Bryce.Leo: /* Adding a new package */</p>
<hr />
<div>== What's the goal? ==<br />
<br />
The goal of this page is to teach you how to take an application that you've coded (or the sample app) and properly get it included in your rootfs. This article is a bit of an aggregate page, it's going to take information from [[MokoMakefile]] [http://wiki.openmoko.org/wiki/User:CesarB/Using_a_local_overlay Using_a_local_overlay] [[Building_a_hello_world_application]] and [[Create_a_package_from_existing_sources]]. So as you can see the goal is for it to be a very thorough introduction, and will take you from "Idea to Inclusion" of your application.<br />
<br />
<br />
== Setting Up the OpenMoko Environment ==<br />
<br />
This part of the tutorial is going to be pretty basic. I absolutely love [[MokoMakefile]], it's fantastic, the creator has done and continues to do a fantastic job with this. I see absolutely no reason not to use it. However I cannot for the life of me understand why they create their working directory in /home/moko, the home directory is for home directories for users of your system, not for a development directory. I put my OpenMoko development directory in /home/bryce/mokodev/ and that works great for me, and also makes more sense so that multiple users on my machine could develop with no attempt to overlap.<br />
<br />
To get your environment setup please get it setup according to [[MokoMakefile]] however if you do have the build environment setup manually and you're sure you know what you're doing then feel free to go forward with this.<br />
<br />
== Setting Up a Local Overlay ==<br />
If you're at the point for setting up a local overlay this means a couple things. First: You've had a brilliant idea for an application that you just need to have on the OpenMoko platform. Second: You realize that this killer app of yours needs to be done properly and you're not going to do anything silly like include it in the actual tree for the OpenMoko distro because it would probably end up just getting overwritten eventually, or you just realize taht it's bad practice!<br />
<br />
Thank you to [[User:CesarB]] for this part of the wiki.<br />
<br />
To create a local overlay:<br />
<br />
* Create a "local" directory and its subdirectories<br />
<br />
mkdir local local/conf local/classes local/packages<br />
<br />
* Copy <code>site.conf</code> from the openmoko tree to <code>local/conf</code><br />
<br />
cp oe/conf/site.conf local/conf/site.conf<br />
<br />
* Edit the site.conf you copied to add the new tree as a source for bitbake recipes.<br />
<br />
Change the current <code>BBFILES</code> to look like this:<br />
BBFILES := "${OMDIR}/openembedded/packages/*/*.bb ${OMDIR}/oe/packages/*/*.bb ${OMDIR}/local/packages/*/*.bb"<br />
Change your <code>BBFILE_COLLECTIONS</code> line to look like this:<br />
BBFILE_COLLECTIONS = "upstream local overlay"<br />
Add this line:<br />
BBFILE_PATTERN_overlay = "^${OMDIR}/local/"<br />
Add this line:<br />
BBFILE_PRIORITY_overlay = "20"<br />
<br />
The <code>BBFILE_PRIORITY</code> should be greater than all the other <code>BBFILE_PRIORITY</code> variables on the same file.<br />
<br />
* Change your <code>BBPATH</code> environment variable to add the new tree ''before'' the two others for [[MokoMakefile]], the variable is on the <code>setup-env</code> file.<br />
<br />
export BBPATH="${OMDIR}/build:${OMDIR}/local:${OMDIR}/oe:${OMDIR}/openembedded"<br />
<br />
== Using Your New Local Overlay ==<br />
<br />
=== Changing files in conf/ ===<br />
<br />
To change a file in conf/, just copy the file to the overlay tree (preserving the directory structure) and edit it.<br />
<br />
=== Changing files in classes/ ===<br />
<br />
To change a file in classes/, just copy the file to the overlay tree and edit it.<br />
<br />
=== Changing packages ===<br />
<br />
Changing a package's recipe is a bit more complex. You have to copy over (or symlink) not only the .bb file for the package, but also ''all'' the files it includes with <code>require</code>, and the <code>FILESDIR</code> directories (all directories referred to by <code>FILESDIR</code>, usually named either ''package''-''version'' or <code>files</code>). If you forget one of them, the build will give an error (either when parsing the recipe in the case of <code>require</code>, or when trying to build in the case of the <code>FILESDIR</code> directories).<br />
<br />
=== Adding a new package ===<br />
<br />
You can add a new package (or a recipe for a new version of a package) to the overlay tree simply by creating it on the overlay tree.<br />
<br />
== Your First Application ==</div>Bryce.Leohttp://wiki.openmoko.org/wiki/Customizing_the_Openmoko_DistributionCustomizing the Openmoko Distribution2007-07-29T14:34:20Z<p>Bryce.Leo: /* Setting Up a Local Overlay */</p>
<hr />
<div>== What's the goal? ==<br />
<br />
The goal of this page is to teach you how to take an application that you've coded (or the sample app) and properly get it included in your rootfs. This article is a bit of an aggregate page, it's going to take information from [[MokoMakefile]] [http://wiki.openmoko.org/wiki/User:CesarB/Using_a_local_overlay Using_a_local_overlay] [[Building_a_hello_world_application]] and [[Create_a_package_from_existing_sources]]. So as you can see the goal is for it to be a very thorough introduction, and will take you from "Idea to Inclusion" of your application.<br />
<br />
<br />
== Setting Up the OpenMoko Environment ==<br />
<br />
This part of the tutorial is going to be pretty basic. I absolutely love [[MokoMakefile]], it's fantastic, the creator has done and continues to do a fantastic job with this. I see absolutely no reason not to use it. However I cannot for the life of me understand why they create their working directory in /home/moko, the home directory is for home directories for users of your system, not for a development directory. I put my OpenMoko development directory in /home/bryce/mokodev/ and that works great for me, and also makes more sense so that multiple users on my machine could develop with no attempt to overlap.<br />
<br />
To get your environment setup please get it setup according to [[MokoMakefile]] however if you do have the build environment setup manually and you're sure you know what you're doing then feel free to go forward with this.<br />
<br />
== Setting Up a Local Overlay ==<br />
If you're at the point for setting up a local overlay this means a couple things. First: You've had a brilliant idea for an application that you just need to have on the OpenMoko platform. Second: You realize that this killer app of yours needs to be done properly and you're not going to do anything silly like include it in the actual tree for the OpenMoko distro because it would probably end up just getting overwritten eventually, or you just realize taht it's bad practice!<br />
<br />
Thank you to [[User:CesarB]] for this part of the wiki.<br />
<br />
To create a local overlay:<br />
<br />
* Create a "local" directory and its subdirectories<br />
<br />
mkdir local local/conf local/classes local/packages<br />
<br />
* Copy <code>site.conf</code> from the openmoko tree to <code>local/conf</code><br />
<br />
cp oe/conf/site.conf local/conf/site.conf<br />
<br />
* Edit the site.conf you copied to add the new tree as a source for bitbake recipes.<br />
<br />
Change the current <code>BBFILES</code> to look like this:<br />
BBFILES := "${OMDIR}/openembedded/packages/*/*.bb ${OMDIR}/oe/packages/*/*.bb ${OMDIR}/local/packages/*/*.bb"<br />
Change your <code>BBFILE_COLLECTIONS</code> line to look like this:<br />
BBFILE_COLLECTIONS = "upstream local overlay"<br />
Add this line:<br />
BBFILE_PATTERN_overlay = "^${OMDIR}/local/"<br />
Add this line:<br />
BBFILE_PRIORITY_overlay = "20"<br />
<br />
The <code>BBFILE_PRIORITY</code> should be greater than all the other <code>BBFILE_PRIORITY</code> variables on the same file.<br />
<br />
* Change your <code>BBPATH</code> environment variable to add the new tree ''before'' the two others for [[MokoMakefile]], the variable is on the <code>setup-env</code> file.<br />
<br />
export BBPATH="${OMDIR}/build:${OMDIR}/local:${OMDIR}/oe:${OMDIR}/openembedded"<br />
<br />
== Using Your New Local Overlay ==<br />
<br />
=== Changing files in conf/ ===<br />
<br />
To change a file in conf/, just copy the file to the overlay tree (preserving the directory structure) and edit it.<br />
<br />
=== Changing files in classes/ ===<br />
<br />
To change a file in classes/, just copy the file to the overlay tree and edit it.<br />
<br />
=== Changing packages ===<br />
<br />
Changing a package's recipe is a bit more complex. You have to copy over (or symlink) not only the .bb file for the package, but also ''all'' the files it includes with <code>require</code>, and the <code>FILESDIR</code> directories (all directories referred to by <code>FILESDIR</code>, usually named either ''package''-''version'' or <code>files</code>). If you forget one of them, the build will give an error (either when parsing the recipe in the case of <code>require</code>, or when trying to build in the case of the <code>FILESDIR</code> directories).<br />
<br />
=== Adding a new package ===<br />
<br />
You can add a new package (or a recipe for a new version of a package) to the overlay tree simply by creating it on the overlay tree.</div>Bryce.Leohttp://wiki.openmoko.org/wiki/Customizing_the_Openmoko_DistributionCustomizing the Openmoko Distribution2007-07-29T14:32:33Z<p>Bryce.Leo: /* Setting Up a Local Overlay */</p>
<hr />
<div>== What's the goal? ==<br />
<br />
The goal of this page is to teach you how to take an application that you've coded (or the sample app) and properly get it included in your rootfs. This article is a bit of an aggregate page, it's going to take information from [[MokoMakefile]] [http://wiki.openmoko.org/wiki/User:CesarB/Using_a_local_overlay Using_a_local_overlay] [[Building_a_hello_world_application]] and [[Create_a_package_from_existing_sources]]. So as you can see the goal is for it to be a very thorough introduction, and will take you from "Idea to Inclusion" of your application.<br />
<br />
<br />
== Setting Up the OpenMoko Environment ==<br />
<br />
This part of the tutorial is going to be pretty basic. I absolutely love [[MokoMakefile]], it's fantastic, the creator has done and continues to do a fantastic job with this. I see absolutely no reason not to use it. However I cannot for the life of me understand why they create their working directory in /home/moko, the home directory is for home directories for users of your system, not for a development directory. I put my OpenMoko development directory in /home/bryce/mokodev/ and that works great for me, and also makes more sense so that multiple users on my machine could develop with no attempt to overlap.<br />
<br />
To get your environment setup please get it setup according to [[MokoMakefile]] however if you do have the build environment setup manually and you're sure you know what you're doing then feel free to go forward with this.<br />
<br />
== Setting Up a Local Overlay ==<br />
If you're at the point for setting up a local overlay this means a couple things. First: You've had a brilliant idea for an application that you just need to have on the OpenMoko platform. Second: You realize that this killer app of yours needs to be done properly and you're not going to do anything silly like include it in the actual tree for the OpenMoko distro because it would probably end up just getting overwritten eventually, or you just realize taht it's bad practice!<br />
<br />
Thank you to [[http://wiki.openmoko.org/wiki/User:CesarB Cesarb]] for this part of the wiki.<br />
<br />
To create a local overlay:<br />
<br />
* Create a "local" directory and its subdirectories<br />
<br />
mkdir local local/conf local/classes local/packages<br />
<br />
* Copy <code>site.conf</code> from the openmoko tree to <code>local/conf</code><br />
<br />
cp oe/conf/site.conf local/conf/site.conf<br />
<br />
* Edit the site.conf you copied to add the new tree as a source for bitbake recipes.<br />
<br />
Change the current <code>BBFILES</code> to look like this:<br />
BBFILES := "${OMDIR}/openembedded/packages/*/*.bb ${OMDIR}/oe/packages/*/*.bb ${OMDIR}/local/packages/*/*.bb"<br />
Change your <code>BBFILE_COLLECTIONS</code> line to look like this:<br />
BBFILE_COLLECTIONS = "upstream local overlay"<br />
Add this line:<br />
BBFILE_PATTERN_overlay = "^${OMDIR}/local/"<br />
Add this line:<br />
BBFILE_PRIORITY_overlay = "20"<br />
<br />
The <code>BBFILE_PRIORITY</code> should be greater than all the other <code>BBFILE_PRIORITY</code> variables on the same file.<br />
<br />
* Change your <code>BBPATH</code> environment variable to add the new tree ''before'' the two others for [[MokoMakefile]], the variable is on the <code>setup-env</code> file.<br />
<br />
export BBPATH="${OMDIR}/build:${OMDIR}/local:${OMDIR}/oe:${OMDIR}/openembedded"<br />
<br />
== Using Your New Local Overlay ==<br />
<br />
=== Changing files in conf/ ===<br />
<br />
To change a file in conf/, just copy the file to the overlay tree (preserving the directory structure) and edit it.<br />
<br />
=== Changing files in classes/ ===<br />
<br />
To change a file in classes/, just copy the file to the overlay tree and edit it.<br />
<br />
=== Changing packages ===<br />
<br />
Changing a package's recipe is a bit more complex. You have to copy over (or symlink) not only the .bb file for the package, but also ''all'' the files it includes with <code>require</code>, and the <code>FILESDIR</code> directories (all directories referred to by <code>FILESDIR</code>, usually named either ''package''-''version'' or <code>files</code>). If you forget one of them, the build will give an error (either when parsing the recipe in the case of <code>require</code>, or when trying to build in the case of the <code>FILESDIR</code> directories).<br />
<br />
=== Adding a new package ===<br />
<br />
You can add a new package (or a recipe for a new version of a package) to the overlay tree simply by creating it on the overlay tree.</div>Bryce.Leohttp://wiki.openmoko.org/wiki/Customizing_the_Openmoko_DistributionCustomizing the Openmoko Distribution2007-07-29T14:29:54Z<p>Bryce.Leo: Application Devleopment Crash Course moved to Application Development Crash Course: I'm an absolute dolt and cannot spell.</p>
<hr />
<div>== What's the goal? ==<br />
<br />
The goal of this page is to teach you how to take an application that you've coded (or the sample app) and properly get it included in your rootfs. This article is a bit of an aggregate page, it's going to take information from [[MokoMakefile]] [http://wiki.openmoko.org/wiki/User:CesarB/Using_a_local_overlay Using_a_local_overlay] [[Building_a_hello_world_application]] and [[Create_a_package_from_existing_sources]]. So as you can see the goal is for it to be a very thorough introduction, and will take you from "Idea to Inclusion" of your application.<br />
<br />
<br />
== Setting Up the OpenMoko Environment ==<br />
<br />
This part of the tutorial is going to be pretty basic. I absolutely love [[MokoMakefile]], it's fantastic, the creator has done and continues to do a fantastic job with this. I see absolutely no reason not to use it. However I cannot for the life of me understand why they create their working directory in /home/moko, the home directory is for home directories for users of your system, not for a development directory. I put my OpenMoko development directory in /home/bryce/mokodev/ and that works great for me, and also makes more sense so that multiple users on my machine could develop with no attempt to overlap.<br />
<br />
To get your environment setup please get it setup according to [[MokoMakefile]] however if you do have the build environment setup manually and you're sure you know what you're doing then feel free to go forward with this.<br />
<br />
== Setting Up a Local Overlay ==<br />
If you're at the point for setting up a local overlay this means a couple things. First: You've had a brilliant idea for an application that you just need to have on the OpenMoko platform. Second: You realize that this killer app of yours needs to be done properly and you're not going to do anything silly like include it in the actual tree for the OpenMoko distro because it would probably end up just getting overwritten eventually, or you just realize taht it's bad practice!<br />
<br />
<br />
To create a local overlay:<br />
<br />
* Create a "local" directory and its subdirectories<br />
<br />
mkdir local local/conf local/classes local/packages<br />
<br />
* Copy <code>site.conf</code> from the openmoko tree to <code>local/conf</code><br />
<br />
cp oe/conf/site.conf local/conf/site.conf<br />
<br />
* Edit the site.conf you copied to add the new tree as a source for bitbake recipes.<br />
<br />
Change the current <code>BBFILES</code> to look like this:<br />
BBFILES := "${OMDIR}/openembedded/packages/*/*.bb ${OMDIR}/oe/packages/*/*.bb ${OMDIR}/local/packages/*/*.bb"<br />
Change your <code>BBFILE_COLLECTIONS</code> line to look like this:<br />
BBFILE_COLLECTIONS = "upstream local overlay"<br />
Add this line:<br />
BBFILE_PATTERN_overlay = "^${OMDIR}/local/"<br />
Add this line:<br />
BBFILE_PRIORITY_overlay = "20"<br />
<br />
The <code>BBFILE_PRIORITY</code> should be greater than all the other <code>BBFILE_PRIORITY</code> variables on the same file.<br />
<br />
* Change your <code>BBPATH</code> environment variable to add the new tree ''before'' the two others for [[MokoMakefile]], the variable is on the <code>setup-env</code> file.<br />
<br />
export BBPATH="${OMDIR}/build:${OMDIR}/local:${OMDIR}/oe:${OMDIR}/openembedded"<br />
<br />
<br />
== Using Your New Local Overlay ==<br />
<br />
=== Changing files in conf/ ===<br />
<br />
To change a file in conf/, just copy the file to the overlay tree (preserving the directory structure) and edit it.<br />
<br />
=== Changing files in classes/ ===<br />
<br />
To change a file in classes/, just copy the file to the overlay tree and edit it.<br />
<br />
=== Changing packages ===<br />
<br />
Changing a package's recipe is a bit more complex. You have to copy over (or symlink) not only the .bb file for the package, but also ''all'' the files it includes with <code>require</code>, and the <code>FILESDIR</code> directories (all directories referred to by <code>FILESDIR</code>, usually named either ''package''-''version'' or <code>files</code>). If you forget one of them, the build will give an error (either when parsing the recipe in the case of <code>require</code>, or when trying to build in the case of the <code>FILESDIR</code> directories).<br />
<br />
=== Adding a new package ===<br />
<br />
You can add a new package (or a recipe for a new version of a package) to the overlay tree simply by creating it on the overlay tree.</div>Bryce.Leohttp://wiki.openmoko.org/wiki/Customizing_the_Openmoko_DistributionCustomizing the Openmoko Distribution2007-07-29T14:29:11Z<p>Bryce.Leo: /* Using Your New Local Overlay */</p>
<hr />
<div>== What's the goal? ==<br />
<br />
The goal of this page is to teach you how to take an application that you've coded (or the sample app) and properly get it included in your rootfs. This article is a bit of an aggregate page, it's going to take information from [[MokoMakefile]] [http://wiki.openmoko.org/wiki/User:CesarB/Using_a_local_overlay Using_a_local_overlay] [[Building_a_hello_world_application]] and [[Create_a_package_from_existing_sources]]. So as you can see the goal is for it to be a very thorough introduction, and will take you from "Idea to Inclusion" of your application.<br />
<br />
<br />
== Setting Up the OpenMoko Environment ==<br />
<br />
This part of the tutorial is going to be pretty basic. I absolutely love [[MokoMakefile]], it's fantastic, the creator has done and continues to do a fantastic job with this. I see absolutely no reason not to use it. However I cannot for the life of me understand why they create their working directory in /home/moko, the home directory is for home directories for users of your system, not for a development directory. I put my OpenMoko development directory in /home/bryce/mokodev/ and that works great for me, and also makes more sense so that multiple users on my machine could develop with no attempt to overlap.<br />
<br />
To get your environment setup please get it setup according to [[MokoMakefile]] however if you do have the build environment setup manually and you're sure you know what you're doing then feel free to go forward with this.<br />
<br />
== Setting Up a Local Overlay ==<br />
If you're at the point for setting up a local overlay this means a couple things. First: You've had a brilliant idea for an application that you just need to have on the OpenMoko platform. Second: You realize that this killer app of yours needs to be done properly and you're not going to do anything silly like include it in the actual tree for the OpenMoko distro because it would probably end up just getting overwritten eventually, or you just realize taht it's bad practice!<br />
<br />
<br />
To create a local overlay:<br />
<br />
* Create a "local" directory and its subdirectories<br />
<br />
mkdir local local/conf local/classes local/packages<br />
<br />
* Copy <code>site.conf</code> from the openmoko tree to <code>local/conf</code><br />
<br />
cp oe/conf/site.conf local/conf/site.conf<br />
<br />
* Edit the site.conf you copied to add the new tree as a source for bitbake recipes.<br />
<br />
Change the current <code>BBFILES</code> to look like this:<br />
BBFILES := "${OMDIR}/openembedded/packages/*/*.bb ${OMDIR}/oe/packages/*/*.bb ${OMDIR}/local/packages/*/*.bb"<br />
Change your <code>BBFILE_COLLECTIONS</code> line to look like this:<br />
BBFILE_COLLECTIONS = "upstream local overlay"<br />
Add this line:<br />
BBFILE_PATTERN_overlay = "^${OMDIR}/local/"<br />
Add this line:<br />
BBFILE_PRIORITY_overlay = "20"<br />
<br />
The <code>BBFILE_PRIORITY</code> should be greater than all the other <code>BBFILE_PRIORITY</code> variables on the same file.<br />
<br />
* Change your <code>BBPATH</code> environment variable to add the new tree ''before'' the two others for [[MokoMakefile]], the variable is on the <code>setup-env</code> file.<br />
<br />
export BBPATH="${OMDIR}/build:${OMDIR}/local:${OMDIR}/oe:${OMDIR}/openembedded"<br />
<br />
<br />
== Using Your New Local Overlay ==<br />
<br />
=== Changing files in conf/ ===<br />
<br />
To change a file in conf/, just copy the file to the overlay tree (preserving the directory structure) and edit it.<br />
<br />
=== Changing files in classes/ ===<br />
<br />
To change a file in classes/, just copy the file to the overlay tree and edit it.<br />
<br />
=== Changing packages ===<br />
<br />
Changing a package's recipe is a bit more complex. You have to copy over (or symlink) not only the .bb file for the package, but also ''all'' the files it includes with <code>require</code>, and the <code>FILESDIR</code> directories (all directories referred to by <code>FILESDIR</code>, usually named either ''package''-''version'' or <code>files</code>). If you forget one of them, the build will give an error (either when parsing the recipe in the case of <code>require</code>, or when trying to build in the case of the <code>FILESDIR</code> directories).<br />
<br />
=== Adding a new package ===<br />
<br />
You can add a new package (or a recipe for a new version of a package) to the overlay tree simply by creating it on the overlay tree.</div>Bryce.Leohttp://wiki.openmoko.org/wiki/Customizing_the_Openmoko_DistributionCustomizing the Openmoko Distribution2007-07-29T14:20:54Z<p>Bryce.Leo: /* Using your new Local Overlay */</p>
<hr />
<div>== What's the goal? ==<br />
<br />
The goal of this page is to teach you how to take an application that you've coded (or the sample app) and properly get it included in your rootfs. This article is a bit of an aggregate page, it's going to take information from [[MokoMakefile]] [http://wiki.openmoko.org/wiki/User:CesarB/Using_a_local_overlay Using_a_local_overlay] [[Building_a_hello_world_application]] and [[Create_a_package_from_existing_sources]]. So as you can see the goal is for it to be a very thorough introduction, and will take you from "Idea to Inclusion" of your application.<br />
<br />
<br />
== Setting Up the OpenMoko Environment ==<br />
<br />
This part of the tutorial is going to be pretty basic. I absolutely love [[MokoMakefile]], it's fantastic, the creator has done and continues to do a fantastic job with this. I see absolutely no reason not to use it. However I cannot for the life of me understand why they create their working directory in /home/moko, the home directory is for home directories for users of your system, not for a development directory. I put my OpenMoko development directory in /home/bryce/mokodev/ and that works great for me, and also makes more sense so that multiple users on my machine could develop with no attempt to overlap.<br />
<br />
To get your environment setup please get it setup according to [[MokoMakefile]] however if you do have the build environment setup manually and you're sure you know what you're doing then feel free to go forward with this.<br />
<br />
== Setting Up a Local Overlay ==<br />
If you're at the point for setting up a local overlay this means a couple things. First: You've had a brilliant idea for an application that you just need to have on the OpenMoko platform. Second: You realize that this killer app of yours needs to be done properly and you're not going to do anything silly like include it in the actual tree for the OpenMoko distro because it would probably end up just getting overwritten eventually, or you just realize taht it's bad practice!<br />
<br />
<br />
To create a local overlay:<br />
<br />
* Create a "local" directory and its subdirectories<br />
<br />
mkdir local local/conf local/classes local/packages<br />
<br />
* Copy <code>site.conf</code> from the openmoko tree to <code>local/conf</code><br />
<br />
cp oe/conf/site.conf local/conf/site.conf<br />
<br />
* Edit the site.conf you copied to add the new tree as a source for bitbake recipes.<br />
<br />
Change the current <code>BBFILES</code> to look like this:<br />
BBFILES := "${OMDIR}/openembedded/packages/*/*.bb ${OMDIR}/oe/packages/*/*.bb ${OMDIR}/local/packages/*/*.bb"<br />
Change your <code>BBFILE_COLLECTIONS</code> line to look like this:<br />
BBFILE_COLLECTIONS = "upstream local overlay"<br />
Add this line:<br />
BBFILE_PATTERN_overlay = "^${OMDIR}/local/"<br />
Add this line:<br />
BBFILE_PRIORITY_overlay = "20"<br />
<br />
The <code>BBFILE_PRIORITY</code> should be greater than all the other <code>BBFILE_PRIORITY</code> variables on the same file.<br />
<br />
* Change your <code>BBPATH</code> environment variable to add the new tree ''before'' the two others for [[MokoMakefile]], the variable is on the <code>setup-env</code> file.<br />
<br />
export BBPATH="${OMDIR}/build:${OMDIR}/local:${OMDIR}/oe:${OMDIR}/openembedded"<br />
<br />
<br />
== Using Your New Local Overlay ==</div>Bryce.Leohttp://wiki.openmoko.org/wiki/Customizing_the_Openmoko_DistributionCustomizing the Openmoko Distribution2007-07-29T14:20:37Z<p>Bryce.Leo: /* Setting Up a Local Overlay */</p>
<hr />
<div>== What's the goal? ==<br />
<br />
The goal of this page is to teach you how to take an application that you've coded (or the sample app) and properly get it included in your rootfs. This article is a bit of an aggregate page, it's going to take information from [[MokoMakefile]] [http://wiki.openmoko.org/wiki/User:CesarB/Using_a_local_overlay Using_a_local_overlay] [[Building_a_hello_world_application]] and [[Create_a_package_from_existing_sources]]. So as you can see the goal is for it to be a very thorough introduction, and will take you from "Idea to Inclusion" of your application.<br />
<br />
<br />
== Setting Up the OpenMoko Environment ==<br />
<br />
This part of the tutorial is going to be pretty basic. I absolutely love [[MokoMakefile]], it's fantastic, the creator has done and continues to do a fantastic job with this. I see absolutely no reason not to use it. However I cannot for the life of me understand why they create their working directory in /home/moko, the home directory is for home directories for users of your system, not for a development directory. I put my OpenMoko development directory in /home/bryce/mokodev/ and that works great for me, and also makes more sense so that multiple users on my machine could develop with no attempt to overlap.<br />
<br />
To get your environment setup please get it setup according to [[MokoMakefile]] however if you do have the build environment setup manually and you're sure you know what you're doing then feel free to go forward with this.<br />
<br />
== Setting Up a Local Overlay ==<br />
If you're at the point for setting up a local overlay this means a couple things. First: You've had a brilliant idea for an application that you just need to have on the OpenMoko platform. Second: You realize that this killer app of yours needs to be done properly and you're not going to do anything silly like include it in the actual tree for the OpenMoko distro because it would probably end up just getting overwritten eventually, or you just realize taht it's bad practice!<br />
<br />
<br />
To create a local overlay:<br />
<br />
* Create a "local" directory and its subdirectories<br />
<br />
mkdir local local/conf local/classes local/packages<br />
<br />
* Copy <code>site.conf</code> from the openmoko tree to <code>local/conf</code><br />
<br />
cp oe/conf/site.conf local/conf/site.conf<br />
<br />
* Edit the site.conf you copied to add the new tree as a source for bitbake recipes.<br />
<br />
Change the current <code>BBFILES</code> to look like this:<br />
BBFILES := "${OMDIR}/openembedded/packages/*/*.bb ${OMDIR}/oe/packages/*/*.bb ${OMDIR}/local/packages/*/*.bb"<br />
Change your <code>BBFILE_COLLECTIONS</code> line to look like this:<br />
BBFILE_COLLECTIONS = "upstream local overlay"<br />
Add this line:<br />
BBFILE_PATTERN_overlay = "^${OMDIR}/local/"<br />
Add this line:<br />
BBFILE_PRIORITY_overlay = "20"<br />
<br />
The <code>BBFILE_PRIORITY</code> should be greater than all the other <code>BBFILE_PRIORITY</code> variables on the same file.<br />
<br />
* Change your <code>BBPATH</code> environment variable to add the new tree ''before'' the two others for [[MokoMakefile]], the variable is on the <code>setup-env</code> file.<br />
<br />
export BBPATH="${OMDIR}/build:${OMDIR}/local:${OMDIR}/oe:${OMDIR}/openembedded"<br />
<br />
<br />
== Using your new Local Overlay ==</div>Bryce.Leohttp://wiki.openmoko.org/wiki/Customizing_the_Openmoko_DistributionCustomizing the Openmoko Distribution2007-07-29T14:19:31Z<p>Bryce.Leo: /* Setting Up a Local Overlay */</p>
<hr />
<div>== What's the goal? ==<br />
<br />
The goal of this page is to teach you how to take an application that you've coded (or the sample app) and properly get it included in your rootfs. This article is a bit of an aggregate page, it's going to take information from [[MokoMakefile]] [http://wiki.openmoko.org/wiki/User:CesarB/Using_a_local_overlay Using_a_local_overlay] [[Building_a_hello_world_application]] and [[Create_a_package_from_existing_sources]]. So as you can see the goal is for it to be a very thorough introduction, and will take you from "Idea to Inclusion" of your application.<br />
<br />
<br />
== Setting Up the OpenMoko Environment ==<br />
<br />
This part of the tutorial is going to be pretty basic. I absolutely love [[MokoMakefile]], it's fantastic, the creator has done and continues to do a fantastic job with this. I see absolutely no reason not to use it. However I cannot for the life of me understand why they create their working directory in /home/moko, the home directory is for home directories for users of your system, not for a development directory. I put my OpenMoko development directory in /home/bryce/mokodev/ and that works great for me, and also makes more sense so that multiple users on my machine could develop with no attempt to overlap.<br />
<br />
To get your environment setup please get it setup according to [[MokoMakefile]] however if you do have the build environment setup manually and you're sure you know what you're doing then feel free to go forward with this.<br />
<br />
== Setting Up a Local Overlay ==<br />
If you're at the point for setting up a local overlay this means a couple things. First: You've had a brilliant idea for an application that you just need to have on the OpenMoko platform. Second: You realize that this killer app of yours needs to be done properly and you're not going to do anything silly like include it in the actual tree for the OpenMoko distro because it would probably end up just getting overwritten eventually, or you just realize taht it's bad practice!<br />
<br />
<br />
To create a local overlay:<br />
<br />
* Create a "local" directory and its subdirectories<br />
<br />
mkdir local local/conf local/classes local/packages<br />
<br />
* Copy <code>site.conf</code> from the openmoko tree to <code>local/conf</code><br />
<br />
cp oe/conf/site.conf local/conf/site.conf<br />
<br />
* Edit the site.conf you copied to add the new tree as a source for bitbake recipes.<br />
<br />
Change the current <code>BBFILES</code> to look like this:<br />
BBFILES := "${OMDIR}/openembedded/packages/*/*.bb ${OMDIR}/oe/packages/*/*.bb ${OMDIR}/local/packages/*/*.bb"<br />
Change your <code>BBFILE_COLLECTIONS</code> line to look like this:<br />
BBFILE_COLLECTIONS = "upstream local overlay"<br />
Add this line:<br />
BBFILE_PATTERN_overlay = "^${OMDIR}/local/"<br />
Add this line:<br />
BBFILE_PRIORITY_overlay = "20"<br />
<br />
The <code>BBFILE_PRIORITY</code> should be greater than all the other <code>BBFILE_PRIORITY</code> variables on the same file.<br />
<br />
* Change your <code>BBPATH</code> environment variable to add the new tree ''before'' the two others for [[MokoMakefile]], the variable is on the <code>setup-env</code> file.<br />
<br />
export BBPATH="${OMDIR}/build:${OMDIR}/local:${OMDIR}/oe:${OMDIR}/openembedded"</div>Bryce.Leohttp://wiki.openmoko.org/wiki/Customizing_the_Openmoko_DistributionCustomizing the Openmoko Distribution2007-07-29T12:58:05Z<p>Bryce.Leo: /* Setting Up the OpenMoko Environment */</p>
<hr />
<div>== What's the goal? ==<br />
<br />
The goal of this page is to teach you how to take an application that you've coded (or the sample app) and properly get it included in your rootfs. This article is a bit of an aggregate page, it's going to take information from [[MokoMakefile]] [http://wiki.openmoko.org/wiki/User:CesarB/Using_a_local_overlay Using_a_local_overlay] [[Building_a_hello_world_application]] and [[Create_a_package_from_existing_sources]]. So as you can see the goal is for it to be a very thorough introduction, and will take you from "Idea to Inclusion" of your application.<br />
<br />
<br />
== Setting Up the OpenMoko Environment ==<br />
<br />
This part of the tutorial is going to be pretty basic. I absolutely love [[MokoMakefile]], it's fantastic, the creator has done and continues to do a fantastic job with this. I see absolutely no reason not to use it. However I cannot for the life of me understand why they create their working directory in /home/moko, the home directory is for home directories for users of your system, not for a development directory. I put my OpenMoko development directory in /home/bryce/mokodev/ and that works great for me, and also makes more sense so that multiple users on my machine could develop with no attempt to overlap.<br />
<br />
To get your environment setup please get it setup according to [[MokoMakefile]] however if you do have the build environment setup manually and you're sure you know what you're doing then feel free to go forward with this.<br />
<br />
== Setting Up a Local Overlay ==</div>Bryce.Leohttp://wiki.openmoko.org/wiki/Customizing_the_Openmoko_DistributionCustomizing the Openmoko Distribution2007-07-29T12:57:44Z<p>Bryce.Leo: /* Setting Up the OpenMoko Environment */</p>
<hr />
<div>== What's the goal? ==<br />
<br />
The goal of this page is to teach you how to take an application that you've coded (or the sample app) and properly get it included in your rootfs. This article is a bit of an aggregate page, it's going to take information from [[MokoMakefile]] [http://wiki.openmoko.org/wiki/User:CesarB/Using_a_local_overlay Using_a_local_overlay] [[Building_a_hello_world_application]] and [[Create_a_package_from_existing_sources]]. So as you can see the goal is for it to be a very thorough introduction, and will take you from "Idea to Inclusion" of your application.<br />
<br />
<br />
== Setting Up the OpenMoko Environment ==<br />
<br />
This part of the tutorial is going to be pretty basic. I absolutely love [[MokoMakefile]], it's fantastic, the creator has done and continues to do a fantastic job with this. I see absolutely no reason not to use it. However I cannot for the life of me understand why they create their working directory in /home/moko, the home directory is for home directories for users of your system, not for a development directory. I put my OpenMoko development directory in /home/bryce/mokodev/ and that works great for me, and also makes more sense so that multiple users on my machine could develop with no attempt to overlap.<br />
<br />
To get your environment setup please get it setup according to [[MokoMakefile]] however if you do have the build environment setup manually and you're sure you know what you're doing then feel free to go forward with this.</div>Bryce.Leohttp://wiki.openmoko.org/wiki/Customizing_the_Openmoko_DistributionCustomizing the Openmoko Distribution2007-07-29T12:50:21Z<p>Bryce.Leo: </p>
<hr />
<div>== What's the goal? ==<br />
<br />
The goal of this page is to teach you how to take an application that you've coded (or the sample app) and properly get it included in your rootfs. This article is a bit of an aggregate page, it's going to take information from [[MokoMakefile]] [http://wiki.openmoko.org/wiki/User:CesarB/Using_a_local_overlay Using_a_local_overlay] [[Building_a_hello_world_application]] and [[Create_a_package_from_existing_sources]]. So as you can see the goal is for it to be a very thorough introduction, and will take you from "Idea to Inclusion" of your application.<br />
<br />
<br />
== Setting Up the OpenMoko Environment ==</div>Bryce.Leohttp://wiki.openmoko.org/wiki/Create_an_ipk_package_from_sourcesCreate an ipk package from sources2007-07-28T22:00:04Z<p>Bryce.Leo: /* Get this package included in the rootfs image */</p>
<hr />
<div>This is a small tutorial to help people that want to write new software for Openmoko, eg. to port existing programs.<br />
<br />
==Theory==<br />
OpenMoko uses OpenEmbedded, a package and root image build system.<br />
<br />
OpenEmbedded provides patches and Bitbake Recipes, that are similar to .spec files to build RPM packages. Bitbake is used to process recipes and obtain packages and FS images. For example, bitbake can fetch sources, apply patches, configure, make and install compiled sources. Other steps are user definable, but this is not the scope of this tutorial.<br />
<br />
A standard use of bitbake is to download an existing "vanilla" package, ie "gcc" or "binutils" or "linux kernel", apply platform patches (adding bugfixes, porting fixes, drivers, etc...) then compile and package the resulting binaries.<br />
<br />
==Software versionning==<br />
Versions management is a very wide topic, there are tons of different opinions about it, I'll try to be quick.<br />
<br />
Packages versions are important in a distribution building mechanism, and package versions are a complete part of the full package name. They are obviously used to track important changes made to your package, and isolate each version. Here we must be a little aware of basic version management.<br />
Current (most advanced) version is named the "trunk". Additions, fixes, etc. are done to the trunk.<br />
<br />
Once a certain level of functionality is achieved, a copy of the trunk (a "snapshot") is taken, and named with a version number. As a result, current development continues on the trunk, but users can download well defined "releases", with known bugs and functionnality level. This is called "branching". If version specific bugs are found in version a.b, then we can update this branch independently.<br />
<br />
In bitbake, we must specify which release of our software we are going to package. This may not be an habit, especially if you only develop small programs, not maintained by more than one or two person. If your software is named "myprogram" but has no real version number attached, you can just rename your project directory to "myprogram-1.0".<br />
<br />
This is a good practice; If you are packaging a software, then it will be used by other people, so when you modify it next time, put it in a folder named "myprogram-1.1" :) This brings clarity to users, ease of management to you, and ability to plan future releases to your team.<br />
<br />
==Example==<br />
Say you have a working software package, ie a file system directory with sources, Makefile, etc...<br />
Because this is a common method, I will base my presentation on a project generated using autotools. This implies that the software can be installed somewhere by following the magical steps ./configure && make && make install.<br />
<br />
===Prerequisites===<br />
You need a configured openmoko development tree. All details are in [[Building OpenMoko from scratch]]<br />
<br />
You may also do this with [[MokoMakeFile]], see instructions at the bottom.<br />
<br />
The following commands will give you one, they are copied from the above page. Just copy and paste in a shell.<br />
<br />
<pre><br />
#prepare<br />
cd $HOME<br />
mkdir OM<br />
cd OM<br />
<br />
#get openembedded<br />
wget http://www.openembedded.org/snapshots/OE.mtn.bz2<br />
bunzip2 OE.mtn.bz2<br />
mtn --db=OE.mtn pull monotone.openembedded.org org.openembedded.dev<br />
mtn --db=OE.mtn checkout --branch=org.openembedded.dev -r e2dbb52fe39df7ef786b6068f6178f29508dfded openembedded<br />
<br />
#get openmoko<br />
svn co http://svn.openmoko.org/ openmoko<br />
<br />
#create local config<br />
mkdir -p sources build/conf<br />
cat <<EOF >build/conf/local.conf<br />
MACHINE = "fic-gta01"<br />
DISTRO = "openmoko"<br />
BUILD_ARCH = "`uname -m`"<br />
EOF<br />
<br />
#fixes (didnt try without them)<br />
ln -s openmoko/trunk/oe ./oe<br />
cd sources<br />
mkdir -p ../build/tmp/stamps/armv4t-linux<br />
wget http://ftp.mozilla.org/pub/mozilla.org/js/older-packages/js-1.5.tar.gz<br />
touch ../build/tmp/stamps/armv4t-linux/js-1.5-r0.do_fetch<br />
wget http://us4.samba.org/samba/ftp/stable/samba-3.0.14a.tar.gz<br />
touch ../build/tmp/stamps/armv4t-linux/samba-3.0.14a-r15.do_fetch<br />
perl -pi.orig -e 's/ *$//;s/\r//g' ../openembedded/packages/gcc/gcc-4.1.1/gcc-4.1.1-pr13685-1.patch<br />
</pre><br />
<br />
Then, you need the environment variables described here: [[Building_OpenMoko_from_scratch#Environment_variables]]<br />
Put the given lines in a script, then go to your build/ dir and source it:<br />
<pre><br />
cat <<EOF >doenv.sh<br />
#!/bin/sh<br />
export OMDIR=`pwd`<br />
export BBPATH=$OMDIR/build:$OMDIR/openmoko/trunk/oe:$OMDIR/openembedded<br />
EOF<br />
. ./doenv.sh<br />
</pre><br />
<br />
After this, your tree will look like that:<br />
<pre><br />
$HOME/OM<br />
+- build<br />
| +- conf<br />
| | +- local.conf<br />
+- openmoko<br />
+- openembedded<br />
+- sources<br />
+- env.sh<br />
</pre><br />
etc...<br />
<br />
<br />
Follow the link to [[MokoMakefile]] and follow the instructions.<br />
You're now all set to start building. Remember to run the setup-env command for each time you open a terminal. This sets your environment variables, however it is easier to include them in the rc file of your shell.<br />
<br />
===Proposed directory layout for our new packages===<br />
Bitbake recipes are single files describing how to build a package. I recommend to have a recipe for each package version (myprogram-1.0.bb, myprogram-1.1.bb, etc.) all stored in a directory named "myprogram"<br />
<br />
Our personal tree can be everywhere else:<br />
<pre><br />
$HOME<br />
+- $OMDIR (contains the official openmoko tree)<br />
| +- ...<br />
+- My_personal_OpenMoko_Packages<br />
| +- packages<br />
| +- myhello<br />
| +- myhello-1.0.bb<br />
+- My_Personal_Projects_Folder<br />
+- myhello<br />
+- myhello-1.0<br />
+- configure.ac<br />
+- Makefile.am<br />
+- ...<br />
</pre><br />
<br />
To do a simple test, pack your sources in a tar, and put this tar on a web server:<br />
<pre><br />
cd My_personal_Projects_Folder/myhello<br />
tar cvfz myhello-1.0.tar.gz myhello-1.0/<br />
</pre><br />
This is correct, ie the tarball will have a NAME-VERSION subdirectory, that's what we need.<br />
<br />
===The recipe===<br />
In the bitbake file, you need to give<br />
* a description for your package, variable name is DESCRIPTION<br />
* a package name (PN)<br />
* a package version (PV)<br />
* a source URI, I'll give details later<br />
* a source version, to checkout a particular revision of versionned trees<br />
* Please see the [http://www.openembedded.org/wiki/StyleGuide Open Embedded StyleGuide] which should answer most if not all questions about .bb file conventions.<br />
<br />
here's an example:<br />
<br />
<pre>#package description<br />
DESCRIPTION = "An example application for openmoko, depending on a custom source repository"<br />
SECTION = "squalyl/myhello"<br />
<br />
#this is optional<br />
LICENSE = "GPLv2"<br />
<br />
PN = "myhello"<br />
PV = "1.0"<br />
<br />
#use "now" to force svn updates at each build<br />
#Using now is a very dangerous way to do it. ONLY use this in your<br />
#personal recipes when you're doing heavy testing, otherwise<br />
#choose a stable date and stick with it that way when you distribute your recipe<br />
#you don't have all sorts of versions getting built out in the wild.<br />
SRCDATE_${PN} = "now"<br />
SRC_URI = "svn://repo/path/myhello;proto=https;module=${PN}-${PV}"<br />
<br />
#for a tarball use:<br />
#SRC_URI = "http://server/path/package/${PN}-${PV}.tar.gz"<br />
<br />
#include standard rules to build a autoconf/automake package<br />
inherit autotools<br />
</pre><br />
<br />
Expressions starting by ${} are substituted, this allows you to download a tarball named "mypackage-1.0.tar.gz" for example<br />
<br />
=== Source URIs ===<br />
bitbake can get the source code for your project from a variety of locations including tarball, subversion and git.<br />
<br />
All of this is explained in the [http://bitbake.berlios.de/manual/ bitbake manual], particulary [http://bitbake.berlios.de/manual/ch03.html#id869590 here].<br />
<br />
The package build directory, the one where bitbake will run "configure" et al, will follow the name template: "PACKAGE_NAME-PACKAGE_VERSION", so<br />
<br />
* tarballs must extract to a subdirectory with this name<br />
* svn top directory must have this name<br />
<br />
It's very important. I spent 3 days blocking on this!<br />
<br />
===Tell bitbake to build our package===<br />
The only and one thing to do is edit $OMDIR/build/local.conf to tell bitbake to search our folders for .bb files:<br />
<pre><br />
BBFILES+="${HOME}/MypersonalOpenMokoPackages/packages/*/*.bb"<br />
</pre><br />
There is no need to change BBPATH or something else, this is only needed to add new configuration files, not recipes.<br />
<br />
Running<br />
<pre><br />
$ cd $OMDIR/build<br />
$ bitbake mypackage<br />
</pre><br />
will bring all the necessary operations to create a package in $OMDIR/build/tmp/deploy/ipk/armv4t/myhello .....<br />
<br />
The following is an example build log:<br />
<pre><br />
OE Build Configuration:<br />
BB_VERSION = "1.6.9"<br />
OE_REVISION = "<unknown>"<br />
TARGET_ARCH = "arm"<br />
TARGET_OS = "linux"<br />
MACHINE = "fic-gta01"<br />
DISTRO = "openmoko"<br />
DISTRO_VERSION = ".dev-snapshot-20070723"<br />
TARGET_FPU = "soft"<br />
<br />
NOTE: This BitBake doesn't support revision fetching, falling back to current date<br />
NOTE: preferred version 2.4 of glibc not available<br />
NOTE: preferred version 2.4 of glibc-intermediate not available<br />
NOTE: preferred version 2.4 of glibc not available<br />
NOTE: package myhello-1.0: started<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_fetch: started<br />
NOTE: Fetch svn://svn.unsads.com/squalyl/om/src/myhello;proto=https;module=myhello-1.0<br />
A myhello-1.0/configure.ac<br />
A myhello-1.0/include<br />
A myhello-1.0/include/config.h.in<br />
A myhello-1.0/cleanall.sh<br />
A myhello-1.0/AUTHORS<br />
A myhello-1.0/bootstrap.sh<br />
A myhello-1.0/ChangeLog<br />
A myhello-1.0/src<br />
A myhello-1.0/src/hello.c<br />
A myhello-1.0/Makefile.am<br />
A myhello-1.0/NEWS<br />
A myhello-1.0/README<br />
Révision 2116 extraite.<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_fetch: completed<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_unpack: started<br />
NOTE: Unpacking /home/squalyl/OM/sources/myhello-1.0_svn.unsads.com_.squalyl.om.src.myhello__now.tar.gz to /home/squalyl/OM/build/tmp/work/armv4t-linux/myhello-1.0-r0_0_200707231759/<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_unpack: completed<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_patch: started<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_patch: completed<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_configure: started<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_configure: completed<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_compile: started<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_compile: completed<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_install: started<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_install: completed<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_package: started<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_package: completed<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_package_write: started<br />
Packaged contents of myhello-dbg into /home/squalyl/OM/build/tmp/deploy/ipk/armv4t/myhello-dbg_1.0-r0_0_200707231759_armv4t.ipk<br />
Packaged contents of myhello into /home/squalyl/OM/build/tmp/deploy/ipk/armv4t/myhello_1.0-r0_0_200707231759_armv4t.ipk<br />
NOTE: Not creating empty archive for myhello-doc-1.0-r0_0_200707231759<br />
NOTE: Not creating empty archive for myhello-dev-1.0-r0_0_200707231759<br />
NOTE: Not creating empty archive for myhello-locale-1.0-r0_0_200707231759<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_package_write: completed<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_populate_staging: started<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_populate_staging: completed<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_build: started<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_build: completed<br />
NOTE: package myhello-1.0: completed<br />
NOTE: build 200707231952: completed<br />
Build statistics:<br />
Attempted builds: 1<br />
</pre><br />
<br />
===Get this package included in the rootfs image===<br />
<br />
<blockquote><br />
{| border="1" cellspacing="0" cellpadding="5" align="center"<br />
|*This method is not a standard or normal way to include a package. The proper method follows the improper method.<br />
|}<br />
</blockquote><br />
bitbake openmoko-devel-image is used to build the entire distribution, but it does not include your new package in the rootfs image.<br />
<br />
To do this, use:<br />
<br />
<pre>bitbake openmoko-devel-image -crebuild</pre><br />
<br />
This will actually rebuild the rootfs, including your new packages.<br />
<br />
<blockquote><br />
{| border="1" cellspacing="0" cellpadding="5" align="center"<br />
|*The suggested method follows below.<br />
|}<br />
</blockquote><br />
<br />
To include the package in the image there are two steps.<br />
<br />
First: Modify your local.conf. $OMDIR/build/conf/local.conf<br />
<pre><br />
DISTRO_EXTRA_RDEPENDS += "<app name>"<br />
</pre><br />
This adds your application as a dependency for building the distro.<br />
<br />
Second: Update the task-base.<br />
<pre><br />
bitbake task-base -crebuild<br />
</pre><br />
When you update the task base it re-builds and ipk file which will: "Merge machine and distro options to create a basic machine task/package" <br />
<br />
You could also add your package by modifying the openmoko/trunk/oe/packages/tasks/task-openmoko.bb and adding your application name with the trailing backslash right before the update-alternatives line.<br />
<pre><br />
modutils-initscripts \<br />
module-init-tools-depmod \<br />
udev \<br />
rsync \<br />
screen \<br />
<My application Name> \ <br />
# update-alternatives \<br />
</pre><br />
<br />
Then to test this out (if you're using the [[MokoMakeFile]]) it's pretty simple.<br />
<pre><br />
make openmoko-devel-image<br />
make build-qemu<br />
make flash-qemu-local<br />
</pre><br />
And now you're running qemu with that fancy new image you just made!<br />
<br />
<br />
[[Category:Applications]]<br />
[[Category:Platform]]</div>Bryce.Leohttp://wiki.openmoko.org/wiki/Create_an_ipk_package_from_sourcesCreate an ipk package from sources2007-07-28T21:49:25Z<p>Bryce.Leo: /* Get this package included in the rootfs image */</p>
<hr />
<div>This is a small tutorial to help people that want to write new software for Openmoko, eg. to port existing programs.<br />
<br />
==Theory==<br />
OpenMoko uses OpenEmbedded, a package and root image build system.<br />
<br />
OpenEmbedded provides patches and Bitbake Recipes, that are similar to .spec files to build RPM packages. Bitbake is used to process recipes and obtain packages and FS images. For example, bitbake can fetch sources, apply patches, configure, make and install compiled sources. Other steps are user definable, but this is not the scope of this tutorial.<br />
<br />
A standard use of bitbake is to download an existing "vanilla" package, ie "gcc" or "binutils" or "linux kernel", apply platform patches (adding bugfixes, porting fixes, drivers, etc...) then compile and package the resulting binaries.<br />
<br />
==Software versionning==<br />
Versions management is a very wide topic, there are tons of different opinions about it, I'll try to be quick.<br />
<br />
Packages versions are important in a distribution building mechanism, and package versions are a complete part of the full package name. They are obviously used to track important changes made to your package, and isolate each version. Here we must be a little aware of basic version management.<br />
Current (most advanced) version is named the "trunk". Additions, fixes, etc. are done to the trunk.<br />
<br />
Once a certain level of functionality is achieved, a copy of the trunk (a "snapshot") is taken, and named with a version number. As a result, current development continues on the trunk, but users can download well defined "releases", with known bugs and functionnality level. This is called "branching". If version specific bugs are found in version a.b, then we can update this branch independently.<br />
<br />
In bitbake, we must specify which release of our software we are going to package. This may not be an habit, especially if you only develop small programs, not maintained by more than one or two person. If your software is named "myprogram" but has no real version number attached, you can just rename your project directory to "myprogram-1.0".<br />
<br />
This is a good practice; If you are packaging a software, then it will be used by other people, so when you modify it next time, put it in a folder named "myprogram-1.1" :) This brings clarity to users, ease of management to you, and ability to plan future releases to your team.<br />
<br />
==Example==<br />
Say you have a working software package, ie a file system directory with sources, Makefile, etc...<br />
Because this is a common method, I will base my presentation on a project generated using autotools. This implies that the software can be installed somewhere by following the magical steps ./configure && make && make install.<br />
<br />
===Prerequisites===<br />
You need a configured openmoko development tree. All details are in [[Building OpenMoko from scratch]]<br />
<br />
You may also do this with [[MokoMakeFile]], see instructions at the bottom.<br />
<br />
The following commands will give you one, they are copied from the above page. Just copy and paste in a shell.<br />
<br />
<pre><br />
#prepare<br />
cd $HOME<br />
mkdir OM<br />
cd OM<br />
<br />
#get openembedded<br />
wget http://www.openembedded.org/snapshots/OE.mtn.bz2<br />
bunzip2 OE.mtn.bz2<br />
mtn --db=OE.mtn pull monotone.openembedded.org org.openembedded.dev<br />
mtn --db=OE.mtn checkout --branch=org.openembedded.dev -r e2dbb52fe39df7ef786b6068f6178f29508dfded openembedded<br />
<br />
#get openmoko<br />
svn co http://svn.openmoko.org/ openmoko<br />
<br />
#create local config<br />
mkdir -p sources build/conf<br />
cat <<EOF >build/conf/local.conf<br />
MACHINE = "fic-gta01"<br />
DISTRO = "openmoko"<br />
BUILD_ARCH = "`uname -m`"<br />
EOF<br />
<br />
#fixes (didnt try without them)<br />
ln -s openmoko/trunk/oe ./oe<br />
cd sources<br />
mkdir -p ../build/tmp/stamps/armv4t-linux<br />
wget http://ftp.mozilla.org/pub/mozilla.org/js/older-packages/js-1.5.tar.gz<br />
touch ../build/tmp/stamps/armv4t-linux/js-1.5-r0.do_fetch<br />
wget http://us4.samba.org/samba/ftp/stable/samba-3.0.14a.tar.gz<br />
touch ../build/tmp/stamps/armv4t-linux/samba-3.0.14a-r15.do_fetch<br />
perl -pi.orig -e 's/ *$//;s/\r//g' ../openembedded/packages/gcc/gcc-4.1.1/gcc-4.1.1-pr13685-1.patch<br />
</pre><br />
<br />
Then, you need the environment variables described here: [[Building_OpenMoko_from_scratch#Environment_variables]]<br />
Put the given lines in a script, then go to your build/ dir and source it:<br />
<pre><br />
cat <<EOF >doenv.sh<br />
#!/bin/sh<br />
export OMDIR=`pwd`<br />
export BBPATH=$OMDIR/build:$OMDIR/openmoko/trunk/oe:$OMDIR/openembedded<br />
EOF<br />
. ./doenv.sh<br />
</pre><br />
<br />
After this, your tree will look like that:<br />
<pre><br />
$HOME/OM<br />
+- build<br />
| +- conf<br />
| | +- local.conf<br />
+- openmoko<br />
+- openembedded<br />
+- sources<br />
+- env.sh<br />
</pre><br />
etc...<br />
<br />
<br />
Follow the link to [[MokoMakefile]] and follow the instructions.<br />
You're now all set to start building. Remember to run the setup-env command for each time you open a terminal. This sets your environment variables, however it is easier to include them in the rc file of your shell.<br />
<br />
===Proposed directory layout for our new packages===<br />
Bitbake recipes are single files describing how to build a package. I recommend to have a recipe for each package version (myprogram-1.0.bb, myprogram-1.1.bb, etc.) all stored in a directory named "myprogram"<br />
<br />
Our personal tree can be everywhere else:<br />
<pre><br />
$HOME<br />
+- $OMDIR (contains the official openmoko tree)<br />
| +- ...<br />
+- My_personal_OpenMoko_Packages<br />
| +- packages<br />
| +- myhello<br />
| +- myhello-1.0.bb<br />
+- My_Personal_Projects_Folder<br />
+- myhello<br />
+- myhello-1.0<br />
+- configure.ac<br />
+- Makefile.am<br />
+- ...<br />
</pre><br />
<br />
To do a simple test, pack your sources in a tar, and put this tar on a web server:<br />
<pre><br />
cd My_personal_Projects_Folder/myhello<br />
tar cvfz myhello-1.0.tar.gz myhello-1.0/<br />
</pre><br />
This is correct, ie the tarball will have a NAME-VERSION subdirectory, that's what we need.<br />
<br />
===The recipe===<br />
In the bitbake file, you need to give<br />
* a description for your package, variable name is DESCRIPTION<br />
* a package name (PN)<br />
* a package version (PV)<br />
* a source URI, I'll give details later<br />
* a source version, to checkout a particular revision of versionned trees<br />
* Please see the [http://www.openembedded.org/wiki/StyleGuide Open Embedded StyleGuide] which should answer most if not all questions about .bb file conventions.<br />
<br />
here's an example:<br />
<br />
<pre>#package description<br />
DESCRIPTION = "An example application for openmoko, depending on a custom source repository"<br />
SECTION = "squalyl/myhello"<br />
<br />
#this is optional<br />
LICENSE = "GPLv2"<br />
<br />
PN = "myhello"<br />
PV = "1.0"<br />
<br />
#use "now" to force svn updates at each build<br />
#Using now is a very dangerous way to do it. ONLY use this in your<br />
#personal recipes when you're doing heavy testing, otherwise<br />
#choose a stable date and stick with it that way when you distribute your recipe<br />
#you don't have all sorts of versions getting built out in the wild.<br />
SRCDATE_${PN} = "now"<br />
SRC_URI = "svn://repo/path/myhello;proto=https;module=${PN}-${PV}"<br />
<br />
#for a tarball use:<br />
#SRC_URI = "http://server/path/package/${PN}-${PV}.tar.gz"<br />
<br />
#include standard rules to build a autoconf/automake package<br />
inherit autotools<br />
</pre><br />
<br />
Expressions starting by ${} are substituted, this allows you to download a tarball named "mypackage-1.0.tar.gz" for example<br />
<br />
=== Source URIs ===<br />
bitbake can get the source code for your project from a variety of locations including tarball, subversion and git.<br />
<br />
All of this is explained in the [http://bitbake.berlios.de/manual/ bitbake manual], particulary [http://bitbake.berlios.de/manual/ch03.html#id869590 here].<br />
<br />
The package build directory, the one where bitbake will run "configure" et al, will follow the name template: "PACKAGE_NAME-PACKAGE_VERSION", so<br />
<br />
* tarballs must extract to a subdirectory with this name<br />
* svn top directory must have this name<br />
<br />
It's very important. I spent 3 days blocking on this!<br />
<br />
===Tell bitbake to build our package===<br />
The only and one thing to do is edit $OMDIR/build/local.conf to tell bitbake to search our folders for .bb files:<br />
<pre><br />
BBFILES+="${HOME}/MypersonalOpenMokoPackages/packages/*/*.bb"<br />
</pre><br />
There is no need to change BBPATH or something else, this is only needed to add new configuration files, not recipes.<br />
<br />
Running<br />
<pre><br />
$ cd $OMDIR/build<br />
$ bitbake mypackage<br />
</pre><br />
will bring all the necessary operations to create a package in $OMDIR/build/tmp/deploy/ipk/armv4t/myhello .....<br />
<br />
The following is an example build log:<br />
<pre><br />
OE Build Configuration:<br />
BB_VERSION = "1.6.9"<br />
OE_REVISION = "<unknown>"<br />
TARGET_ARCH = "arm"<br />
TARGET_OS = "linux"<br />
MACHINE = "fic-gta01"<br />
DISTRO = "openmoko"<br />
DISTRO_VERSION = ".dev-snapshot-20070723"<br />
TARGET_FPU = "soft"<br />
<br />
NOTE: This BitBake doesn't support revision fetching, falling back to current date<br />
NOTE: preferred version 2.4 of glibc not available<br />
NOTE: preferred version 2.4 of glibc-intermediate not available<br />
NOTE: preferred version 2.4 of glibc not available<br />
NOTE: package myhello-1.0: started<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_fetch: started<br />
NOTE: Fetch svn://svn.unsads.com/squalyl/om/src/myhello;proto=https;module=myhello-1.0<br />
A myhello-1.0/configure.ac<br />
A myhello-1.0/include<br />
A myhello-1.0/include/config.h.in<br />
A myhello-1.0/cleanall.sh<br />
A myhello-1.0/AUTHORS<br />
A myhello-1.0/bootstrap.sh<br />
A myhello-1.0/ChangeLog<br />
A myhello-1.0/src<br />
A myhello-1.0/src/hello.c<br />
A myhello-1.0/Makefile.am<br />
A myhello-1.0/NEWS<br />
A myhello-1.0/README<br />
Révision 2116 extraite.<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_fetch: completed<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_unpack: started<br />
NOTE: Unpacking /home/squalyl/OM/sources/myhello-1.0_svn.unsads.com_.squalyl.om.src.myhello__now.tar.gz to /home/squalyl/OM/build/tmp/work/armv4t-linux/myhello-1.0-r0_0_200707231759/<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_unpack: completed<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_patch: started<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_patch: completed<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_configure: started<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_configure: completed<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_compile: started<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_compile: completed<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_install: started<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_install: completed<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_package: started<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_package: completed<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_package_write: started<br />
Packaged contents of myhello-dbg into /home/squalyl/OM/build/tmp/deploy/ipk/armv4t/myhello-dbg_1.0-r0_0_200707231759_armv4t.ipk<br />
Packaged contents of myhello into /home/squalyl/OM/build/tmp/deploy/ipk/armv4t/myhello_1.0-r0_0_200707231759_armv4t.ipk<br />
NOTE: Not creating empty archive for myhello-doc-1.0-r0_0_200707231759<br />
NOTE: Not creating empty archive for myhello-dev-1.0-r0_0_200707231759<br />
NOTE: Not creating empty archive for myhello-locale-1.0-r0_0_200707231759<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_package_write: completed<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_populate_staging: started<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_populate_staging: completed<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_build: started<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_build: completed<br />
NOTE: package myhello-1.0: completed<br />
NOTE: build 200707231952: completed<br />
Build statistics:<br />
Attempted builds: 1<br />
</pre><br />
<br />
===Get this package included in the rootfs image===<br />
<br />
<blockquote><br />
*This method is not a standard or normal way to include a package. The proper method follows the improper method.<br />
</blockquote><br />
bitbake openmoko-devel-image is used to build the entire distribution, but it does not include your new package in the rootfs image.<br />
<br />
To do this, use:<br />
<br />
<pre>bitbake openmoko-devel-image -crebuild</pre><br />
<br />
This will actually rebuild the rootfs, including your new packages.<br />
<br />
<blockquote><br />
*The suggested method follows below.<br />
</blockquote><br />
<br />
To include the package in the image there are two steps.<br />
<br />
First: Modify your local.conf. $OMDIR/build/conf/local.conf<br />
<pre><br />
DISTRO_EXTRA_RDEPENDS += "<app name>"<br />
</pre><br />
This adds your application as a dependency for building the distro.<br />
<br />
Second: Update the task-base.<br />
<pre><br />
bitbake task-base -crebuild<br />
</pre><br />
When you update the task base it re-builds and ipk file which will: "Merge machine and distro options to create a basic machine task/package" <br />
<br />
You could also add your package by modifying the openmoko/trunk/oe/packages/tasks/task-openmoko.bb and adding your application name with the trailing backslash right before the update-alternatives line.<br />
<pre><br />
modutils-initscripts \<br />
module-init-tools-depmod \<br />
udev \<br />
rsync \<br />
screen \<br />
<My application Name> \ <br />
# update-alternatives \<br />
</pre><br />
<br />
Then to test this out (if you're using the [[MokoMakeFile]]) it's pretty simple.<br />
<pre><br />
make openmoko-devel-image<br />
make build-qemu<br />
make flash-qemu-local<br />
</pre><br />
And now you're running qemu with that fancy new image you just made!<br />
<br />
<br />
[[Category:Applications]]<br />
[[Category:Platform]]</div>Bryce.Leohttp://wiki.openmoko.org/wiki/Create_an_ipk_package_from_sourcesCreate an ipk package from sources2007-07-28T21:48:27Z<p>Bryce.Leo: /* Get this package included in the rootfs image */</p>
<hr />
<div>This is a small tutorial to help people that want to write new software for Openmoko, eg. to port existing programs.<br />
<br />
==Theory==<br />
OpenMoko uses OpenEmbedded, a package and root image build system.<br />
<br />
OpenEmbedded provides patches and Bitbake Recipes, that are similar to .spec files to build RPM packages. Bitbake is used to process recipes and obtain packages and FS images. For example, bitbake can fetch sources, apply patches, configure, make and install compiled sources. Other steps are user definable, but this is not the scope of this tutorial.<br />
<br />
A standard use of bitbake is to download an existing "vanilla" package, ie "gcc" or "binutils" or "linux kernel", apply platform patches (adding bugfixes, porting fixes, drivers, etc...) then compile and package the resulting binaries.<br />
<br />
==Software versionning==<br />
Versions management is a very wide topic, there are tons of different opinions about it, I'll try to be quick.<br />
<br />
Packages versions are important in a distribution building mechanism, and package versions are a complete part of the full package name. They are obviously used to track important changes made to your package, and isolate each version. Here we must be a little aware of basic version management.<br />
Current (most advanced) version is named the "trunk". Additions, fixes, etc. are done to the trunk.<br />
<br />
Once a certain level of functionality is achieved, a copy of the trunk (a "snapshot") is taken, and named with a version number. As a result, current development continues on the trunk, but users can download well defined "releases", with known bugs and functionnality level. This is called "branching". If version specific bugs are found in version a.b, then we can update this branch independently.<br />
<br />
In bitbake, we must specify which release of our software we are going to package. This may not be an habit, especially if you only develop small programs, not maintained by more than one or two person. If your software is named "myprogram" but has no real version number attached, you can just rename your project directory to "myprogram-1.0".<br />
<br />
This is a good practice; If you are packaging a software, then it will be used by other people, so when you modify it next time, put it in a folder named "myprogram-1.1" :) This brings clarity to users, ease of management to you, and ability to plan future releases to your team.<br />
<br />
==Example==<br />
Say you have a working software package, ie a file system directory with sources, Makefile, etc...<br />
Because this is a common method, I will base my presentation on a project generated using autotools. This implies that the software can be installed somewhere by following the magical steps ./configure && make && make install.<br />
<br />
===Prerequisites===<br />
You need a configured openmoko development tree. All details are in [[Building OpenMoko from scratch]]<br />
<br />
You may also do this with [[MokoMakeFile]], see instructions at the bottom.<br />
<br />
The following commands will give you one, they are copied from the above page. Just copy and paste in a shell.<br />
<br />
<pre><br />
#prepare<br />
cd $HOME<br />
mkdir OM<br />
cd OM<br />
<br />
#get openembedded<br />
wget http://www.openembedded.org/snapshots/OE.mtn.bz2<br />
bunzip2 OE.mtn.bz2<br />
mtn --db=OE.mtn pull monotone.openembedded.org org.openembedded.dev<br />
mtn --db=OE.mtn checkout --branch=org.openembedded.dev -r e2dbb52fe39df7ef786b6068f6178f29508dfded openembedded<br />
<br />
#get openmoko<br />
svn co http://svn.openmoko.org/ openmoko<br />
<br />
#create local config<br />
mkdir -p sources build/conf<br />
cat <<EOF >build/conf/local.conf<br />
MACHINE = "fic-gta01"<br />
DISTRO = "openmoko"<br />
BUILD_ARCH = "`uname -m`"<br />
EOF<br />
<br />
#fixes (didnt try without them)<br />
ln -s openmoko/trunk/oe ./oe<br />
cd sources<br />
mkdir -p ../build/tmp/stamps/armv4t-linux<br />
wget http://ftp.mozilla.org/pub/mozilla.org/js/older-packages/js-1.5.tar.gz<br />
touch ../build/tmp/stamps/armv4t-linux/js-1.5-r0.do_fetch<br />
wget http://us4.samba.org/samba/ftp/stable/samba-3.0.14a.tar.gz<br />
touch ../build/tmp/stamps/armv4t-linux/samba-3.0.14a-r15.do_fetch<br />
perl -pi.orig -e 's/ *$//;s/\r//g' ../openembedded/packages/gcc/gcc-4.1.1/gcc-4.1.1-pr13685-1.patch<br />
</pre><br />
<br />
Then, you need the environment variables described here: [[Building_OpenMoko_from_scratch#Environment_variables]]<br />
Put the given lines in a script, then go to your build/ dir and source it:<br />
<pre><br />
cat <<EOF >doenv.sh<br />
#!/bin/sh<br />
export OMDIR=`pwd`<br />
export BBPATH=$OMDIR/build:$OMDIR/openmoko/trunk/oe:$OMDIR/openembedded<br />
EOF<br />
. ./doenv.sh<br />
</pre><br />
<br />
After this, your tree will look like that:<br />
<pre><br />
$HOME/OM<br />
+- build<br />
| +- conf<br />
| | +- local.conf<br />
+- openmoko<br />
+- openembedded<br />
+- sources<br />
+- env.sh<br />
</pre><br />
etc...<br />
<br />
<br />
Follow the link to [[MokoMakefile]] and follow the instructions.<br />
You're now all set to start building. Remember to run the setup-env command for each time you open a terminal. This sets your environment variables, however it is easier to include them in the rc file of your shell.<br />
<br />
===Proposed directory layout for our new packages===<br />
Bitbake recipes are single files describing how to build a package. I recommend to have a recipe for each package version (myprogram-1.0.bb, myprogram-1.1.bb, etc.) all stored in a directory named "myprogram"<br />
<br />
Our personal tree can be everywhere else:<br />
<pre><br />
$HOME<br />
+- $OMDIR (contains the official openmoko tree)<br />
| +- ...<br />
+- My_personal_OpenMoko_Packages<br />
| +- packages<br />
| +- myhello<br />
| +- myhello-1.0.bb<br />
+- My_Personal_Projects_Folder<br />
+- myhello<br />
+- myhello-1.0<br />
+- configure.ac<br />
+- Makefile.am<br />
+- ...<br />
</pre><br />
<br />
To do a simple test, pack your sources in a tar, and put this tar on a web server:<br />
<pre><br />
cd My_personal_Projects_Folder/myhello<br />
tar cvfz myhello-1.0.tar.gz myhello-1.0/<br />
</pre><br />
This is correct, ie the tarball will have a NAME-VERSION subdirectory, that's what we need.<br />
<br />
===The recipe===<br />
In the bitbake file, you need to give<br />
* a description for your package, variable name is DESCRIPTION<br />
* a package name (PN)<br />
* a package version (PV)<br />
* a source URI, I'll give details later<br />
* a source version, to checkout a particular revision of versionned trees<br />
* Please see the [http://www.openembedded.org/wiki/StyleGuide Open Embedded StyleGuide] which should answer most if not all questions about .bb file conventions.<br />
<br />
here's an example:<br />
<br />
<pre>#package description<br />
DESCRIPTION = "An example application for openmoko, depending on a custom source repository"<br />
SECTION = "squalyl/myhello"<br />
<br />
#this is optional<br />
LICENSE = "GPLv2"<br />
<br />
PN = "myhello"<br />
PV = "1.0"<br />
<br />
#use "now" to force svn updates at each build<br />
#Using now is a very dangerous way to do it. ONLY use this in your<br />
#personal recipes when you're doing heavy testing, otherwise<br />
#choose a stable date and stick with it that way when you distribute your recipe<br />
#you don't have all sorts of versions getting built out in the wild.<br />
SRCDATE_${PN} = "now"<br />
SRC_URI = "svn://repo/path/myhello;proto=https;module=${PN}-${PV}"<br />
<br />
#for a tarball use:<br />
#SRC_URI = "http://server/path/package/${PN}-${PV}.tar.gz"<br />
<br />
#include standard rules to build a autoconf/automake package<br />
inherit autotools<br />
</pre><br />
<br />
Expressions starting by ${} are substituted, this allows you to download a tarball named "mypackage-1.0.tar.gz" for example<br />
<br />
=== Source URIs ===<br />
bitbake can get the source code for your project from a variety of locations including tarball, subversion and git.<br />
<br />
All of this is explained in the [http://bitbake.berlios.de/manual/ bitbake manual], particulary [http://bitbake.berlios.de/manual/ch03.html#id869590 here].<br />
<br />
The package build directory, the one where bitbake will run "configure" et al, will follow the name template: "PACKAGE_NAME-PACKAGE_VERSION", so<br />
<br />
* tarballs must extract to a subdirectory with this name<br />
* svn top directory must have this name<br />
<br />
It's very important. I spent 3 days blocking on this!<br />
<br />
===Tell bitbake to build our package===<br />
The only and one thing to do is edit $OMDIR/build/local.conf to tell bitbake to search our folders for .bb files:<br />
<pre><br />
BBFILES+="${HOME}/MypersonalOpenMokoPackages/packages/*/*.bb"<br />
</pre><br />
There is no need to change BBPATH or something else, this is only needed to add new configuration files, not recipes.<br />
<br />
Running<br />
<pre><br />
$ cd $OMDIR/build<br />
$ bitbake mypackage<br />
</pre><br />
will bring all the necessary operations to create a package in $OMDIR/build/tmp/deploy/ipk/armv4t/myhello .....<br />
<br />
The following is an example build log:<br />
<pre><br />
OE Build Configuration:<br />
BB_VERSION = "1.6.9"<br />
OE_REVISION = "<unknown>"<br />
TARGET_ARCH = "arm"<br />
TARGET_OS = "linux"<br />
MACHINE = "fic-gta01"<br />
DISTRO = "openmoko"<br />
DISTRO_VERSION = ".dev-snapshot-20070723"<br />
TARGET_FPU = "soft"<br />
<br />
NOTE: This BitBake doesn't support revision fetching, falling back to current date<br />
NOTE: preferred version 2.4 of glibc not available<br />
NOTE: preferred version 2.4 of glibc-intermediate not available<br />
NOTE: preferred version 2.4 of glibc not available<br />
NOTE: package myhello-1.0: started<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_fetch: started<br />
NOTE: Fetch svn://svn.unsads.com/squalyl/om/src/myhello;proto=https;module=myhello-1.0<br />
A myhello-1.0/configure.ac<br />
A myhello-1.0/include<br />
A myhello-1.0/include/config.h.in<br />
A myhello-1.0/cleanall.sh<br />
A myhello-1.0/AUTHORS<br />
A myhello-1.0/bootstrap.sh<br />
A myhello-1.0/ChangeLog<br />
A myhello-1.0/src<br />
A myhello-1.0/src/hello.c<br />
A myhello-1.0/Makefile.am<br />
A myhello-1.0/NEWS<br />
A myhello-1.0/README<br />
Révision 2116 extraite.<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_fetch: completed<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_unpack: started<br />
NOTE: Unpacking /home/squalyl/OM/sources/myhello-1.0_svn.unsads.com_.squalyl.om.src.myhello__now.tar.gz to /home/squalyl/OM/build/tmp/work/armv4t-linux/myhello-1.0-r0_0_200707231759/<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_unpack: completed<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_patch: started<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_patch: completed<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_configure: started<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_configure: completed<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_compile: started<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_compile: completed<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_install: started<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_install: completed<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_package: started<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_package: completed<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_package_write: started<br />
Packaged contents of myhello-dbg into /home/squalyl/OM/build/tmp/deploy/ipk/armv4t/myhello-dbg_1.0-r0_0_200707231759_armv4t.ipk<br />
Packaged contents of myhello into /home/squalyl/OM/build/tmp/deploy/ipk/armv4t/myhello_1.0-r0_0_200707231759_armv4t.ipk<br />
NOTE: Not creating empty archive for myhello-doc-1.0-r0_0_200707231759<br />
NOTE: Not creating empty archive for myhello-dev-1.0-r0_0_200707231759<br />
NOTE: Not creating empty archive for myhello-locale-1.0-r0_0_200707231759<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_package_write: completed<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_populate_staging: started<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_populate_staging: completed<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_build: started<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_build: completed<br />
NOTE: package myhello-1.0: completed<br />
NOTE: build 200707231952: completed<br />
Build statistics:<br />
Attempted builds: 1<br />
</pre><br />
<br />
===Get this package included in the rootfs image===<br />
<br />
<blockquote><br />
This method is not a standard or normal way to include a package.<br />
The proper method follows the improper method.<br />
</blockquote><br />
bitbake openmoko-devel-image is used to build the entire distribution, but it does not include your new package in the rootfs image.<br />
<br />
To do this, use:<br />
<br />
<pre>bitbake openmoko-devel-image -crebuild</pre><br />
<br />
This will actually rebuild the rootfs, including your new packages.<br />
<br />
<blockquote><br />
The suggested method follows below.<br />
</blockquote><br />
<br />
To include the package in the image there are two steps.<br />
<br />
First: Modify your local.conf. $OMDIR/build/conf/local.conf<br />
<pre><br />
DISTRO_EXTRA_RDEPENDS += "<app name>"<br />
</pre><br />
This adds your application as a dependency for building the distro.<br />
<br />
Second: Update the task-base.<br />
<pre><br />
bitbake task-base -crebuild<br />
</pre><br />
When you update the task base it re-builds and ipk file which will: "Merge machine and distro options to create a basic machine task/package" <br />
<br />
You could also add your package by modifying the openmoko/trunk/oe/packages/tasks/task-openmoko.bb and adding your application name with the trailing backslash right before the update-alternatives line.<br />
<pre><br />
modutils-initscripts \<br />
module-init-tools-depmod \<br />
udev \<br />
rsync \<br />
screen \<br />
<My application Name> \ <br />
# update-alternatives \<br />
</pre><br />
<br />
Then to test this out (if you're using the [[MokoMakeFile]]) it's pretty simple.<br />
<pre><br />
make openmoko-devel-image<br />
make build-qemu<br />
make flash-qemu-local<br />
</pre><br />
And now you're running qemu with that fancy new image you just made!<br />
<br />
<br />
[[Category:Applications]]<br />
[[Category:Platform]]</div>Bryce.Leohttp://wiki.openmoko.org/wiki/Create_an_ipk_package_from_sourcesCreate an ipk package from sources2007-07-28T21:11:15Z<p>Bryce.Leo: /* The recipe */</p>
<hr />
<div>This is a small tutorial to help people that want to write new software for Openmoko, eg. to port existing programs.<br />
<br />
==Theory==<br />
OpenMoko uses OpenEmbedded, a package and root image build system.<br />
<br />
OpenEmbedded provides patches and Bitbake Recipes, that are similar to .spec files to build RPM packages. Bitbake is used to process recipes and obtain packages and FS images. For example, bitbake can fetch sources, apply patches, configure, make and install compiled sources. Other steps are user definable, but this is not the scope of this tutorial.<br />
<br />
A standard use of bitbake is to download an existing "vanilla" package, ie "gcc" or "binutils" or "linux kernel", apply platform patches (adding bugfixes, porting fixes, drivers, etc...) then compile and package the resulting binaries.<br />
<br />
==Software versionning==<br />
Versions management is a very wide topic, there are tons of different opinions about it, I'll try to be quick.<br />
<br />
Packages versions are important in a distribution building mechanism, and package versions are a complete part of the full package name. They are obviously used to track important changes made to your package, and isolate each version. Here we must be a little aware of basic version management.<br />
Current (most advanced) version is named the "trunk". Additions, fixes, etc. are done to the trunk.<br />
<br />
Once a certain level of functionality is achieved, a copy of the trunk (a "snapshot") is taken, and named with a version number. As a result, current development continues on the trunk, but users can download well defined "releases", with known bugs and functionnality level. This is called "branching". If version specific bugs are found in version a.b, then we can update this branch independently.<br />
<br />
In bitbake, we must specify which release of our software we are going to package. This may not be an habit, especially if you only develop small programs, not maintained by more than one or two person. If your software is named "myprogram" but has no real version number attached, you can just rename your project directory to "myprogram-1.0".<br />
<br />
This is a good practice; If you are packaging a software, then it will be used by other people, so when you modify it next time, put it in a folder named "myprogram-1.1" :) This brings clarity to users, ease of management to you, and ability to plan future releases to your team.<br />
<br />
==Example==<br />
Say you have a working software package, ie a file system directory with sources, Makefile, etc...<br />
Because this is a common method, I will base my presentation on a project generated using autotools. This implies that the software can be installed somewhere by following the magical steps ./configure && make && make install.<br />
<br />
===Prerequisites===<br />
You need a configured openmoko development tree. All details are in [[Building OpenMoko from scratch]]<br />
<br />
You may also do this with [[MokoMakeFile]], see instructions at the bottom.<br />
<br />
The following commands will give you one, they are copied from the above page. Just copy and paste in a shell.<br />
<br />
<pre><br />
#prepare<br />
cd $HOME<br />
mkdir OM<br />
cd OM<br />
<br />
#get openembedded<br />
wget http://www.openembedded.org/snapshots/OE.mtn.bz2<br />
bunzip2 OE.mtn.bz2<br />
mtn --db=OE.mtn pull monotone.openembedded.org org.openembedded.dev<br />
mtn --db=OE.mtn checkout --branch=org.openembedded.dev -r e2dbb52fe39df7ef786b6068f6178f29508dfded openembedded<br />
<br />
#get openmoko<br />
svn co http://svn.openmoko.org/ openmoko<br />
<br />
#create local config<br />
mkdir -p sources build/conf<br />
cat <<EOF >build/conf/local.conf<br />
MACHINE = "fic-gta01"<br />
DISTRO = "openmoko"<br />
BUILD_ARCH = "`uname -m`"<br />
EOF<br />
<br />
#fixes (didnt try without them)<br />
ln -s openmoko/trunk/oe ./oe<br />
cd sources<br />
mkdir -p ../build/tmp/stamps/armv4t-linux<br />
wget http://ftp.mozilla.org/pub/mozilla.org/js/older-packages/js-1.5.tar.gz<br />
touch ../build/tmp/stamps/armv4t-linux/js-1.5-r0.do_fetch<br />
wget http://us4.samba.org/samba/ftp/stable/samba-3.0.14a.tar.gz<br />
touch ../build/tmp/stamps/armv4t-linux/samba-3.0.14a-r15.do_fetch<br />
perl -pi.orig -e 's/ *$//;s/\r//g' ../openembedded/packages/gcc/gcc-4.1.1/gcc-4.1.1-pr13685-1.patch<br />
</pre><br />
<br />
Then, you need the environment variables described here: [[Building_OpenMoko_from_scratch#Environment_variables]]<br />
Put the given lines in a script, then go to your build/ dir and source it:<br />
<pre><br />
cat <<EOF >doenv.sh<br />
#!/bin/sh<br />
export OMDIR=`pwd`<br />
export BBPATH=$OMDIR/build:$OMDIR/openmoko/trunk/oe:$OMDIR/openembedded<br />
EOF<br />
. ./doenv.sh<br />
</pre><br />
<br />
After this, your tree will look like that:<br />
<pre><br />
$HOME/OM<br />
+- build<br />
| +- conf<br />
| | +- local.conf<br />
+- openmoko<br />
+- openembedded<br />
+- sources<br />
+- env.sh<br />
</pre><br />
etc...<br />
<br />
<br />
Follow the link to [[MokoMakefile]] and follow the instructions.<br />
You're now all set to start building. Remember to run the setup-env command for each time you open a terminal. This sets your environment variables, however it is easier to include them in the rc file of your shell.<br />
<br />
===Proposed directory layout for our new packages===<br />
Bitbake recipes are single files describing how to build a package. I recommend to have a recipe for each package version (myprogram-1.0.bb, myprogram-1.1.bb, etc.) all stored in a directory named "myprogram"<br />
<br />
Our personal tree can be everywhere else:<br />
<pre><br />
$HOME<br />
+- $OMDIR (contains the official openmoko tree)<br />
| +- ...<br />
+- My_personal_OpenMoko_Packages<br />
| +- packages<br />
| +- myhello<br />
| +- myhello-1.0.bb<br />
+- My_Personal_Projects_Folder<br />
+- myhello<br />
+- myhello-1.0<br />
+- configure.ac<br />
+- Makefile.am<br />
+- ...<br />
</pre><br />
<br />
To do a simple test, pack your sources in a tar, and put this tar on a web server:<br />
<pre><br />
cd My_personal_Projects_Folder/myhello<br />
tar cvfz myhello-1.0.tar.gz myhello-1.0/<br />
</pre><br />
This is correct, ie the tarball will have a NAME-VERSION subdirectory, that's what we need.<br />
<br />
===The recipe===<br />
In the bitbake file, you need to give<br />
* a description for your package, variable name is DESCRIPTION<br />
* a package name (PN)<br />
* a package version (PV)<br />
* a source URI, I'll give details later<br />
* a source version, to checkout a particular revision of versionned trees<br />
* Please see the [http://www.openembedded.org/wiki/StyleGuide Open Embedded StyleGuide] which should answer most if not all questions about .bb file conventions.<br />
<br />
here's an example:<br />
<br />
<pre>#package description<br />
DESCRIPTION = "An example application for openmoko, depending on a custom source repository"<br />
SECTION = "squalyl/myhello"<br />
<br />
#this is optional<br />
LICENSE = "GPLv2"<br />
<br />
PN = "myhello"<br />
PV = "1.0"<br />
<br />
#use "now" to force svn updates at each build<br />
#Using now is a very dangerous way to do it. ONLY use this in your<br />
#personal recipes when you're doing heavy testing, otherwise<br />
#choose a stable date and stick with it that way when you distribute your recipe<br />
#you don't have all sorts of versions getting built out in the wild.<br />
SRCDATE_${PN} = "now"<br />
SRC_URI = "svn://repo/path/myhello;proto=https;module=${PN}-${PV}"<br />
<br />
#for a tarball use:<br />
#SRC_URI = "http://server/path/package/${PN}-${PV}.tar.gz"<br />
<br />
#include standard rules to build a autoconf/automake package<br />
inherit autotools<br />
</pre><br />
<br />
Expressions starting by ${} are substituted, this allows you to download a tarball named "mypackage-1.0.tar.gz" for example<br />
<br />
=== Source URIs ===<br />
bitbake can get the source code for your project from a variety of locations including tarball, subversion and git.<br />
<br />
All of this is explained in the [http://bitbake.berlios.de/manual/ bitbake manual], particulary [http://bitbake.berlios.de/manual/ch03.html#id869590 here].<br />
<br />
The package build directory, the one where bitbake will run "configure" et al, will follow the name template: "PACKAGE_NAME-PACKAGE_VERSION", so<br />
<br />
* tarballs must extract to a subdirectory with this name<br />
* svn top directory must have this name<br />
<br />
It's very important. I spent 3 days blocking on this!<br />
<br />
===Tell bitbake to build our package===<br />
The only and one thing to do is edit $OMDIR/build/local.conf to tell bitbake to search our folders for .bb files:<br />
<pre><br />
BBFILES+="${HOME}/MypersonalOpenMokoPackages/packages/*/*.bb"<br />
</pre><br />
There is no need to change BBPATH or something else, this is only needed to add new configuration files, not recipes.<br />
<br />
Running<br />
<pre><br />
$ cd $OMDIR/build<br />
$ bitbake mypackage<br />
</pre><br />
will bring all the necessary operations to create a package in $OMDIR/build/tmp/deploy/ipk/armv4t/myhello .....<br />
<br />
The following is an example build log:<br />
<pre><br />
OE Build Configuration:<br />
BB_VERSION = "1.6.9"<br />
OE_REVISION = "<unknown>"<br />
TARGET_ARCH = "arm"<br />
TARGET_OS = "linux"<br />
MACHINE = "fic-gta01"<br />
DISTRO = "openmoko"<br />
DISTRO_VERSION = ".dev-snapshot-20070723"<br />
TARGET_FPU = "soft"<br />
<br />
NOTE: This BitBake doesn't support revision fetching, falling back to current date<br />
NOTE: preferred version 2.4 of glibc not available<br />
NOTE: preferred version 2.4 of glibc-intermediate not available<br />
NOTE: preferred version 2.4 of glibc not available<br />
NOTE: package myhello-1.0: started<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_fetch: started<br />
NOTE: Fetch svn://svn.unsads.com/squalyl/om/src/myhello;proto=https;module=myhello-1.0<br />
A myhello-1.0/configure.ac<br />
A myhello-1.0/include<br />
A myhello-1.0/include/config.h.in<br />
A myhello-1.0/cleanall.sh<br />
A myhello-1.0/AUTHORS<br />
A myhello-1.0/bootstrap.sh<br />
A myhello-1.0/ChangeLog<br />
A myhello-1.0/src<br />
A myhello-1.0/src/hello.c<br />
A myhello-1.0/Makefile.am<br />
A myhello-1.0/NEWS<br />
A myhello-1.0/README<br />
Révision 2116 extraite.<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_fetch: completed<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_unpack: started<br />
NOTE: Unpacking /home/squalyl/OM/sources/myhello-1.0_svn.unsads.com_.squalyl.om.src.myhello__now.tar.gz to /home/squalyl/OM/build/tmp/work/armv4t-linux/myhello-1.0-r0_0_200707231759/<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_unpack: completed<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_patch: started<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_patch: completed<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_configure: started<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_configure: completed<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_compile: started<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_compile: completed<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_install: started<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_install: completed<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_package: started<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_package: completed<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_package_write: started<br />
Packaged contents of myhello-dbg into /home/squalyl/OM/build/tmp/deploy/ipk/armv4t/myhello-dbg_1.0-r0_0_200707231759_armv4t.ipk<br />
Packaged contents of myhello into /home/squalyl/OM/build/tmp/deploy/ipk/armv4t/myhello_1.0-r0_0_200707231759_armv4t.ipk<br />
NOTE: Not creating empty archive for myhello-doc-1.0-r0_0_200707231759<br />
NOTE: Not creating empty archive for myhello-dev-1.0-r0_0_200707231759<br />
NOTE: Not creating empty archive for myhello-locale-1.0-r0_0_200707231759<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_package_write: completed<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_populate_staging: started<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_populate_staging: completed<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_build: started<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_build: completed<br />
NOTE: package myhello-1.0: completed<br />
NOTE: build 200707231952: completed<br />
Build statistics:<br />
Attempted builds: 1<br />
</pre><br />
<br />
===Get this package included in the rootfs image===<br />
<br />
bitbake openmoko-devel-image is used to build the entire distribution, but it does not include your new package in the rootfs image.<br />
<br />
To do this, use:<br />
<br />
<pre>bitbake openmoko-devel-image -crebuild</pre><br />
<br />
This will actually rebuild the rootfs, including your new packages.<br />
<br />
[[Category:Applications]]<br />
[[Category:Platform]]</div>Bryce.Leohttp://wiki.openmoko.org/wiki/Create_an_ipk_package_from_sourcesCreate an ipk package from sources2007-07-28T18:32:00Z<p>Bryce.Leo: /* Prerequisites */</p>
<hr />
<div>This is a small tutorial to help people that want to write new software for Openmoko, eg. to port existing programs.<br />
<br />
==Theory==<br />
OpenMoko uses OpenEmbedded, a package and root image build system.<br />
<br />
OpenEmbedded provides patches and Bitbake Recipes, that are similar to .spec files to build RPM packages. Bitbake is used to process recipes and obtain packages and FS images. For example, bitbake can fetch sources, apply patches, configure, make and install compiled sources. Other steps are user definable, but this is not the scope of this tutorial.<br />
<br />
A standard use of bitbake is to download an existing "vanilla" package, ie "gcc" or "binutils" or "linux kernel", apply platform patches (adding bugfixes, porting fixes, drivers, etc...) then compile and package the resulting binaries.<br />
<br />
==Software versionning==<br />
Versions management is a very wide topic, there are tons of different opinions about it, I'll try to be quick.<br />
<br />
Packages versions are important in a distribution building mechanism, and package versions are a complete part of the full package name. They are obviously used to track important changes made to your package, and isolate each version. Here we must be a little aware of basic version management.<br />
Current (most advanced) version is named the "trunk". Additions, fixes, etc. are done to the trunk.<br />
<br />
Once a certain level of functionality is achieved, a copy of the trunk (a "snapshot") is taken, and named with a version number. As a result, current development continues on the trunk, but users can download well defined "releases", with known bugs and functionnality level. This is called "branching". If version specific bugs are found in version a.b, then we can update this branch independently.<br />
<br />
In bitbake, we must specify which release of our software we are going to package. This may not be an habit, especially if you only develop small programs, not maintained by more than one or two person. If your software is named "myprogram" but has no real version number attached, you can just rename your project directory to "myprogram-1.0".<br />
<br />
This is a good practice; If you are packaging a software, then it will be used by other people, so when you modify it next time, put it in a folder named "myprogram-1.1" :) This brings clarity to users, ease of management to you, and ability to plan future releases to your team.<br />
<br />
==Example==<br />
Say you have a working software package, ie a file system directory with sources, Makefile, etc...<br />
Because this is a common method, I will base my presentation on a project generated using autotools. This implies that the software can be installed somewhere by following the magical steps ./configure && make && make install.<br />
<br />
===Prerequisites===<br />
You need a configured openmoko development tree. All details are in [[Building OpenMoko from scratch]]<br />
<br />
You may also do this with [[MokoMakeFile]], see instructions at the bottom.<br />
<br />
The following commands will give you one, they are copied from the above page. Just copy and paste in a shell.<br />
<br />
<pre><br />
#prepare<br />
cd $HOME<br />
mkdir OM<br />
cd OM<br />
<br />
#get openembedded<br />
wget http://www.openembedded.org/snapshots/OE.mtn.bz2<br />
bunzip2 OE.mtn.bz2<br />
mtn --db=OE.mtn pull monotone.openembedded.org org.openembedded.dev<br />
mtn --db=OE.mtn checkout --branch=org.openembedded.dev -r e2dbb52fe39df7ef786b6068f6178f29508dfded openembedded<br />
<br />
#get openmoko<br />
svn co http://svn.openmoko.org/ openmoko<br />
<br />
#create local config<br />
mkdir -p sources build/conf<br />
cat <<EOF >build/conf/local.conf<br />
MACHINE = "fic-gta01"<br />
DISTRO = "openmoko"<br />
BUILD_ARCH = "`uname -m`"<br />
EOF<br />
<br />
#fixes (didnt try without them)<br />
ln -s openmoko/trunk/oe ./oe<br />
cd sources<br />
mkdir -p ../build/tmp/stamps/armv4t-linux<br />
wget http://ftp.mozilla.org/pub/mozilla.org/js/older-packages/js-1.5.tar.gz<br />
touch ../build/tmp/stamps/armv4t-linux/js-1.5-r0.do_fetch<br />
wget http://us4.samba.org/samba/ftp/stable/samba-3.0.14a.tar.gz<br />
touch ../build/tmp/stamps/armv4t-linux/samba-3.0.14a-r15.do_fetch<br />
perl -pi.orig -e 's/ *$//;s/\r//g' ../openembedded/packages/gcc/gcc-4.1.1/gcc-4.1.1-pr13685-1.patch<br />
</pre><br />
<br />
Then, you need the environment variables described here: [[Building_OpenMoko_from_scratch#Environment_variables]]<br />
Put the given lines in a script, then go to your build/ dir and source it:<br />
<pre><br />
cat <<EOF >doenv.sh<br />
#!/bin/sh<br />
export OMDIR=`pwd`<br />
export BBPATH=$OMDIR/build:$OMDIR/openmoko/trunk/oe:$OMDIR/openembedded<br />
EOF<br />
. ./doenv.sh<br />
</pre><br />
<br />
After this, your tree will look like that:<br />
<pre><br />
$HOME/OM<br />
+- build<br />
| +- conf<br />
| | +- local.conf<br />
+- openmoko<br />
+- openembedded<br />
+- sources<br />
+- env.sh<br />
</pre><br />
etc...<br />
<br />
<br />
Follow the link to [[MokoMakefile]] and follow the instructions.<br />
You're now all set to start building. Remember to run the setup-env command for each time you open a terminal. This sets your environment variables, however it is easier to include them in the rc file of your shell.<br />
<br />
===Proposed directory layout for our new packages===<br />
Bitbake recipes are single files describing how to build a package. I recommend to have a recipe for each package version (myprogram-1.0.bb, myprogram-1.1.bb, etc.) all stored in a directory named "myprogram"<br />
<br />
Our personal tree can be everywhere else:<br />
<pre><br />
$HOME<br />
+- $OMDIR (contains the official openmoko tree)<br />
| +- ...<br />
+- My_personal_OpenMoko_Packages<br />
| +- packages<br />
| +- myhello<br />
| +- myhello-1.0.bb<br />
+- My_Personal_Projects_Folder<br />
+- myhello<br />
+- myhello-1.0<br />
+- configure.ac<br />
+- Makefile.am<br />
+- ...<br />
</pre><br />
<br />
To do a simple test, pack your sources in a tar, and put this tar on a web server:<br />
<pre><br />
cd My_personal_Projects_Folder/myhello<br />
tar cvfz myhello-1.0.tar.gz myhello-1.0/<br />
</pre><br />
This is correct, ie the tarball will have a NAME-VERSION subdirectory, that's what we need.<br />
<br />
===The recipe===<br />
In the bitbake file, you need to give<br />
* a description for your package, variable name is DESCRIPTION<br />
* a package name (PN)<br />
* a package version (PV)<br />
* a source URI, I'll give details later<br />
* a source version, to checkout a particular revision of versionned trees<br />
* Please see the [http://www.openembedded.org/wiki/StyleGuide Open Embedded StyleGuide] which should answer most if not all questions about .bb file conventions.<br />
<br />
here's an example:<br />
<br />
<pre>#package description<br />
DESCRIPTION = "An example application for openmoko, depending on a custom source repository"<br />
SECTION = "squalyl/myhello"<br />
<br />
#this is optional<br />
LICENSE = "GPLv2"<br />
<br />
PN = "myhello"<br />
PV = "1.0"<br />
<br />
#use "now" to force svn updates at each build<br />
#Using now is a very dangerous way to do it. ONLY use this in your<br />
#personal recipes when you're doing heavy testing, otherwise<br />
#choose a stable date and stick with it that way when you distribute your recipe<br />
#you don't have all sorts of versions getting built out in the wild.<br />
SRCDATE_${PN} = "now"<br />
SRC_URI = "svn://repo/path/myhello;proto=https;module=${PN}-${PV}"<br />
<br />
#for a tarball use:<br />
#SRC_URI = "http://server/path/package/${PN}-{$PV}.tar.gz"<br />
<br />
#include standard rules to build a autoconf/automake package<br />
inherit autotools<br />
</pre><br />
<br />
Expressions starting by ${} are substituted, this allows you to download a tarball named "mypackage-1.0.tar.gz" for example<br />
<br />
=== Source URIs ===<br />
bitbake can get the source code for your project from a variety of locations including tarball, subversion and git.<br />
<br />
All of this is explained in the [http://bitbake.berlios.de/manual/ bitbake manual], particulary [http://bitbake.berlios.de/manual/ch03.html#id869590 here].<br />
<br />
The package build directory, the one where bitbake will run "configure" et al, will follow the name template: "PACKAGE_NAME-PACKAGE_VERSION", so<br />
<br />
* tarballs must extract to a subdirectory with this name<br />
* svn top directory must have this name<br />
<br />
It's very important. I spent 3 days blocking on this!<br />
<br />
===Tell bitbake to build our package===<br />
The only and one thing to do is edit $OMDIR/build/local.conf to tell bitbake to search our folders for .bb files:<br />
<pre><br />
BBFILES+="${HOME}/MypersonalOpenMokoPackages/packages/*/*.bb"<br />
</pre><br />
There is no need to change BBPATH or something else, this is only needed to add new configuration files, not recipes.<br />
<br />
Running<br />
<pre><br />
$ cd $OMDIR/build<br />
$ bitbake mypackage<br />
</pre><br />
will bring all the necessary operations to create a package in $OMDIR/build/tmp/deploy/ipk/armv4t/myhello .....<br />
<br />
The following is an example build log:<br />
<pre><br />
OE Build Configuration:<br />
BB_VERSION = "1.6.9"<br />
OE_REVISION = "<unknown>"<br />
TARGET_ARCH = "arm"<br />
TARGET_OS = "linux"<br />
MACHINE = "fic-gta01"<br />
DISTRO = "openmoko"<br />
DISTRO_VERSION = ".dev-snapshot-20070723"<br />
TARGET_FPU = "soft"<br />
<br />
NOTE: This BitBake doesn't support revision fetching, falling back to current date<br />
NOTE: preferred version 2.4 of glibc not available<br />
NOTE: preferred version 2.4 of glibc-intermediate not available<br />
NOTE: preferred version 2.4 of glibc not available<br />
NOTE: package myhello-1.0: started<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_fetch: started<br />
NOTE: Fetch svn://svn.unsads.com/squalyl/om/src/myhello;proto=https;module=myhello-1.0<br />
A myhello-1.0/configure.ac<br />
A myhello-1.0/include<br />
A myhello-1.0/include/config.h.in<br />
A myhello-1.0/cleanall.sh<br />
A myhello-1.0/AUTHORS<br />
A myhello-1.0/bootstrap.sh<br />
A myhello-1.0/ChangeLog<br />
A myhello-1.0/src<br />
A myhello-1.0/src/hello.c<br />
A myhello-1.0/Makefile.am<br />
A myhello-1.0/NEWS<br />
A myhello-1.0/README<br />
Révision 2116 extraite.<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_fetch: completed<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_unpack: started<br />
NOTE: Unpacking /home/squalyl/OM/sources/myhello-1.0_svn.unsads.com_.squalyl.om.src.myhello__now.tar.gz to /home/squalyl/OM/build/tmp/work/armv4t-linux/myhello-1.0-r0_0_200707231759/<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_unpack: completed<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_patch: started<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_patch: completed<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_configure: started<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_configure: completed<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_compile: started<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_compile: completed<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_install: started<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_install: completed<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_package: started<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_package: completed<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_package_write: started<br />
Packaged contents of myhello-dbg into /home/squalyl/OM/build/tmp/deploy/ipk/armv4t/myhello-dbg_1.0-r0_0_200707231759_armv4t.ipk<br />
Packaged contents of myhello into /home/squalyl/OM/build/tmp/deploy/ipk/armv4t/myhello_1.0-r0_0_200707231759_armv4t.ipk<br />
NOTE: Not creating empty archive for myhello-doc-1.0-r0_0_200707231759<br />
NOTE: Not creating empty archive for myhello-dev-1.0-r0_0_200707231759<br />
NOTE: Not creating empty archive for myhello-locale-1.0-r0_0_200707231759<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_package_write: completed<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_populate_staging: started<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_populate_staging: completed<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_build: started<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_build: completed<br />
NOTE: package myhello-1.0: completed<br />
NOTE: build 200707231952: completed<br />
Build statistics:<br />
Attempted builds: 1<br />
</pre><br />
<br />
===Get this package included in the rootfs image===<br />
<br />
bitbake openmoko-devel-image is used to build the entire distribution, but it does not include your new package in the rootfs image.<br />
<br />
To do this, use:<br />
<br />
<pre>bitbake openmoko-devel-image -crebuild</pre><br />
<br />
This will actually rebuild the rootfs, including your new packages.<br />
<br />
[[Category:Applications]]<br />
[[Category:Platform]]</div>Bryce.Leohttp://wiki.openmoko.org/wiki/Create_an_ipk_package_from_sourcesCreate an ipk package from sources2007-07-28T18:30:48Z<p>Bryce.Leo: /* Prerequisites */</p>
<hr />
<div>This is a small tutorial to help people that want to write new software for Openmoko, eg. to port existing programs.<br />
<br />
==Theory==<br />
OpenMoko uses OpenEmbedded, a package and root image build system.<br />
<br />
OpenEmbedded provides patches and Bitbake Recipes, that are similar to .spec files to build RPM packages. Bitbake is used to process recipes and obtain packages and FS images. For example, bitbake can fetch sources, apply patches, configure, make and install compiled sources. Other steps are user definable, but this is not the scope of this tutorial.<br />
<br />
A standard use of bitbake is to download an existing "vanilla" package, ie "gcc" or "binutils" or "linux kernel", apply platform patches (adding bugfixes, porting fixes, drivers, etc...) then compile and package the resulting binaries.<br />
<br />
==Software versionning==<br />
Versions management is a very wide topic, there are tons of different opinions about it, I'll try to be quick.<br />
<br />
Packages versions are important in a distribution building mechanism, and package versions are a complete part of the full package name. They are obviously used to track important changes made to your package, and isolate each version. Here we must be a little aware of basic version management.<br />
Current (most advanced) version is named the "trunk". Additions, fixes, etc. are done to the trunk.<br />
<br />
Once a certain level of functionality is achieved, a copy of the trunk (a "snapshot") is taken, and named with a version number. As a result, current development continues on the trunk, but users can download well defined "releases", with known bugs and functionnality level. This is called "branching". If version specific bugs are found in version a.b, then we can update this branch independently.<br />
<br />
In bitbake, we must specify which release of our software we are going to package. This may not be an habit, especially if you only develop small programs, not maintained by more than one or two person. If your software is named "myprogram" but has no real version number attached, you can just rename your project directory to "myprogram-1.0".<br />
<br />
This is a good practice; If you are packaging a software, then it will be used by other people, so when you modify it next time, put it in a folder named "myprogram-1.1" :) This brings clarity to users, ease of management to you, and ability to plan future releases to your team.<br />
<br />
==Example==<br />
Say you have a working software package, ie a file system directory with sources, Makefile, etc...<br />
Because this is a common method, I will base my presentation on a project generated using autotools. This implies that the software can be installed somewhere by following the magical steps ./configure && make && make install.<br />
<br />
===Prerequisites===<br />
You need a configured openmoko development tree. All details are in [[Building OpenMoko from scratch]]<br />
<br />
You may also do this with [[MokoMakeFile]], see instructions at the bottom.<br />
<br />
The following commands will give you one, they are copied from the above page. Just copy and paste in a shell.<br />
<br />
<pre><br />
#prepare<br />
cd $HOME<br />
mkdir OM<br />
cd OM<br />
<br />
#get openembedded<br />
wget http://www.openembedded.org/snapshots/OE.mtn.bz2<br />
bunzip2 OE.mtn.bz2<br />
mtn --db=OE.mtn pull monotone.openembedded.org org.openembedded.dev<br />
mtn --db=OE.mtn checkout --branch=org.openembedded.dev -r e2dbb52fe39df7ef786b6068f6178f29508dfded openembedded<br />
<br />
#get openmoko<br />
svn co http://svn.openmoko.org/ openmoko<br />
<br />
#create local config<br />
mkdir -p sources build/conf<br />
cat <<EOF >build/conf/local.conf<br />
MACHINE = "fic-gta01"<br />
DISTRO = "openmoko"<br />
BUILD_ARCH = "`uname -m`"<br />
EOF<br />
<br />
#fixes (didnt try without them)<br />
ln -s openmoko/trunk/oe ./oe<br />
cd sources<br />
mkdir -p ../build/tmp/stamps/armv4t-linux<br />
wget http://ftp.mozilla.org/pub/mozilla.org/js/older-packages/js-1.5.tar.gz<br />
touch ../build/tmp/stamps/armv4t-linux/js-1.5-r0.do_fetch<br />
wget http://us4.samba.org/samba/ftp/stable/samba-3.0.14a.tar.gz<br />
touch ../build/tmp/stamps/armv4t-linux/samba-3.0.14a-r15.do_fetch<br />
perl -pi.orig -e 's/ *$//;s/\r//g' ../openembedded/packages/gcc/gcc-4.1.1/gcc-4.1.1-pr13685-1.patch<br />
</pre><br />
<br />
Then, you need the environment variables described here: [[Building_OpenMoko_from_scratch#Environment_variables]]<br />
Put the given lines in a script, then go to your build/ dir and source it:<br />
<pre><br />
cat <<EOF >doenv.sh<br />
#!/bin/sh<br />
export OMDIR=`pwd`<br />
export BBPATH=$OMDIR/build:$OMDIR/openmoko/trunk/oe:$OMDIR/openembedded<br />
EOF<br />
. ./doenv.sh<br />
</pre><br />
<br />
After this, your tree will look like that:<br />
<pre><br />
$HOME/OM<br />
+- build<br />
| +- conf<br />
| | +- local.conf<br />
+- openmoko<br />
+- openembedded<br />
+- sources<br />
+- env.sh<br />
</pre><br />
etc...<br />
<br />
<br />
Follow the link to [[MokoMakefile]] and follow the instructions. Change directory into "build" and use the command<br />
<pre><br />
$ . ../setup-env<br />
</pre><br />
You're now all set to start building. Remember to run that setup-env command for each time you open a terminal. This sets your environment variables, however it is easier to include them in the rc file for your shell.<br />
<br />
===Proposed directory layout for our new packages===<br />
Bitbake recipes are single files describing how to build a package. I recommend to have a recipe for each package version (myprogram-1.0.bb, myprogram-1.1.bb, etc.) all stored in a directory named "myprogram"<br />
<br />
Our personal tree can be everywhere else:<br />
<pre><br />
$HOME<br />
+- $OMDIR (contains the official openmoko tree)<br />
| +- ...<br />
+- My_personal_OpenMoko_Packages<br />
| +- packages<br />
| +- myhello<br />
| +- myhello-1.0.bb<br />
+- My_Personal_Projects_Folder<br />
+- myhello<br />
+- myhello-1.0<br />
+- configure.ac<br />
+- Makefile.am<br />
+- ...<br />
</pre><br />
<br />
To do a simple test, pack your sources in a tar, and put this tar on a web server:<br />
<pre><br />
cd My_personal_Projects_Folder/myhello<br />
tar cvfz myhello-1.0.tar.gz myhello-1.0/<br />
</pre><br />
This is correct, ie the tarball will have a NAME-VERSION subdirectory, that's what we need.<br />
<br />
===The recipe===<br />
In the bitbake file, you need to give<br />
* a description for your package, variable name is DESCRIPTION<br />
* a package name (PN)<br />
* a package version (PV)<br />
* a source URI, I'll give details later<br />
* a source version, to checkout a particular revision of versionned trees<br />
* Please see the [http://www.openembedded.org/wiki/StyleGuide Open Embedded StyleGuide] which should answer most if not all questions about .bb file conventions.<br />
<br />
here's an example:<br />
<br />
<pre>#package description<br />
DESCRIPTION = "An example application for openmoko, depending on a custom source repository"<br />
SECTION = "squalyl/myhello"<br />
<br />
#this is optional<br />
LICENSE = "GPLv2"<br />
<br />
PN = "myhello"<br />
PV = "1.0"<br />
<br />
#use "now" to force svn updates at each build<br />
#Using now is a very dangerous way to do it. ONLY use this in your<br />
#personal recipes when you're doing heavy testing, otherwise<br />
#choose a stable date and stick with it that way when you distribute your recipe<br />
#you don't have all sorts of versions getting built out in the wild.<br />
SRCDATE_${PN} = "now"<br />
SRC_URI = "svn://repo/path/myhello;proto=https;module=${PN}-${PV}"<br />
<br />
#for a tarball use:<br />
#SRC_URI = "http://server/path/package/${PN}-{$PV}.tar.gz"<br />
<br />
#include standard rules to build a autoconf/automake package<br />
inherit autotools<br />
</pre><br />
<br />
Expressions starting by ${} are substituted, this allows you to download a tarball named "mypackage-1.0.tar.gz" for example<br />
<br />
=== Source URIs ===<br />
bitbake can get the source code for your project from a variety of locations including tarball, subversion and git.<br />
<br />
All of this is explained in the [http://bitbake.berlios.de/manual/ bitbake manual], particulary [http://bitbake.berlios.de/manual/ch03.html#id869590 here].<br />
<br />
The package build directory, the one where bitbake will run "configure" et al, will follow the name template: "PACKAGE_NAME-PACKAGE_VERSION", so<br />
<br />
* tarballs must extract to a subdirectory with this name<br />
* svn top directory must have this name<br />
<br />
It's very important. I spent 3 days blocking on this!<br />
<br />
===Tell bitbake to build our package===<br />
The only and one thing to do is edit $OMDIR/build/local.conf to tell bitbake to search our folders for .bb files:<br />
<pre><br />
BBFILES+="${HOME}/MypersonalOpenMokoPackages/packages/*/*.bb"<br />
</pre><br />
There is no need to change BBPATH or something else, this is only needed to add new configuration files, not recipes.<br />
<br />
Running<br />
<pre><br />
$ cd $OMDIR/build<br />
$ bitbake mypackage<br />
</pre><br />
will bring all the necessary operations to create a package in $OMDIR/build/tmp/deploy/ipk/armv4t/myhello .....<br />
<br />
The following is an example build log:<br />
<pre><br />
OE Build Configuration:<br />
BB_VERSION = "1.6.9"<br />
OE_REVISION = "<unknown>"<br />
TARGET_ARCH = "arm"<br />
TARGET_OS = "linux"<br />
MACHINE = "fic-gta01"<br />
DISTRO = "openmoko"<br />
DISTRO_VERSION = ".dev-snapshot-20070723"<br />
TARGET_FPU = "soft"<br />
<br />
NOTE: This BitBake doesn't support revision fetching, falling back to current date<br />
NOTE: preferred version 2.4 of glibc not available<br />
NOTE: preferred version 2.4 of glibc-intermediate not available<br />
NOTE: preferred version 2.4 of glibc not available<br />
NOTE: package myhello-1.0: started<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_fetch: started<br />
NOTE: Fetch svn://svn.unsads.com/squalyl/om/src/myhello;proto=https;module=myhello-1.0<br />
A myhello-1.0/configure.ac<br />
A myhello-1.0/include<br />
A myhello-1.0/include/config.h.in<br />
A myhello-1.0/cleanall.sh<br />
A myhello-1.0/AUTHORS<br />
A myhello-1.0/bootstrap.sh<br />
A myhello-1.0/ChangeLog<br />
A myhello-1.0/src<br />
A myhello-1.0/src/hello.c<br />
A myhello-1.0/Makefile.am<br />
A myhello-1.0/NEWS<br />
A myhello-1.0/README<br />
Révision 2116 extraite.<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_fetch: completed<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_unpack: started<br />
NOTE: Unpacking /home/squalyl/OM/sources/myhello-1.0_svn.unsads.com_.squalyl.om.src.myhello__now.tar.gz to /home/squalyl/OM/build/tmp/work/armv4t-linux/myhello-1.0-r0_0_200707231759/<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_unpack: completed<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_patch: started<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_patch: completed<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_configure: started<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_configure: completed<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_compile: started<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_compile: completed<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_install: started<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_install: completed<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_package: started<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_package: completed<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_package_write: started<br />
Packaged contents of myhello-dbg into /home/squalyl/OM/build/tmp/deploy/ipk/armv4t/myhello-dbg_1.0-r0_0_200707231759_armv4t.ipk<br />
Packaged contents of myhello into /home/squalyl/OM/build/tmp/deploy/ipk/armv4t/myhello_1.0-r0_0_200707231759_armv4t.ipk<br />
NOTE: Not creating empty archive for myhello-doc-1.0-r0_0_200707231759<br />
NOTE: Not creating empty archive for myhello-dev-1.0-r0_0_200707231759<br />
NOTE: Not creating empty archive for myhello-locale-1.0-r0_0_200707231759<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_package_write: completed<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_populate_staging: started<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_populate_staging: completed<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_build: started<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_build: completed<br />
NOTE: package myhello-1.0: completed<br />
NOTE: build 200707231952: completed<br />
Build statistics:<br />
Attempted builds: 1<br />
</pre><br />
<br />
===Get this package included in the rootfs image===<br />
<br />
bitbake openmoko-devel-image is used to build the entire distribution, but it does not include your new package in the rootfs image.<br />
<br />
To do this, use:<br />
<br />
<pre>bitbake openmoko-devel-image -crebuild</pre><br />
<br />
This will actually rebuild the rootfs, including your new packages.<br />
<br />
[[Category:Applications]]<br />
[[Category:Platform]]</div>Bryce.Leohttp://wiki.openmoko.org/wiki/Create_an_ipk_package_from_sourcesCreate an ipk package from sources2007-07-28T18:19:38Z<p>Bryce.Leo: /* The recipe */</p>
<hr />
<div>This is a small tutorial to help people that want to write new software for Openmoko, eg. to port existing programs.<br />
<br />
==Theory==<br />
OpenMoko uses OpenEmbedded, a package and root image build system.<br />
<br />
OpenEmbedded provides patches and Bitbake Recipes, that are similar to .spec files to build RPM packages. Bitbake is used to process recipes and obtain packages and FS images. For example, bitbake can fetch sources, apply patches, configure, make and install compiled sources. Other steps are user definable, but this is not the scope of this tutorial.<br />
<br />
A standard use of bitbake is to download an existing "vanilla" package, ie "gcc" or "binutils" or "linux kernel", apply platform patches (adding bugfixes, porting fixes, drivers, etc...) then compile and package the resulting binaries.<br />
<br />
==Software versionning==<br />
Versions management is a very wide topic, there are tons of different opinions about it, I'll try to be quick.<br />
<br />
Packages versions are important in a distribution building mechanism, and package versions are a complete part of the full package name. They are obviously used to track important changes made to your package, and isolate each version. Here we must be a little aware of basic version management.<br />
Current (most advanced) version is named the "trunk". Additions, fixes, etc. are done to the trunk.<br />
<br />
Once a certain level of functionality is achieved, a copy of the trunk (a "snapshot") is taken, and named with a version number. As a result, current development continues on the trunk, but users can download well defined "releases", with known bugs and functionnality level. This is called "branching". If version specific bugs are found in version a.b, then we can update this branch independently.<br />
<br />
In bitbake, we must specify which release of our software we are going to package. This may not be an habit, especially if you only develop small programs, not maintained by more than one or two person. If your software is named "myprogram" but has no real version number attached, you can just rename your project directory to "myprogram-1.0".<br />
<br />
This is a good practice; If you are packaging a software, then it will be used by other people, so when you modify it next time, put it in a folder named "myprogram-1.1" :) This brings clarity to users, ease of management to you, and ability to plan future releases to your team.<br />
<br />
==Example==<br />
Say you have a working software package, ie a file system directory with sources, Makefile, etc...<br />
Because this is a common method, I will base my presentation on a project generated using autotools. This implies that the software can be installed somewhere by following the magical steps ./configure && make && make install.<br />
<br />
===Prerequisites===<br />
You need a configured openmoko development tree. All details are in [[Building OpenMoko from scratch]]<br />
<br />
The following commands will give you one, they are copied from the above page. Just copy and paste in a shell.<br />
<br />
<pre><br />
#prepare<br />
cd $HOME<br />
mkdir OM<br />
cd OM<br />
<br />
#get openembedded<br />
wget http://www.openembedded.org/snapshots/OE.mtn.bz2<br />
bunzip2 OE.mtn.bz2<br />
mtn --db=OE.mtn pull monotone.openembedded.org org.openembedded.dev<br />
mtn --db=OE.mtn checkout --branch=org.openembedded.dev -r e2dbb52fe39df7ef786b6068f6178f29508dfded openembedded<br />
<br />
#get openmoko<br />
svn co http://svn.openmoko.org/ openmoko<br />
<br />
#create local config<br />
mkdir -p sources build/conf<br />
cat <<EOF >build/conf/local.conf<br />
MACHINE = "fic-gta01"<br />
DISTRO = "openmoko"<br />
BUILD_ARCH = "`uname -m`"<br />
EOF<br />
<br />
#fixes (didnt try without them)<br />
ln -s openmoko/trunk/oe ./oe<br />
cd sources<br />
mkdir -p ../build/tmp/stamps/armv4t-linux<br />
wget http://ftp.mozilla.org/pub/mozilla.org/js/older-packages/js-1.5.tar.gz<br />
touch ../build/tmp/stamps/armv4t-linux/js-1.5-r0.do_fetch<br />
wget http://us4.samba.org/samba/ftp/stable/samba-3.0.14a.tar.gz<br />
touch ../build/tmp/stamps/armv4t-linux/samba-3.0.14a-r15.do_fetch<br />
perl -pi.orig -e 's/ *$//;s/\r//g' ../openembedded/packages/gcc/gcc-4.1.1/gcc-4.1.1-pr13685-1.patch<br />
</pre><br />
<br />
Then, you need the environment variables described here: [[Building_OpenMoko_from_scratch#Environment_variables]]<br />
Put the given lines in a script, then go to your build/ dir and source it:<br />
<pre><br />
cat <<EOF >doenv.sh<br />
#!/bin/sh<br />
export OMDIR=`pwd`<br />
export BBPATH=$OMDIR/build:$OMDIR/openmoko/trunk/oe:$OMDIR/openembedded<br />
EOF<br />
. ./doenv.sh<br />
</pre><br />
<br />
After this, your tree will look like that:<br />
<pre><br />
$HOME/OM<br />
+- build<br />
| +- conf<br />
| | +- local.conf<br />
+- openmoko<br />
+- openembedded<br />
+- sources<br />
+- env.sh<br />
</pre><br />
etc...<br />
<br />
===Proposed directory layout for our new packages===<br />
Bitbake recipes are single files describing how to build a package. I recommend to have a recipe for each package version (myprogram-1.0.bb, myprogram-1.1.bb, etc.) all stored in a directory named "myprogram"<br />
<br />
Our personal tree can be everywhere else:<br />
<pre><br />
$HOME<br />
+- $OMDIR (contains the official openmoko tree)<br />
| +- ...<br />
+- My_personal_OpenMoko_Packages<br />
| +- packages<br />
| +- myhello<br />
| +- myhello-1.0.bb<br />
+- My_Personal_Projects_Folder<br />
+- myhello<br />
+- myhello-1.0<br />
+- configure.ac<br />
+- Makefile.am<br />
+- ...<br />
</pre><br />
<br />
To do a simple test, pack your sources in a tar, and put this tar on a web server:<br />
<pre><br />
cd My_personal_Projects_Folder/myhello<br />
tar cvfz myhello-1.0.tar.gz myhello-1.0/<br />
</pre><br />
This is correct, ie the tarball will have a NAME-VERSION subdirectory, that's what we need.<br />
<br />
===The recipe===<br />
In the bitbake file, you need to give<br />
* a description for your package, variable name is DESCRIPTION<br />
* a package name (PN)<br />
* a package version (PV)<br />
* a source URI, I'll give details later<br />
* a source version, to checkout a particular revision of versionned trees<br />
* Please see the [http://www.openembedded.org/wiki/StyleGuide Open Embedded StyleGuide] which should answer most if not all questions about .bb file conventions.<br />
<br />
here's an example:<br />
<br />
<pre>#package description<br />
DESCRIPTION = "An example application for openmoko, depending on a custom source repository"<br />
SECTION = "squalyl/myhello"<br />
<br />
#this is optional<br />
LICENSE = "GPLv2"<br />
<br />
PN = "myhello"<br />
PV = "1.0"<br />
<br />
#use "now" to force svn updates at each build<br />
#Using now is a very dangerous way to do it. ONLY use this in your<br />
#personal recipes when you're doing heavy testing, otherwise<br />
#choose a stable date and stick with it that way when you distribute your recipe<br />
#you don't have all sorts of versions getting built out in the wild.<br />
SRCDATE_${PN} = "now"<br />
SRC_URI = "svn://repo/path/myhello;proto=https;module=${PN}-${PV}"<br />
<br />
#for a tarball use:<br />
#SRC_URI = "http://server/path/package/${PN}-{$PV}.tar.gz"<br />
<br />
#include standard rules to build a autoconf/automake package<br />
inherit autotools<br />
</pre><br />
<br />
Expressions starting by ${} are substituted, this allows you to download a tarball named "mypackage-1.0.tar.gz" for example<br />
<br />
=== Source URIs ===<br />
bitbake can get the source code for your project from a variety of locations including tarball, subversion and git.<br />
<br />
All of this is explained in the [http://bitbake.berlios.de/manual/ bitbake manual], particulary [http://bitbake.berlios.de/manual/ch03.html#id869590 here].<br />
<br />
The package build directory, the one where bitbake will run "configure" et al, will follow the name template: "PACKAGE_NAME-PACKAGE_VERSION", so<br />
<br />
* tarballs must extract to a subdirectory with this name<br />
* svn top directory must have this name<br />
<br />
It's very important. I spent 3 days blocking on this!<br />
<br />
===Tell bitbake to build our package===<br />
The only and one thing to do is edit $OMDIR/build/local.conf to tell bitbake to search our folders for .bb files:<br />
<pre><br />
BBFILES+="${HOME}/MypersonalOpenMokoPackages/packages/*/*.bb"<br />
</pre><br />
There is no need to change BBPATH or something else, this is only needed to add new configuration files, not recipes.<br />
<br />
Running<br />
<pre><br />
$ cd $OMDIR/build<br />
$ bitbake mypackage<br />
</pre><br />
will bring all the necessary operations to create a package in $OMDIR/build/tmp/deploy/ipk/armv4t/myhello .....<br />
<br />
The following is an example build log:<br />
<pre><br />
OE Build Configuration:<br />
BB_VERSION = "1.6.9"<br />
OE_REVISION = "<unknown>"<br />
TARGET_ARCH = "arm"<br />
TARGET_OS = "linux"<br />
MACHINE = "fic-gta01"<br />
DISTRO = "openmoko"<br />
DISTRO_VERSION = ".dev-snapshot-20070723"<br />
TARGET_FPU = "soft"<br />
<br />
NOTE: This BitBake doesn't support revision fetching, falling back to current date<br />
NOTE: preferred version 2.4 of glibc not available<br />
NOTE: preferred version 2.4 of glibc-intermediate not available<br />
NOTE: preferred version 2.4 of glibc not available<br />
NOTE: package myhello-1.0: started<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_fetch: started<br />
NOTE: Fetch svn://svn.unsads.com/squalyl/om/src/myhello;proto=https;module=myhello-1.0<br />
A myhello-1.0/configure.ac<br />
A myhello-1.0/include<br />
A myhello-1.0/include/config.h.in<br />
A myhello-1.0/cleanall.sh<br />
A myhello-1.0/AUTHORS<br />
A myhello-1.0/bootstrap.sh<br />
A myhello-1.0/ChangeLog<br />
A myhello-1.0/src<br />
A myhello-1.0/src/hello.c<br />
A myhello-1.0/Makefile.am<br />
A myhello-1.0/NEWS<br />
A myhello-1.0/README<br />
Révision 2116 extraite.<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_fetch: completed<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_unpack: started<br />
NOTE: Unpacking /home/squalyl/OM/sources/myhello-1.0_svn.unsads.com_.squalyl.om.src.myhello__now.tar.gz to /home/squalyl/OM/build/tmp/work/armv4t-linux/myhello-1.0-r0_0_200707231759/<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_unpack: completed<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_patch: started<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_patch: completed<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_configure: started<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_configure: completed<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_compile: started<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_compile: completed<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_install: started<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_install: completed<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_package: started<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_package: completed<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_package_write: started<br />
Packaged contents of myhello-dbg into /home/squalyl/OM/build/tmp/deploy/ipk/armv4t/myhello-dbg_1.0-r0_0_200707231759_armv4t.ipk<br />
Packaged contents of myhello into /home/squalyl/OM/build/tmp/deploy/ipk/armv4t/myhello_1.0-r0_0_200707231759_armv4t.ipk<br />
NOTE: Not creating empty archive for myhello-doc-1.0-r0_0_200707231759<br />
NOTE: Not creating empty archive for myhello-dev-1.0-r0_0_200707231759<br />
NOTE: Not creating empty archive for myhello-locale-1.0-r0_0_200707231759<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_package_write: completed<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_populate_staging: started<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_populate_staging: completed<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_build: started<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_build: completed<br />
NOTE: package myhello-1.0: completed<br />
NOTE: build 200707231952: completed<br />
Build statistics:<br />
Attempted builds: 1<br />
</pre><br />
<br />
===Get this package included in the rootfs image===<br />
<br />
bitbake openmoko-devel-image is used to build the entire distribution, but it does not include your new package in the rootfs image.<br />
<br />
To do this, use:<br />
<br />
<pre>bitbake openmoko-devel-image -crebuild</pre><br />
<br />
This will actually rebuild the rootfs, including your new packages.<br />
<br />
[[Category:Applications]]<br />
[[Category:Platform]]</div>Bryce.Leohttp://wiki.openmoko.org/wiki/Create_an_ipk_package_from_sourcesCreate an ipk package from sources2007-07-28T18:15:45Z<p>Bryce.Leo: /* The recipe */</p>
<hr />
<div>This is a small tutorial to help people that want to write new software for Openmoko, eg. to port existing programs.<br />
<br />
==Theory==<br />
OpenMoko uses OpenEmbedded, a package and root image build system.<br />
<br />
OpenEmbedded provides patches and Bitbake Recipes, that are similar to .spec files to build RPM packages. Bitbake is used to process recipes and obtain packages and FS images. For example, bitbake can fetch sources, apply patches, configure, make and install compiled sources. Other steps are user definable, but this is not the scope of this tutorial.<br />
<br />
A standard use of bitbake is to download an existing "vanilla" package, ie "gcc" or "binutils" or "linux kernel", apply platform patches (adding bugfixes, porting fixes, drivers, etc...) then compile and package the resulting binaries.<br />
<br />
==Software versionning==<br />
Versions management is a very wide topic, there are tons of different opinions about it, I'll try to be quick.<br />
<br />
Packages versions are important in a distribution building mechanism, and package versions are a complete part of the full package name. They are obviously used to track important changes made to your package, and isolate each version. Here we must be a little aware of basic version management.<br />
Current (most advanced) version is named the "trunk". Additions, fixes, etc. are done to the trunk.<br />
<br />
Once a certain level of functionality is achieved, a copy of the trunk (a "snapshot") is taken, and named with a version number. As a result, current development continues on the trunk, but users can download well defined "releases", with known bugs and functionnality level. This is called "branching". If version specific bugs are found in version a.b, then we can update this branch independently.<br />
<br />
In bitbake, we must specify which release of our software we are going to package. This may not be an habit, especially if you only develop small programs, not maintained by more than one or two person. If your software is named "myprogram" but has no real version number attached, you can just rename your project directory to "myprogram-1.0".<br />
<br />
This is a good practice; If you are packaging a software, then it will be used by other people, so when you modify it next time, put it in a folder named "myprogram-1.1" :) This brings clarity to users, ease of management to you, and ability to plan future releases to your team.<br />
<br />
==Example==<br />
Say you have a working software package, ie a file system directory with sources, Makefile, etc...<br />
Because this is a common method, I will base my presentation on a project generated using autotools. This implies that the software can be installed somewhere by following the magical steps ./configure && make && make install.<br />
<br />
===Prerequisites===<br />
You need a configured openmoko development tree. All details are in [[Building OpenMoko from scratch]]<br />
<br />
The following commands will give you one, they are copied from the above page. Just copy and paste in a shell.<br />
<br />
<pre><br />
#prepare<br />
cd $HOME<br />
mkdir OM<br />
cd OM<br />
<br />
#get openembedded<br />
wget http://www.openembedded.org/snapshots/OE.mtn.bz2<br />
bunzip2 OE.mtn.bz2<br />
mtn --db=OE.mtn pull monotone.openembedded.org org.openembedded.dev<br />
mtn --db=OE.mtn checkout --branch=org.openembedded.dev -r e2dbb52fe39df7ef786b6068f6178f29508dfded openembedded<br />
<br />
#get openmoko<br />
svn co http://svn.openmoko.org/ openmoko<br />
<br />
#create local config<br />
mkdir -p sources build/conf<br />
cat <<EOF >build/conf/local.conf<br />
MACHINE = "fic-gta01"<br />
DISTRO = "openmoko"<br />
BUILD_ARCH = "`uname -m`"<br />
EOF<br />
<br />
#fixes (didnt try without them)<br />
ln -s openmoko/trunk/oe ./oe<br />
cd sources<br />
mkdir -p ../build/tmp/stamps/armv4t-linux<br />
wget http://ftp.mozilla.org/pub/mozilla.org/js/older-packages/js-1.5.tar.gz<br />
touch ../build/tmp/stamps/armv4t-linux/js-1.5-r0.do_fetch<br />
wget http://us4.samba.org/samba/ftp/stable/samba-3.0.14a.tar.gz<br />
touch ../build/tmp/stamps/armv4t-linux/samba-3.0.14a-r15.do_fetch<br />
perl -pi.orig -e 's/ *$//;s/\r//g' ../openembedded/packages/gcc/gcc-4.1.1/gcc-4.1.1-pr13685-1.patch<br />
</pre><br />
<br />
Then, you need the environment variables described here: [[Building_OpenMoko_from_scratch#Environment_variables]]<br />
Put the given lines in a script, then go to your build/ dir and source it:<br />
<pre><br />
cat <<EOF >doenv.sh<br />
#!/bin/sh<br />
export OMDIR=`pwd`<br />
export BBPATH=$OMDIR/build:$OMDIR/openmoko/trunk/oe:$OMDIR/openembedded<br />
EOF<br />
. ./doenv.sh<br />
</pre><br />
<br />
After this, your tree will look like that:<br />
<pre><br />
$HOME/OM<br />
+- build<br />
| +- conf<br />
| | +- local.conf<br />
+- openmoko<br />
+- openembedded<br />
+- sources<br />
+- env.sh<br />
</pre><br />
etc...<br />
<br />
===Proposed directory layout for our new packages===<br />
Bitbake recipes are single files describing how to build a package. I recommend to have a recipe for each package version (myprogram-1.0.bb, myprogram-1.1.bb, etc.) all stored in a directory named "myprogram"<br />
<br />
Our personal tree can be everywhere else:<br />
<pre><br />
$HOME<br />
+- $OMDIR (contains the official openmoko tree)<br />
| +- ...<br />
+- My_personal_OpenMoko_Packages<br />
| +- packages<br />
| +- myhello<br />
| +- myhello-1.0.bb<br />
+- My_Personal_Projects_Folder<br />
+- myhello<br />
+- myhello-1.0<br />
+- configure.ac<br />
+- Makefile.am<br />
+- ...<br />
</pre><br />
<br />
To do a simple test, pack your sources in a tar, and put this tar on a web server:<br />
<pre><br />
cd My_personal_Projects_Folder/myhello<br />
tar cvfz myhello-1.0.tar.gz myhello-1.0/<br />
</pre><br />
This is correct, ie the tarball will have a NAME-VERSION subdirectory, that's what we need.<br />
<br />
===The recipe===<br />
In the bitbake file, you need to give<br />
* a description for your package, variable name is DESCRIPTION<br />
* a package name (PN)<br />
* a package version (PV)<br />
* a source URI, I'll give details later<br />
* a source version, to checkout a particular revision of versionned trees<br />
<br />
here's an example:<br />
<br />
<pre>#package description<br />
DESCRIPTION = "An example application for openmoko, depending on a custom source repository"<br />
SECTION = "squalyl/myhello"<br />
<br />
#this is optional<br />
LICENSE = "GPLv2"<br />
<br />
PN = "myhello"<br />
PV = "1.0"<br />
<br />
#use "now" to force svn updates at each build<br />
#Using now is a very dangerous way to do it. ONLY use this in your<br />
#personal recipes when you're doing heavy testing, otherwise<br />
#choose a stable date and stick with it that way when you distribute your recipe<br />
#you don't have all sorts of versions getting built out in the wild.<br />
SRCDATE_${PN} = "now"<br />
SRC_URI = "svn://repo/path/myhello;proto=https;module=${PN}-${PV}"<br />
<br />
#for a tarball use:<br />
#SRC_URI = "http://server/path/package/${PN}-{$PV}.tar.gz"<br />
<br />
#include standard rules to build a autoconf/automake package<br />
inherit autotools<br />
</pre><br />
<br />
Expressions starting by ${} are substituted, this allows you to download a tarball named "mypackage-1.0.tar.gz" for example<br />
<br />
=== Source URIs ===<br />
bitbake can get the source code for your project from a variety of locations including tarball, subversion and git.<br />
<br />
All of this is explained in the [http://bitbake.berlios.de/manual/ bitbake manual], particulary [http://bitbake.berlios.de/manual/ch03.html#id869590 here].<br />
<br />
The package build directory, the one where bitbake will run "configure" et al, will follow the name template: "PACKAGE_NAME-PACKAGE_VERSION", so<br />
<br />
* tarballs must extract to a subdirectory with this name<br />
* svn top directory must have this name<br />
<br />
It's very important. I spent 3 days blocking on this!<br />
<br />
===Tell bitbake to build our package===<br />
The only and one thing to do is edit $OMDIR/build/local.conf to tell bitbake to search our folders for .bb files:<br />
<pre><br />
BBFILES+="${HOME}/MypersonalOpenMokoPackages/packages/*/*.bb"<br />
</pre><br />
There is no need to change BBPATH or something else, this is only needed to add new configuration files, not recipes.<br />
<br />
Running<br />
<pre><br />
$ cd $OMDIR/build<br />
$ bitbake mypackage<br />
</pre><br />
will bring all the necessary operations to create a package in $OMDIR/build/tmp/deploy/ipk/armv4t/myhello .....<br />
<br />
The following is an example build log:<br />
<pre><br />
OE Build Configuration:<br />
BB_VERSION = "1.6.9"<br />
OE_REVISION = "<unknown>"<br />
TARGET_ARCH = "arm"<br />
TARGET_OS = "linux"<br />
MACHINE = "fic-gta01"<br />
DISTRO = "openmoko"<br />
DISTRO_VERSION = ".dev-snapshot-20070723"<br />
TARGET_FPU = "soft"<br />
<br />
NOTE: This BitBake doesn't support revision fetching, falling back to current date<br />
NOTE: preferred version 2.4 of glibc not available<br />
NOTE: preferred version 2.4 of glibc-intermediate not available<br />
NOTE: preferred version 2.4 of glibc not available<br />
NOTE: package myhello-1.0: started<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_fetch: started<br />
NOTE: Fetch svn://svn.unsads.com/squalyl/om/src/myhello;proto=https;module=myhello-1.0<br />
A myhello-1.0/configure.ac<br />
A myhello-1.0/include<br />
A myhello-1.0/include/config.h.in<br />
A myhello-1.0/cleanall.sh<br />
A myhello-1.0/AUTHORS<br />
A myhello-1.0/bootstrap.sh<br />
A myhello-1.0/ChangeLog<br />
A myhello-1.0/src<br />
A myhello-1.0/src/hello.c<br />
A myhello-1.0/Makefile.am<br />
A myhello-1.0/NEWS<br />
A myhello-1.0/README<br />
Révision 2116 extraite.<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_fetch: completed<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_unpack: started<br />
NOTE: Unpacking /home/squalyl/OM/sources/myhello-1.0_svn.unsads.com_.squalyl.om.src.myhello__now.tar.gz to /home/squalyl/OM/build/tmp/work/armv4t-linux/myhello-1.0-r0_0_200707231759/<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_unpack: completed<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_patch: started<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_patch: completed<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_configure: started<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_configure: completed<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_compile: started<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_compile: completed<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_install: started<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_install: completed<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_package: started<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_package: completed<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_package_write: started<br />
Packaged contents of myhello-dbg into /home/squalyl/OM/build/tmp/deploy/ipk/armv4t/myhello-dbg_1.0-r0_0_200707231759_armv4t.ipk<br />
Packaged contents of myhello into /home/squalyl/OM/build/tmp/deploy/ipk/armv4t/myhello_1.0-r0_0_200707231759_armv4t.ipk<br />
NOTE: Not creating empty archive for myhello-doc-1.0-r0_0_200707231759<br />
NOTE: Not creating empty archive for myhello-dev-1.0-r0_0_200707231759<br />
NOTE: Not creating empty archive for myhello-locale-1.0-r0_0_200707231759<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_package_write: completed<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_populate_staging: started<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_populate_staging: completed<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_build: started<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_build: completed<br />
NOTE: package myhello-1.0: completed<br />
NOTE: build 200707231952: completed<br />
Build statistics:<br />
Attempted builds: 1<br />
</pre><br />
<br />
===Get this package included in the rootfs image===<br />
<br />
bitbake openmoko-devel-image is used to build the entire distribution, but it does not include your new package in the rootfs image.<br />
<br />
To do this, use:<br />
<br />
<pre>bitbake openmoko-devel-image -crebuild</pre><br />
<br />
This will actually rebuild the rootfs, including your new packages.<br />
<br />
[[Category:Applications]]<br />
[[Category:Platform]]</div>Bryce.Leohttp://wiki.openmoko.org/wiki/Create_an_ipk_package_from_sourcesCreate an ipk package from sources2007-07-28T18:03:22Z<p>Bryce.Leo: /* The recipe */</p>
<hr />
<div>This is a small tutorial to help people that want to write new software for Openmoko, eg. to port existing programs.<br />
<br />
==Theory==<br />
OpenMoko uses OpenEmbedded, a package and root image build system.<br />
<br />
OpenEmbedded provides patches and Bitbake Recipes, that are similar to .spec files to build RPM packages. Bitbake is used to process recipes and obtain packages and FS images. For example, bitbake can fetch sources, apply patches, configure, make and install compiled sources. Other steps are user definable, but this is not the scope of this tutorial.<br />
<br />
A standard use of bitbake is to download an existing "vanilla" package, ie "gcc" or "binutils" or "linux kernel", apply platform patches (adding bugfixes, porting fixes, drivers, etc...) then compile and package the resulting binaries.<br />
<br />
==Software versionning==<br />
Versions management is a very wide topic, there are tons of different opinions about it, I'll try to be quick.<br />
<br />
Packages versions are important in a distribution building mechanism, and package versions are a complete part of the full package name. They are obviously used to track important changes made to your package, and isolate each version. Here we must be a little aware of basic version management.<br />
Current (most advanced) version is named the "trunk". Additions, fixes, etc. are done to the trunk.<br />
<br />
Once a certain level of functionality is achieved, a copy of the trunk (a "snapshot") is taken, and named with a version number. As a result, current development continues on the trunk, but users can download well defined "releases", with known bugs and functionnality level. This is called "branching". If version specific bugs are found in version a.b, then we can update this branch independently.<br />
<br />
In bitbake, we must specify which release of our software we are going to package. This may not be an habit, especially if you only develop small programs, not maintained by more than one or two person. If your software is named "myprogram" but has no real version number attached, you can just rename your project directory to "myprogram-1.0".<br />
<br />
This is a good practice; If you are packaging a software, then it will be used by other people, so when you modify it next time, put it in a folder named "myprogram-1.1" :) This brings clarity to users, ease of management to you, and ability to plan future releases to your team.<br />
<br />
==Example==<br />
Say you have a working software package, ie a file system directory with sources, Makefile, etc...<br />
Because this is a common method, I will base my presentation on a project generated using autotools. This implies that the software can be installed somewhere by following the magical steps ./configure && make && make install.<br />
<br />
===Prerequisites===<br />
You need a configured openmoko development tree. All details are in [[Building OpenMoko from scratch]]<br />
<br />
The following commands will give you one, they are copied from the above page. Just copy and paste in a shell.<br />
<br />
<pre><br />
#prepare<br />
cd $HOME<br />
mkdir OM<br />
cd OM<br />
<br />
#get openembedded<br />
wget http://www.openembedded.org/snapshots/OE.mtn.bz2<br />
bunzip2 OE.mtn.bz2<br />
mtn --db=OE.mtn pull monotone.openembedded.org org.openembedded.dev<br />
mtn --db=OE.mtn checkout --branch=org.openembedded.dev -r e2dbb52fe39df7ef786b6068f6178f29508dfded openembedded<br />
<br />
#get openmoko<br />
svn co http://svn.openmoko.org/ openmoko<br />
<br />
#create local config<br />
mkdir -p sources build/conf<br />
cat <<EOF >build/conf/local.conf<br />
MACHINE = "fic-gta01"<br />
DISTRO = "openmoko"<br />
BUILD_ARCH = "`uname -m`"<br />
EOF<br />
<br />
#fixes (didnt try without them)<br />
ln -s openmoko/trunk/oe ./oe<br />
cd sources<br />
mkdir -p ../build/tmp/stamps/armv4t-linux<br />
wget http://ftp.mozilla.org/pub/mozilla.org/js/older-packages/js-1.5.tar.gz<br />
touch ../build/tmp/stamps/armv4t-linux/js-1.5-r0.do_fetch<br />
wget http://us4.samba.org/samba/ftp/stable/samba-3.0.14a.tar.gz<br />
touch ../build/tmp/stamps/armv4t-linux/samba-3.0.14a-r15.do_fetch<br />
perl -pi.orig -e 's/ *$//;s/\r//g' ../openembedded/packages/gcc/gcc-4.1.1/gcc-4.1.1-pr13685-1.patch<br />
</pre><br />
<br />
Then, you need the environment variables described here: [[Building_OpenMoko_from_scratch#Environment_variables]]<br />
Put the given lines in a script, then go to your build/ dir and source it:<br />
<pre><br />
cat <<EOF >doenv.sh<br />
#!/bin/sh<br />
export OMDIR=`pwd`<br />
export BBPATH=$OMDIR/build:$OMDIR/openmoko/trunk/oe:$OMDIR/openembedded<br />
EOF<br />
. ./doenv.sh<br />
</pre><br />
<br />
After this, your tree will look like that:<br />
<pre><br />
$HOME/OM<br />
+- build<br />
| +- conf<br />
| | +- local.conf<br />
+- openmoko<br />
+- openembedded<br />
+- sources<br />
+- env.sh<br />
</pre><br />
etc...<br />
<br />
===Proposed directory layout for our new packages===<br />
Bitbake recipes are single files describing how to build a package. I recommend to have a recipe for each package version (myprogram-1.0.bb, myprogram-1.1.bb, etc.) all stored in a directory named "myprogram"<br />
<br />
Our personal tree can be everywhere else:<br />
<pre><br />
$HOME<br />
+- $OMDIR (contains the official openmoko tree)<br />
| +- ...<br />
+- My_personal_OpenMoko_Packages<br />
| +- packages<br />
| +- myhello<br />
| +- myhello-1.0.bb<br />
+- My_Personal_Projects_Folder<br />
+- myhello<br />
+- myhello-1.0<br />
+- configure.ac<br />
+- Makefile.am<br />
+- ...<br />
</pre><br />
<br />
To do a simple test, pack your sources in a tar, and put this tar on a web server:<br />
<pre><br />
cd My_personal_Projects_Folder/myhello<br />
tar cvfz myhello-1.0.tar.gz myhello-1.0/<br />
</pre><br />
This is correct, ie the tarball will have a NAME-VERSION subdirectory, that's what we need.<br />
<br />
===The recipe===<br />
In the bitbake file, you need to give<br />
* a description for your package, variable name is DESCRIPTION<br />
* a package name (PN)<br />
* a package version (PV)<br />
* a source URI, I'll give details later<br />
* a source version, to checkout a particular revision of versionned trees<br />
<br />
here's an example:<br />
<br />
<pre>#package description<br />
DESCRIPTION = "An example application for openmoko, depending on a custom source repository"<br />
SECTION = "squalyl/myhello"<br />
<br />
#this is optional<br />
LICENSE = "GPLv2"<br />
<br />
PN = "myhello"<br />
PV = "1.0"<br />
<br />
#use "now" to force svn updates at each build<br />
SRCDATE_${PN} = "now"<br />
SRC_URI = "svn://repo/path/myhello;proto=https;module=${PN}-${PV}"<br />
<br />
#for a tarball use:<br />
#SRC_URI = "http://server/path/package/${PN}-{$PV}.tar.gz"<br />
<br />
#include standard rules to build a autoconf/automake package<br />
inherit autotools<br />
</pre><br />
<br />
Expressions starting by ${} are substituted, this allows you to download a tarball named "mypackage-1.0.tar.gz" for example<br />
<br />
=== Source URIs ===<br />
bitbake can get the source code for your project from a variety of locations including tarball, subversion and git.<br />
<br />
All of this is explained in the [http://bitbake.berlios.de/manual/ bitbake manual], particulary [http://bitbake.berlios.de/manual/ch03.html#id869590 here].<br />
<br />
The package build directory, the one where bitbake will run "configure" et al, will follow the name template: "PACKAGE_NAME-PACKAGE_VERSION", so<br />
<br />
* tarballs must extract to a subdirectory with this name<br />
* svn top directory must have this name<br />
<br />
It's very important. I spent 3 days blocking on this!<br />
<br />
===Tell bitbake to build our package===<br />
The only and one thing to do is edit $OMDIR/build/local.conf to tell bitbake to search our folders for .bb files:<br />
<pre><br />
BBFILES+="${HOME}/MypersonalOpenMokoPackages/packages/*/*.bb"<br />
</pre><br />
There is no need to change BBPATH or something else, this is only needed to add new configuration files, not recipes.<br />
<br />
Running<br />
<pre><br />
$ cd $OMDIR/build<br />
$ bitbake mypackage<br />
</pre><br />
will bring all the necessary operations to create a package in $OMDIR/build/tmp/deploy/ipk/armv4t/myhello .....<br />
<br />
The following is an example build log:<br />
<pre><br />
OE Build Configuration:<br />
BB_VERSION = "1.6.9"<br />
OE_REVISION = "<unknown>"<br />
TARGET_ARCH = "arm"<br />
TARGET_OS = "linux"<br />
MACHINE = "fic-gta01"<br />
DISTRO = "openmoko"<br />
DISTRO_VERSION = ".dev-snapshot-20070723"<br />
TARGET_FPU = "soft"<br />
<br />
NOTE: This BitBake doesn't support revision fetching, falling back to current date<br />
NOTE: preferred version 2.4 of glibc not available<br />
NOTE: preferred version 2.4 of glibc-intermediate not available<br />
NOTE: preferred version 2.4 of glibc not available<br />
NOTE: package myhello-1.0: started<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_fetch: started<br />
NOTE: Fetch svn://svn.unsads.com/squalyl/om/src/myhello;proto=https;module=myhello-1.0<br />
A myhello-1.0/configure.ac<br />
A myhello-1.0/include<br />
A myhello-1.0/include/config.h.in<br />
A myhello-1.0/cleanall.sh<br />
A myhello-1.0/AUTHORS<br />
A myhello-1.0/bootstrap.sh<br />
A myhello-1.0/ChangeLog<br />
A myhello-1.0/src<br />
A myhello-1.0/src/hello.c<br />
A myhello-1.0/Makefile.am<br />
A myhello-1.0/NEWS<br />
A myhello-1.0/README<br />
Révision 2116 extraite.<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_fetch: completed<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_unpack: started<br />
NOTE: Unpacking /home/squalyl/OM/sources/myhello-1.0_svn.unsads.com_.squalyl.om.src.myhello__now.tar.gz to /home/squalyl/OM/build/tmp/work/armv4t-linux/myhello-1.0-r0_0_200707231759/<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_unpack: completed<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_patch: started<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_patch: completed<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_configure: started<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_configure: completed<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_compile: started<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_compile: completed<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_install: started<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_install: completed<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_package: started<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_package: completed<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_package_write: started<br />
Packaged contents of myhello-dbg into /home/squalyl/OM/build/tmp/deploy/ipk/armv4t/myhello-dbg_1.0-r0_0_200707231759_armv4t.ipk<br />
Packaged contents of myhello into /home/squalyl/OM/build/tmp/deploy/ipk/armv4t/myhello_1.0-r0_0_200707231759_armv4t.ipk<br />
NOTE: Not creating empty archive for myhello-doc-1.0-r0_0_200707231759<br />
NOTE: Not creating empty archive for myhello-dev-1.0-r0_0_200707231759<br />
NOTE: Not creating empty archive for myhello-locale-1.0-r0_0_200707231759<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_package_write: completed<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_populate_staging: started<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_populate_staging: completed<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_build: started<br />
NOTE: package myhello-1.0-r0_0_200707231759: task do_build: completed<br />
NOTE: package myhello-1.0: completed<br />
NOTE: build 200707231952: completed<br />
Build statistics:<br />
Attempted builds: 1<br />
</pre><br />
<br />
===Get this package included in the rootfs image===<br />
<br />
bitbake openmoko-devel-image is used to build the entire distribution, but it does not include your new package in the rootfs image.<br />
<br />
To do this, use:<br />
<br />
<pre>bitbake openmoko-devel-image -crebuild</pre><br />
<br />
This will actually rebuild the rootfs, including your new packages.<br />
<br />
[[Category:Applications]]<br />
[[Category:Platform]]</div>Bryce.Leohttp://wiki.openmoko.org/wiki/Wishlist/Text_InputWishlist/Text Input2007-07-20T16:02:49Z<p>Bryce.Leo: /* Interesting hardware input devices */</p>
<hr />
<div>Current version supports input using [[Input Method|on screen keyboard]].<br />
You can also use Bluetooth keyboards and with (battery) powered USB hub can also use USB keyboards.<br />
<br />
Near computer can also use networking over Bluetooth or USB and then ssh into device or run X11 programs remotely and thus use whatever input possibilities other computer supports.<br />
<br />
For further predictive text input information see: [http://en.wikipedia.org/wiki/Predictive_text Predictive text wikipedia]<br />
<br />
{{Wishlist}}<br />
<br />
===== New input methods =====<br />
* [http://patrickbaudisch.com/publications/2007-Vogel-CHI07-Shift.pdf Shift]<br />
* [http://www.inf.ufsc.br/~guy/text_input.html Another text input]<br />
* [http://www.inference.phy.cam.ac.uk/dasher/ Dasher] ([http://en.wikipedia.org/wiki/Dasher Wikipedia link]): A side-scrolling probabalistic text entry method that's well suited to stylus use. One disadvantage is that it makes little use of muscle memory so you need to pay close attention to the screen while entering text. An andvatage is that it is not limeted to english text, but can be used with any language/alphabet. A video presentation is also [http://video.google.com/videoplay?docid=5078334075080674416 available]<br />
* [http://www.micropp.se/openmoko/ Finger splash] (Idea presented on [http://lists.openmoko.org/pipermail/community/2007-March/003984.html OpenMoko community mailing list])<br />
* [http://www.strout.net/info/ideas/hexinput.html HexInput]: A keyboard-style input method optimized for stylus use.<br />
* [http://www.exideas.com/ME/faq.html MessagEaseST] ([http://www.youtube.com/watch?v=zFf9Mw3nlsY YouTube demo])<br />
* [http://en.wikipedia.org/wiki/Morse_code Morse Code]<br />
* [http://mrl.nyu.edu/projects/quikwriting/ Quikwriting]<br />
* [http://www.almaden.ibm.com/u/zhai/shapewriter.htm Shape Writing]<br />
* [http://lists.openmoko.org/pipermail/openmoko-devel/2007-May/000912.html Werner Almesberger's finger input suggestion] ([http://www.acc.umu.se/~cm/inw.pdf Draft layout as pdf] [http://www.almesberger.net/misc/openmoko/inwheel-1.tar.gz Prototype])<br />
* [http://www.hellkvist.org/software/ XMerlin]<br />
* [http://img.qj.net/uploads/articles_module/23876/12433_newkey1.jpg Danzeff Keyboard] A Keyboard designed for PSP, using the analog-stick<br />
<br />
===== Patented input methods =====<br />
* [http://depts.washington.edu/ewrite/ EdgeWrite], a unistroke character/word input method (reminiscent of Palm's Graffiti)<br />
* [http://www.fitaly.com/wince/pocketpcfitaly.htm Fitaly Keyboard]<br />
* [http://images.overstock.com/f/102/3117/8h/www.overstock.com/images/products/L10480944.jpg Input method used by Garmin] (Maybe patented?)<br />
* [http://www.speedscript.biz/ SpeedScript]<br />
* [http://en.wikipedia.org/wiki/T9_%28predictive_text%29 T9] See http://www.tegic.com/about/patent-list.asp for legally addability for users in some countries. <br />
* [http://www.tengo.net/ TenGO]<br />
* [http://www.agiletext.com/ AgileText]<br />
<br />
===== Text input method surveys =====<br />
<br />
Here are some surveys / overviews of text entry methods that I turned up using Google:<br />
* [http://www.dcs.gla.ac.uk/~jhw/text.html Text entry] A web page with a survey of text entry methods by John Williamson<br />
* Poika Isokoski, [http://www.cs.uta.fi/~poika/g/g.html A Minimal Device-Independent Text Input Method], has a chapter listing existing approaches ca. 1999<br />
<br />
===== Other ways to enter text =====<br />
* Once there is hardware with multi-touch screen support, [[Wishlist:Spell weaving|gesturing with 2-3 fingers]] might offer interesting possibilities.<br />
* Use [[VoiceText|voice to dictate text]]<br />
* Use [[Optical Character Recognition]] and [[Barcode Recognition]] on an image that exists on the file system or via a picture that has just been taken (even if it is a temporary picture only for this purpose).<br />
* [http://en.wikipedia.org/wiki/Speedwords Dutton Speedwords]<br />
<br />
===== Interesting hardware input devices =====<br />
* [http://mobilitysite.com/2007/02/small-compact-bluetooth-keyboard/ Credit-card sized bluetooth keyboard] (Note: apparently supports only Bluetooth Serial Port Profile and not HID; supportable, of course, perhaps using existing user space daemon [http://handhelds.org/moin/moin.cgi/kbdd kbdd] Link Fixed)<br />
* [http://www.thinkgeek.com/computing/input/8193/ Bluetooth laser virtual keyboard] eventually could be built into the phone once more miniaturized.<br />
* [http://www.thinkgeek.com/computing/input/6c82/ Frogpad]<br />
* [http://www.spartechnik.de/start.htm?d_Keyb_Mini_Mini_Bluetooth_Keyboard_im_Scheckkartenformat.htm Freedom Mini], apparently not manufactured anymore but still sold and works out of the box with Bluez' hidd. Has a spring-loaded hinge for squeezing a phone/PDA against the keyboard; seems like a Neo could attach nicely but don't have one to actually test. --[[User:Mjr|Mjr]] 10:30, 15 May 2007 (CEST)<br />
* [http://www.3pointd.com/20070518/finger-mounted-3d-mouse-from-undergrads/ experimental ring-mouse]<br />
* Livescribe's [http://www.livescribe.com/sneakpeek/index.html smartpen]; could act as touchscreen pen + laser + regular pen + "intelligent" pen + OCR device. See [http://www.pikesoft.com/blog/index.php?itemid=189 this] blog post.<br />
<br />
[[Category:User Interfaces]]</div>Bryce.Leo