Google Flutter for Yocto
Yocto Layer for Google Flutter related projects.
Variable | Description |
---|---|
FLUTTER_APPLICATION_PATH |
This is the path relative to the root of the repository. Override in your application recipe. |
FLUTTER_PREBUILD_CMD |
If set will run before Flutter build step. |
PUB_CACHE_EXTRA_ARCHIVE_CMD |
Command that is run prior to archive step of pub cache fetch. e.g. melos bootstrap. |
PUB_CACHE_EXTRA_ARCHIVE_PATH |
Appends a path to $PATH which affects PUB_CACHE_EXTRA_ARCHIVE_CMD |
APP_AOT_EXTRA |
Allows passing dart defines to AOT step. e.g. -DFLUTTER_APP_FLAVOR=prod . |
APP_AOT_ENTRY_FILE |
Allows overriding the entry file. Default is main.dart . |
APP_GEN_SNAPSHOT_FLAGS |
Additional flags to pass to gen_snapshot. Default is --obfuscate . |
FLUTTER_APP_RUNTIME_MODES |
Allows overriding modes that install app. Default is release . |
FLUTTER_APPLICATION_INSTALL_PREFIX |
Install prefix for flutter application install. Overriding enables installing into user directory. Default is ${datadir}/flutter . |
FLUTTER_APPLICATION_INSTALL_SUFFIX |
Install suffix for flutter application install. Default is "${PUBSPEC_APPNAME}". |
clang-layer
gnome-layer
Zenity is used for fileselector plugin on ivi-homescreen. To enable this add meta-gnome to your layers.
Target BSP is expected to have a GPU with OpenGLES v2.0+ support.
If you selecting a part go with v3.0+, ideally one with Vulkan support.
There are no OSS Linux embedders (that I am aware of that currently support software rendering). The engine does support it.
flutter-auto
is the agl
branch of https://github.com/toyota-connected/ivi-homescreen
the main
branch has moved to quarterly releases, the agl
branch is directly supporting AGL development work.
Targets flutter-engine-* is known to work on
Add to local.conf file:
TOOLCHAIN_HOST_TASK:append = " nativesdk-flutter-sdk"
Then run:
bitbake <image name> -c populate_sdk
Note: when using SDK you may need to add the following after installation:
$ export SDK_ROOT=<install folder>/sysroots/x86_64-nodistrosdk-linux/usr/share/flutter/sdk
$ git config --global --add safe.directory $SDK_ROOT
When building on systems with GCC version > than uninative in Yocto distro add the following to conf/local.conf
INHERIT:remove = "uninative"
Please visit here.
Append this to your conf/local.conf
IMAGE_INSTALL:append = " packagegroup-flutter-sdk-deps"
You will also need to add dev
packages to your platform that include libegl.so and libGLESv2.so. If the GPU driver for your platform is Mesa (such as Raspberry Pi 3/4/5), add these recipes to IMAGE_INSTALL in your conf/local.conf
:
libegl-mesa-dev
libgles3-mesa-dev
From target terminal
cd ~
git clone https://github.com/flutter/flutter
cd flutter/bin
export PATH=$PATH:`pwd`
export GDK_GL=gles
flutter config --no-enable-android
flutter config --no-enable-web
flutter channel stable
flutter doctor -v
Test gallery app
cd ~
git clone https://github.com/flutter/gallery
cd gallery
flutter run -d linux
Origin of truth for Flutter Applications:
conf/include/flutter-apps.json
Example roll
cd /mnt/raid10
git clone https://github.com/meta-flutter/meta-flutter
git clone https://github.com/meta-flutter/workspace-automation
cd workspace-automation
./roll_meta_flutter.py --path /mnt/raid10/meta-flutter --json /mnt/raid10/meta-flutter/conf/include/flutter-apps.json --patch-dir=/mnt/raid10/workspace-automation/patches
conf/include/releases_linux.json
conf/include/releases_linux.json
to determine the Flutter SDK stable version.conf/include/flutter-version.inc
with updated stable version.recipes-devtools/dart/dart-sdk_x.x.x.bb
recipes-platform/images/app-container-user/dev_profile
This file is the origin of truth for all of the Flutter Applications present in this layer, and is consumed by roll_meta_flutter.py.
roll_meta_flutter.py autogenerates all of the flutter application recipes.
If you need a more recent Rust toolchain for Kirkstone, you can use
https://git.yoctoproject.org/git/meta-lts-mixins
The takeaway should be that Cargo.lock and toolchain versions are tightly coupled in Yocto. If you don't follow this in theory you could set network enable for compile, and set the cargo bbclass to auto-vend. This would break all LTS scenarios.