Can Board Bring Up Be Less Painful Insop Song
Can Board Bring Up Be Less Painful Insop Song
Can Board Bring Up Be Less Painful Insop Song
Insop Song
Gainspeed, Inc.
Agenda
Customizing yocto
kernel
u-boot
Working
with
community
Yocto
RFS
Flash
partition
https://www.flickr.com/photos/bruceywan/7003668685
U-Boot ?
● primary boot loader for embedded system
– DDR memory config
– Network config
– Flash access
– Peripheral (gpio, i2c, spi..) drivers
– Load OS
How to customize U-Boot?
● Start with similar boards' config insop@sputnik ~/Projects/fsl-u-boot/include/configs(develop) $ ls
A3000.h ELPT860.h MPC837XEMDS.h r7780mp.h
– Edit your own config files a320evb.h enbw_cmc.h MPC837XERDB.h Rattler.h
● include/configs a3m071.h eNET.h MPC8536DS.h RBC823.h
a4m072.h ep8248.h MPC8540ADS.h rd6281a.h
...
[1] http://elinux.org/Device_Tree
[2] http://events.linuxfoundation.org/sites/events/files/slides/petazzoni-device-tree-dummies.pdf
Device tree
● Helper scripts
– $mkdtb.sh
● to compile dtb file and generate a single .dts file
● https://raw.githubusercontent.com/insop/presentation/master/elc_14/scripts/mkdtb.sh
– $mkdts.sh
● to generate .dts file from .dtb file
● https://raw.githubusercontent.com/insop/presentation/master/elc_14/scripts/mkdts.sh
Yocto project
● Yocto: allow you to create embedded linux
distribution, based on OE, bitbake
– Kernel build
– Root file system generation
– Package management
– Yocto quick start
● https://www.yoctoproject.org/docs/current/yocto-project-qs/yocto-project-qs.html
Yocto quick start
● Setup development machines
– Native linux or VM
● Configure local.conf file
– BB_NUMBER_THREADS = "8"
– PARALLEL_MAKE = "-j 8"
– MACHINE ?= "beagleboard"
– DL_DIR: for downloading tarballs and source fetch
– SSTATE_DIR: shared state dir
● Run bitbake commands
– $ bitbake core-image-minimal
-c : command // fetchall, compile, build, configure, clean, cleansstate, cleanall, install, patch
http://www.openembedded.org/wiki/List_of_Executable_tasks
-f : force the specified task
● Generates file systems
– ext3, tar.bz2, jffs2
● Generates packages
– rpm, deb, ipkg
Yocto 101
● Yocto is consist of
– meta-* layers
– Sample: meta-skeleton
– meta-* layers is consist of 'recipes'
● Recipes: .bb and .conf files
● Samples: meta-skeleton/recipes-skeleton/
– Can add custom meta layers to append rules
~/yocto/meta-skeleton/recipes-skeleton/service(develop) $ tree
.
├── service
│ ├── COPYRIGHT
│ ├── skeleton
│ └── skeleton_test.c
└── service_0.1.bb
Customize image, yocto
● Modify the image to select packages that you need
● Start with known minimal reference image(s)
– $bitbake fsl-image-core
● http://git.freescale.com/git/cgit.cgi/ppc/sdk/meta-fsl-networking.git/plain/images/fsl-image-core.bb
●
https://raw.githubusercontent.com/insop/presentation/master/elc_14/example/fsl-yocto/meta-fsl-networking/images/fsl-imag
● Machine type
– $ conf/machine/p1020mbg.conf
● http://git.freescale.com/git/cgit.cgi/ppc/sdk/meta-fsl-ppc.git/plain/conf/machine/p1020mbg.conf
That's great, now what?
● What to follow after creating a minimal image
(RFS) for your board?
– Add/config existing programs/servers
– Customize init process (init.d)
– Add your own lib/programs
Add/config existing programs
● Example1
– logrotate: rotate/compress log files
– Add program to the image first
● https://raw.githubusercontent.com/insop/presentation/master/elc_14/example/fsl-yocto/meta-fsl-networking/images/fsl-image-ex.bb
– logrotate recipe
●
http://git.freescale.com/git/cgit.cgi/ppc/sdk/poky.git/tree/meta/recipes-extended/logrotate
●
https://raw.githubusercontent.com/insop/presentation/master/elc_14/example/fsl-yocto/meta-fsl-networking/recipes-append/logrotate/files/logrotate-default.patch
dtb 2
Config 1
Linux kernel 2
dtb2
Config 2
Working together with the
community
● Applications
– Github hosted projects
● ex> linenoise: simple cli (command line interface) library
– https://github.com/antirez/linenoise/pull/53/files
– Yocto
● Use mailing list, very active and helpful
● ex> meta-realtime: to test sched-deadline
– http://git.yoctoproject.org/cgit/cgit.cgi/meta-realtime/
Working with kernel delopers
● Existing driver fixes
– https://lkml.org/lkml/2014/4/16/635
– http://www.spinics.net/lists/kernel/msg1732810.html
● Add a new driver
– drivers/stagging is the place to start
– https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/drivers/staging/gs_fpgaboot?id=refs/tags/v3.15-rc
Chip manufacturer provided kernel
● You will work with kernel that chip
manufacturer provided
– Had tried to work with them by send them patches
● Mostly ignored
● Wanted process as customer support cases
– Issues of lack of ownership
Conclusion
● With open source projects, board brining up
can be less painful
● Work together with the community
● Thank you
● Question?