yocto-第20篇-Toaster使用技巧(3)

By: fu linux
E-mail: fulinux@sina.com
Blog: https://blog.csdn.net/fulinus
喜欢的盆友欢迎点赞和订阅!
你的喜欢就是我写作的动力!

设置和使用Toaster

本地开发启动Toaster

前面我们在poky中进行了设置和Toaster安装了依赖的一些软件包,下面准备启动我们的Toaster了。其过程参考下面的命令:

[~]$ cd poky/
[poky]$ source oe-init-build-env
  • 1
  • 2

环境完成后:

[build]$ source toaster start
The system will start.

Check if toaster can listen on localhost:8000
OK

Operations to perform:
  Apply all migrations: admin, auth, bldcontrol, contenttypes, orm, sessions
Running migrations:
  Applying contenttypes.0001_initial... OK
  Applying auth.0001_initial... OK
  Applying admin.0001_initial... OK
  Applying admin.0002_logentry_remove_auto_add... OK
  Applying admin.0003_logentry_add_action_flag_choices... OK
  Applying contenttypes.0002_remove_content_type_name... OK
  Applying auth.0002_alter_permission_name_max_length... OK
  Applying auth.0003_alter_user_email_max_length... OK
  Applying auth.0004_alter_user_username_opts... OK
  Applying auth.0005_alter_user_last_login_null... OK
  Applying auth.0006_require_contenttypes_0002... OK
  Applying auth.0007_alter_validators_add_error_messages... OK
  Applying auth.0008_alter_user_username_max_length... OK
  Applying auth.0009_alter_user_last_name_max_length... OK
  Applying auth.0010_alter_group_name_max_length... OK
  Applying auth.0011_update_proxy_permissions... OK
  Applying orm.0001_initial... OK
  Applying bldcontrol.0001_initial... OK
  Applying bldcontrol.0002_auto_20160120_1250... OK
  Applying bldcontrol.0003_add_cancelling_state... OK
  Applying bldcontrol.0004_auto_20160523_1446... OK
  Applying bldcontrol.0005_reorder_buildrequest_states... OK
  Applying bldcontrol.0006_brlayer_local_source_dir... OK
  Applying bldcontrol.0007_brlayers_optional_gitinfo... OK
  Applying orm.0002_customimagerecipe... OK
  Applying orm.0003_customimagepackage... OK
  Applying orm.0004_provides... OK
  Applying orm.0005_task_field_separation... OK
  Applying orm.0006_add_cancelled_state... OK
  Applying orm.0007_auto_20160523_1446... OK
  Applying orm.0008_refactor_artifact_models... OK
  Applying orm.0009_target_package_manifest_path... OK
  Applying orm.0010_delete_layer_source_references... OK
  Applying orm.0011_delete_layersource... OK
  Applying orm.0012_use_release_instead_of_up_branch...Converting all layer version up_branches to releases
 OK
  Applying orm.0013_recipe_parse_progress_fields... OK
  Applying orm.0014_allow_empty_buildname... OK
  Applying orm.0015_layer_local_source_dir... OK
  Applying orm.0016_clone_progress... OK
  Applying orm.0017_distro_clone... OK
  Applying orm.0018_project_specific... OK
  Applying orm.0019_django_2_2... OK
  Applying sessions.0001_initial... OK

Build configuration saved
Loading default settings
Installed 7 object(s) from 1 fixture(s)
Loading poky configuration
Installed 36 object(s) from 1 fixture(s)
Importing custom settings if present
NOTE: optional fixture 'custom' not found

Fetching information from the layer index, please wait.
You can re-update any time later by running bitbake/lib/toaster/manage.py lsupdates

2020-11-17 19:59:27,435 INFO Fetching metadata for dunfell HEAD master zeus
/ #会阻塞在这里一段时间
Failure while trying to setup toaster: IncompleteRead(335202 bytes read, 14465633 more expected)
|Traceback (most recent call last):
  File "/home/peeta/poky/bitbake/lib/toaster/bldcontrol/management/commands/checksettings.py", line 123, in _verify_be
    call_command("lsupdates")
  File "/home/peeta/.local/lib/python3.5/site-packages/django/core/management/__init__.py", line 148, in call_command
    return command.execute(*args, **defaults)
  File "/home/peeta/.local/lib/python3.5/site-packages/django/core/management/base.py", line 364, in execute
    output = self.handle(*args, **options)
  File "/home/peeta/poky/bitbake/lib/toaster/orm/management/commands/lsupdates.py", line 290, in handle
    self.update()
  File "/home/peeta/poky/bitbake/lib/toaster/orm/management/commands/lsupdates.py", line 108, in update
    layerindex.load_layerindex("%s%s" % (self.apiurl, url_branches))
  File "/home/peeta/poky/bitbake/lib/layerindexlib/__init__.py", line 219, in load_layerindex
    indexEnt = plugin.load_index(indexURI, load)
  File "/home/peeta/poky/bitbake/lib/layerindexlib/restapi.py", line 41, in load_index
    return self.load_index_web(up, url, load)
  File "/home/peeta/poky/bitbake/lib/layerindexlib/restapi.py", line 259, in load_index_web
    username=up.username, password=up.password)
  File "/home/peeta/poky/bitbake/lib/layerindexlib/restapi.py", line 159, in _get_json_response
    parsed = json.loads(res.read().decode('utf-8'))
  File "/usr/lib/python3.5/http/client.py", line 475, in read
    s = self._safe_read(self.length)
  File "/usr/lib/python3.5/http/client.py", line 623, in _safe_read
    raise IncompleteRead(b''.join(s), amt)
http.client.IncompleteRead: IncompleteRead(335202 bytes read, 14465633 more expected)
Starting webserver...
Toaster development webserver started at http://localhost:8000

You can now run 'bitbake <target>' on the command line and monitor your build in Toaster.
You can also use a Toaster project to configure and run a build.

Successful start.
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99

浏览器中访问Toaster

按照上面的提示我们需要在运行Toaster服务的本地电脑上面的浏览器地址栏中输入如下地址:

http://localhost:8000
  • 1

读者盆友们可以在ubuntu系统中启动浏览器在地址栏中输入上面的地址访问Toaster。

我的内外中通过windows的浏览器无法访问这个地址,也许是防火墙问题导致的。
由于我的电脑是远程服务器,没有桌面环境直接操作,我可以通过下面两个方式访问网页。

使用w3m访问

先在自己的系统中安装w3m工具,如下:

sudo apt-get install w3m w3m-img -y 
  • 1

然后就可以通过如下命令访问:

w3m http://127.0.0.1:8000
  • 1

会显示如下页面:
在这里插入图片描述
不过效果肯定不如浏览器。

浏览器打开Toaster

并且打开浏览器后再其中输入Toaster的地址,显示结果截图如下:
在这里插入图片描述

项目编译演示

比如说我们在终端中开始bitbake一个项目,会看到对应的网页也会有一些进度条等信息:

[build]$ bitbake learnyocto
NOTE: ToasterUI waiting for events
NOTE: Bitbake server didn't start within 5 seconds, waiting for 90
NOTE: Resolving any missing task queue dependencies

Build Configuration:
BB_VERSION           = "1.46.0"
BUILD_SYS            = "x86_64-linux"
NATIVELSBSTRING      = "universal"
TARGET_SYS           = "x86_64-poky-linux"
MACHINE              = "qemux86-64"
DISTRO               = "poky"
DISTRO_VERSION       = "3.1.2"
TUNE_FEATURES        = "m64 core2"
TARGET_FPU           = ""
meta                 
meta-poky            
meta-yocto-bsp       = "my-yocto-3.1.2:569b1f5d67c57de957e243997c53ec2f81dc8dfe"
meta-altera          = "master:aa24dfcb39fce3619a87ee6eef6e4296e66d2099"
meta-mylayer         
workspace            = "my-yocto-3.1.2:569b1f5d67c57de957e243997c53ec2f81dc8dfe"

Sstate summary: Wanted 7 Found 0 Missed 7 Current 136 (0% match, 95% complete)
NOTE: Executing Tasks
NOTE: Logfile for task /home/peeta/poky/build/tmp/work/core2-64-poky-linux/learnyocto/1.0+gitAUTOINC+cac0e57e2f-r0/temp/log.do_fetch.10293
WARNING: Failed to fetch URL git://gitee.com/fulinux/learnyocto.git;protocol=https;branch=develop, attempting MIRRORS if available
ERROR: Fetcher failure: Unable to find revision cac0e57e2f8d79daf03dbe2a1dd477a93298d363 in branch develop even from upstream
ERROR: Fetcher failure for URL: 'git://gitee.com/fulinux/learnyocto.git;protocol=https;branch=develop'. Unable to fetch URL from any source.
NOTE: recipe learnyocto-1.0+gitAUTOINC+cac0e57e2f-r0: task do_fetch: Failed
ERROR: Task (/home/peeta/poky/meta-mylayer/recipes-learnyocto/learnyocto/learnyocto_git.bb:do_fetch) failed with exit code '1'
NOTE: Tasks Summary: Attempted 564 tasks of which 563 didn't need to be rerun and 1 failed.
NOTE: Writing buildhistory
NOTE: Writing buildhistory took: 1 seconds
NOTE: Build exited with errorcode 0
NOTE: buildinfohelper: All events saved
NOTE: Logging error 2: {'message': 'Failed to fetch URL git://gitee.com/fulinux/learnyocto.git;protocol=https;branch=develop, attempting MIRRORS if available', 'build': <Build: 1 Project object (1) learnyocto>, 'level': 1, 'lineno': 1740, 'pathname': '/home/peeta/poky/bitbake/lib/bb/fetch2/__init__.py'}
NOTE: Logging error 2: {'message': 'Fetcher failure: Unable to find revision cac0e57e2f8d79daf03dbe2a1dd477a93298d363 in branch develop even from upstream', 'build': <Build: 1 Project object (1) learnyocto>, 'level': 2, 'lineno': 1752, 'pathname': '/home/peeta/poky/bitbake/lib/bb/fetch2/__init__.py'}
NOTE: Logging error 2: {'message': "Fetcher failure for URL: 'git://gitee.com/fulinux/learnyocto.git;protocol=https;branch=develop'. Unable to fetch URL from any source.", 'build': <Build: 1 Project object (1) learnyocto>, 'level': 3, 'lineno': 113, 'pathname': '/home/peeta/poky/bitbake/lib/bb/__init__.py'}
NOTE: ToasterUI build done, brbe: None
WARNING: Return value is 0
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40

在这里插入图片描述
我这不里在构建learnyocto项目时出现了上面的错误,具体可以点击web上面的"2 errors":
在这里插入图片描述
提示我们的项目不能正常的获取代码,在develop分支中也没有相应的版本,可是之前怎么就没有发现这个问题呢,奇怪~
实事求是,出现错误也能更好的给用户演示错误异常情况的处理过程。

修改learnyocto的bb文件

build]$ devtool edit-recipe learnyocto
  • 1

会在vim中打开它的bb文件,如下:
poky/meta-mylayer/recipes-learnyocto/learnyocto/learnyocto_git.bb

# Recipe created by recipetool
# This is the basis of a recipe and may need further editing in order to be fully functional.
# (Feel free to remove these comments when editing.)

# WARNING: the following LICENSE and LIC_FILES_CHKSUM values are best guesses - it is
# your responsibility to verify that the values are complete and correct.
LICENSE = "LGPLv3"
LIC_FILES_CHKSUM = "file://LICENSE;md5=e6a600fd5e1d9cbde2d983680233ad02"

SRC_URI = "git://gitee.com/fulinux/learnyocto.git;protocol=https;branch=develop"

# Modify these as desired
PV = "1.0+git${SRCPV}"
SRCREV = "v1.1"

S = "${WORKDIR}/git"

inherit cmake

# Specify any options you want to pass to cmake using EXTRA_OECMAKE:
EXTRA_OECMAKE = ""
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21

我们可以将

SRC_URI = "git://gitee.com/fulinux/learnyocto.git;protocol=https;branch=develop"
  • 1

改成:

SRC_URI = "git://gitee.com/fulinux/learnyocto.git;protocol=https;branch=master"
  • 1

bitbake命令再编译

然后再次编译

build]$ bitbake learnyocto
NOTE: ToasterUI waiting for events
NOTE: Resolving any missing task queue dependencies

Build Configuration:
BB_VERSION           = "1.46.0"
BUILD_SYS            = "x86_64-linux"
NATIVELSBSTRING      = "universal"
TARGET_SYS           = "x86_64-poky-linux"
MACHINE              = "qemux86-64"
DISTRO               = "poky"
DISTRO_VERSION       = "3.1.2"
TUNE_FEATURES        = "m64 core2"
TARGET_FPU           = ""
meta                 
meta-poky            
meta-yocto-bsp       = "my-yocto-3.1.2:569b1f5d67c57de957e243997c53ec2f81dc8dfe"
meta-altera          = "master:aa24dfcb39fce3619a87ee6eef6e4296e66d2099"
meta-mylayer         
workspace            = "my-yocto-3.1.2:569b1f5d67c57de957e243997c53ec2f81dc8dfe"

Sstate summary: Wanted 7 Found 0 Missed 7 Current 136 (0% match, 95% complete)
NOTE: Executing Tasks
NOTE: Logfile for task /home/peeta/poky/build/tmp/work/core2-64-poky-linux/learnyocto/1.0+gitAUTOINC+cac0e57e2f-r0/temp/log.do_fetch.5191
NOTE: Logfile for task /home/peeta/poky/build/tmp/work/core2-64-poky-linux/learnyocto/1.0+gitAUTOINC+cac0e57e2f-r0/temp/log.do_fetch.5191
NOTE: Logfile for task /home/peeta/poky/build/tmp/work/core2-64-poky-linux/learnyocto/1.0+gitAUTOINC+cac0e57e2f-r0/temp/log.do_unpack.6461
NOTE: Logfile for task /home/peeta/poky/build/tmp/work/core2-64-poky-linux/learnyocto/1.0+gitAUTOINC+cac0e57e2f-r0/temp/log.do_prepare_recipe_sysroot.6465
NOTE: Logfile for task /home/peeta/poky/build/tmp/work/core2-64-poky-linux/learnyocto/1.0+gitAUTOINC+cac0e57e2f-r0/temp/log.do_unpack.6461
NOTE: Logfile for task /home/peeta/poky/build/tmp/work/core2-64-poky-linux/learnyocto/1.0+gitAUTOINC+cac0e57e2f-r0/temp/log.do_patch.7872
NOTE: Logfile for task /home/peeta/poky/build/tmp/work/core2-64-poky-linux/learnyocto/1.0+gitAUTOINC+cac0e57e2f-r0/temp/log.do_patch.7872
NOTE: Logfile for task /home/peeta/poky/build/tmp/work/core2-64-poky-linux/learnyocto/1.0+gitAUTOINC+cac0e57e2f-r0/temp/log.do_prepare_recipe_sysroot.6465
NOTE: Logfile for task /home/peeta/poky/build/tmp/work/core2-64-poky-linux/learnyocto/1.0+gitAUTOINC+cac0e57e2f-r0/temp/log.do_generate_toolchain_file.9578
NOTE: Logfile for task /home/peeta/poky/build/tmp/work/core2-64-poky-linux/learnyocto/1.0+gitAUTOINC+cac0e57e2f-r0/tem  log.do_generate_toolchain_file.9578
NOTE: Logfile for task /home/peeta/poky/build/tmp/work/core2-64-poky-linux/learnyocto/1.0+gitAUTOINC+cac0e57e2f-r0/temp/log.do_populate_lic.9580
NOTE: Logfile for task /home/peeta/poky/build/tmp/work/core2-64-poky-linux/learnyocto/1.0+gitAUTOINC+cac0e57e2f-r0/temp/log.do_deploy_source_date_epoch.9577
NOTE: Logfile for task /home/peeta/poky/build/tmp/work/core2-64-poky-linux/learnyocto/1.0+gitAUTOINC+cac0e57e2f-r0/temp/log.do_deploy_source_date_epoch.9577
NOTE: Logfile for task /home/peeta/poky/build/tmp/work/core2-64-poky-linux/learnyocto/1.0+gitAUTOINC+cac0e57e2f-r0/temp/log.do_populate_lic.9580
NOTE: Logfile for task /home/peeta/poky/build/tmp/work/core2-64-poky-linux/learnyocto/1.0+gitAUTOINC+cac0e57e2f-r0/temp/log.do_configure.10399
NOTE: Logfile for task /home/peeta/poky/build/tmp/work/core2-64-poky-linux/learnyocto/1.0+gitAUTOINC+cac0e57e2f-r0/temp/log.do_configure.10399
NOTE: Logfile for task /home/peeta/poky/build/tmp/work/core2-64-poky-linux/learnyocto/1.0+gitAUTOINC+cac0e57e2f-r0/temp/log.do_compile.12768
NOTE: Logfile for task /home/peeta/poky/build/tmp/work/core2-64-poky-linux/learnyocto/1.0+gitAUTOINC+cac0e57e2f-r0/temp/log.do_compile.12768
NOTE: Logfile for task /home/peeta/poky/build/tmp/work/core2-64-poky-linux/learnyocto/1.0+gitAUTOINC+cac0e57e2f-r0/temp/log.do_install.13745
NOTE: Logfile for task /home/peeta/poky/build/tmp/work/core2-64-poky-linux/learnyocto/1.0+gitAUTOINC+cac0e57e2f-r0/temp/log.do_install.13745
NOTE: Logfile for task /home/peeta/poky/build/tmp/work/core2-64-poky-linux/learnyocto/1.0+gitAUTOINC+cac0e57e2f-r0/temp/log.do_populate_sysroot.14171
NOTE: Logfile for task /home/peeta/poky/build/tmp/work/core2-64-poky-linux/learnyocto/1.0+gitAUTOINC+cac0e57e2f-r0/temp/log.do_package.14170
NOTE: Logfile for task /home/peeta/poky/build/tmp/work/core2-64-poky-linux/learnyocto/1.0+gitAUTOINC+cac0e57e2f-r0/temp/log.do_populate_sysroot.14171
NOTE: Logfile for task /home/peeta/poky/build/tmp/work/core2-64-poky-linux/learnyocto/1.0+gitAUTOINC+cac0e57e2f-r0/temp/log.do_package.14170
NOTE: Logfile for task /home/peeta/poky/build/tmp/work/core2-64-poky-linux/learnyocto/1.0+gitAUTOINC+cac0e57e2f-r0/temp/log.do_packagedata.18511
NOTE: Logfile for task /home/peeta/poky/build/tmp/work/core2-64-poky-linux/learnyocto/1.0+gitAUTOINC+cac0e57e2f-r0/temp/log.do_packagedata.18511
NOTE: Logfile for task /home/peeta/poky/build/tmp/work/core2-64-poky-linux/learnyocto/1.0+gitAUTOINC+cac0e57e2f-r0/temp/log.do_package_write_rpm.19217
NOTE: Logfile for task /home/peeta/poky/build/tmp/work/core2-64-poky-linux/learnyocto/1.0+gitAUTOINC+cac0e57e2f-r0/temp/log.do_package_qa.19219
NOTE: Logfile for task /home/peeta/poky/build/tmp/work/core2-64-poky-linux/learnyocto/1.0+gitAUTOINC+cac0e57e2f-r0/temp/log.do_package_qa.19219
NOTE: Logfile for task /home/peeta/poky/build/tmp/work/core2-64-poky-linux/learnyocto/1.0+gitAUTOINC+cac0e57e2f-r0/temp/log.do_package_write_rpm.19217
NOTE: Tasks Summary: Attempted 579 tasks of which 563 didn't need to be rerun and all succeeded.
NOTE: Writing buildhistory
NOTE: Writing buildhistory took: 4 seconds
NOTE: Build exited with errorcode 0
NOTE: ToasterUI build done, brbe: None
WARNING: Return value is 0
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59

web状态更新

有时候需要手动刷新下页面:
编译过程:
在这里插入图片描述
完成状态:
在这里插入图片描述
各种信息:
在这里插入图片描述
还是非常方便的,对于新手而言,web操作还是非常简单。