Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cbrake/master #58

Merged
merged 6 commits into from
Nov 20, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ Additional machines can be added by including appropriate BSP layers.
This is where all the magic happens. In general, this build system
must be run in a bash shell. To set up the environment, source the following file:

`. ./\<machine\>-envsetup.sh`
`. ./<machine>-envsetup.sh`

Or, you can export a MACHINE environment variable, and then source envsetup.sh.

Expand Down Expand Up @@ -124,12 +124,7 @@ as parallel build options.

Sometimes you want to install packages you build on the target system
without building and re-installing the entire rootfs. This can be done
using a feed server.

- Workstation: `yoe_feed_server` (this starts a feed server on port 4000)
- Target: modify /etc/opkg to http://[your workstation IP]:4000
- Target: `opkg update`
- Target: `opkg install [package]`
using a [feed server](docs/packages.md).

This advantage of a feed server versus scp'ing opkg files to the target
and installing manually is that dependencies will automatically get installed.
Expand Down
4 changes: 3 additions & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ included for some of them below.

## Using Yoe

- [Working with git submodules](git-submodules.md)
- [Docker Integration](docker.md)
- [Packages](packages.md) - information on installing packages from your build directory
in a development scenario.
- [Working with git submodules](git-submodules.md)

## Image Configuration

Expand Down
49 changes: 49 additions & 0 deletions docs/packages.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Packages

[up](README.md)

During an image build, OpenEmbedded builds all software into packages, which are then
combined into a rootfs. One benefit of this is you can install packages later into a
running system, much like you would a desktop distribution like Debian, Ubuntu, Arch,
etc. OE supports the RPM, DEB, and IPK package formats, and the format can be set using the
[PACKAGE_CLASSES](https://www.yoctoproject.org/docs/latest/mega-manual/mega-manual.html#var-PACKAGE_CLASSES)
variable.

## Installing packages from a local build

You can install packages directly from your local OE build onto a target system with the
following procedure:

- packaging information must be included in the target image:
- `IMAGE_FEATURES += "packages-management"`
- a ssh server must be enabled in the target image:
- `IMAGE_FEATURES += "ssh-server-dropbear"`
- target system just be on the same network as your build computer.
- run `yoe_setup_feed_server <target ip address>`. This configures the target to fetch packages
from your build computer. Alternatively you can set the MACHINE_IP environment variable.
- run `yoe_feed_server`. This starts a web server that serves packages.
- on target system, run:
- `opkg update`
- `opkg list` (list packages available)
- `opkg install python3` (install python3)

If the package is not built yet, simply:

- `bitbake <recipe for package to install>`
- `bitbake package-index` (required to rebuild the package index)
- on target:
- `opkg update`
- `opkg install <package>`

This technique is very useful for testing new packages, or for installing packages that
are only needed for development that you don't want to include in production images
(strace, gdb, testing tools, etc). Dependencies are automatically handled by the package
manager.

For larger development teams or field deployments, you might want to set up a feed server
to serve packages to any connected device.

See also:

- https://www.yoctoproject.org/docs/latest/mega-manual/mega-manual.html#package-feeds-dev-environment
- https://www.yoctoproject.org/docs/latest/ref-manual/ref-manual.html#var-FEED_DEPLOYDIR_BASE_URI
30 changes: 24 additions & 6 deletions envsetup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -284,23 +284,42 @@ _EOF
yoe_feed_server() {
SAVEDPWD=$PWD
cd $OE_BASE
bitbake package-index
bitbake package-index || return 1
cd build/tmp/deploy/ipk
python3 -m http.server 8000
cd $SAVEDPWD
}

yoe_host_ip() {
hostname -i | cut -d' ' -f 1
}

yoe_setup_feed_server() {
if [ -n "$1" ]; then
MIP=$1
else
if [ -z "$MACHINE_IP" ]; then
echo
echo "Error: Machine IP address not given"
echo "Usage: yoe_setup_feed_server <machine ip>"
echo " or set the MACHINE_IP env variable"
echo
return 1
fi
MIP=$MACHINE_IP
fi
# set TARGET_IP in local.sh
# set HOST_IP in local.sh if different
if [ -n "${HOST_IP}" ]; then
if [ -z "${HOST_IP}" ]; then
HOST_IP=$(hostname -i | cut -d' ' -f 1)
fi
ssh root@$MACHINE_IP ls /etc/opkg/base-feeds.conf >/dev/null 2>&1
ssh root@$MIP ls /etc/opkg/base-feeds.conf >/dev/null 2>&1
if [ $? -ne 0 ]; then
echo "opkg is not installed, can't setup feeds on machine $MACHINE_IP"
echo "opkg is not installed, can't setup feeds on machine $MIP"
else
ssh root@$MACHINE_IP "sed -i -e 's|http://.*\/|http://$HOST_IP:8000/|' /etc/opkg/base-feeds.conf"
SERVER=http://$HOST_IP:8000
echo "pointing feeds to $SERVER"
ssh root@$MIP "sed -i -e 's|http://.*\/|${SERVER}/|' /etc/opkg/base-feeds.conf"
fi
}

Expand Down Expand Up @@ -395,7 +414,6 @@ yoe_clean_sstate() {

if [ -z "$DOCKER_REPO" ]; then
echo "Setting DOCKER_REPO to yoedistro/yoe-build:stretch"
echo "set DOCKER_REPO to 'none' to disable docker"
export DOCKER_REPO=yoedistro/yoe-build:stretch
fi

Expand Down