## # Yocto Project Dev Day ELCE 2017, Prague # devtool session # Tim Orling ## # excercise 0 # preparing build dir cd /scratch ls . ./poky/oe-init-build-env build-devday # use pre-populated downloads sed -i -e 's:#DL_DIR ?= "${TOPDIR}/downloads":DL_DIR ?= "/scratch/downloads":g' conf/local.conf # use pre-populated sstate-cache sed -i -e 's:#SSTATE_DIR ?= "${TOPDIR}/sstate-cache":SSTATE_DIR ?= "/scratch/sstate-cache":g' conf/local.conf # set machine to qemuarm sed -i -e 's:#MACHINE ?= "qemuarm":MACHINE ?= "qemuarm":g' conf/local.conf # create a layer where we will put some our new recipe(s) pushd .. yocto-layer create foo popd # add our new layer to our BBLAYERS bitbake-layers add-layer ../meta-foo ## # excercise 1 # using devtool add ls # create a workspace (a sandbox layer for our work) devtool create-workspace workspace ls find workspace # build core-image-minimal (from pre-populated sstate-cache) devtool build-image core-image-minimal # add nano devtool add nano https://www.nano-editor.org/dist/v2.7/nano-2.7.4.tar.xz ls workspace find workspace/recipes pushd workspace/sources/nano/ git log popd devtool build nano # rebuild our image with our new recipe installed devtool build-image core-image-minimal runqemu slirp nographic qemuarm # login as root (no password) nano # Ctrl-x to exit nano ls /usr/bin/nano exit # Ctrl-a x to exit qemu # move our recipe into our layer devtool finish nano ../meta-foo # cleanup rm -rf workspace/sources/nano ## # excercise 2 # devtool modify pwd # should be in /scratch/build-devday # # reinforce what we have learned, add "hello" devtool add hello https://ftp.gnu.org/gnu/hello/hello-2.10.tar.gz devtool build hello devtool build-image core-image-minimal runqemu slirp nographic qemuarm # login as root (no password) hello exit # finish the recipe (and then we will modify it) devtool finish hello ../meta-foo # clean up workspace rm -rf workspace/sources/hello # modify source pushd workspace/sources/hello # change world to Prague sed -i -e 's:"Hello, world!":"Hello, Prague!":g' src/hello.c git log git commit -m "Change world to Prague" # may need to let git know who you are # git config --global user.email "you@example.com" # git config --global user.name "Your Name" git log devtool build-image core-image-minimal runqemu slirp nographic qemuarm hello exit # finish our modification popd devtool finish hello ../meta-foo # review what changed pushd ../meta-foo/recipes-hello/hello ls cat hello_2.10.bb cat hello_%.bbappend cat hello/0001-Change-world-to-Prague.patch popd # cleanup rm -rf workspace/sources/hello # excercise 3 # devtool upgrade devtool upgrade nano --version 2.8.7 # fix srcuri so it will work with 2.8.x # there is a bug open to add the ability to change fetchuri sed -i -e 's:v2.7:v2.8:g' ../meta-foo/recipes-nano/nano/nano_2.7.4.bb # cleanup our failed attempt rm -rf workspace/sources/nano # actually upgrade devtool upgrade nano --version 2.8.7 ls workspace/recipes/nano/ cat workspace/recipes/nano/nano_2.8.7.bb # test it devtool build-image core-image-minimal runqemu slirp nographic qemuarm # login as root (no password) nano # Ctrl-x to exit nano exit # Ctrl-a x to exit qemu # finish devtool finish nano ../meta-foo # cleanup rm -rf workspace/sources/nano # Profit!