Compare commits
403 Commits
1.2_M1.fin
...
bernard
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c006044611 | ||
|
|
69cf476e36 | ||
|
|
0283822752 | ||
|
|
15c05fc10c | ||
|
|
cc6e20ea98 | ||
|
|
fc7f4b9711 | ||
|
|
4f1611cb8d | ||
|
|
5347bf352b | ||
|
|
d81e13a138 | ||
|
|
3d9db8b275 | ||
|
|
3faa84f835 | ||
|
|
10a8fb437e | ||
|
|
2c24e6b9b9 | ||
|
|
7f0a98f9ee | ||
|
|
47b2f03955 | ||
|
|
a02537187f | ||
|
|
78d092fe7a | ||
|
|
361eda901c | ||
|
|
373d73c7e7 | ||
|
|
b154d10232 | ||
|
|
00af854e96 | ||
|
|
4005aaf3f8 | ||
|
|
5c78a2b02d | ||
|
|
11355f3a7f | ||
|
|
a2283defe2 | ||
|
|
7ce789de38 | ||
|
|
4194c83a56 | ||
|
|
decb8953cd | ||
|
|
d6b531e6a1 | ||
|
|
d412b923ac | ||
|
|
cb69e75b7b | ||
|
|
9b33f20a73 | ||
|
|
00a8552b2b | ||
|
|
ec3aab7b04 | ||
|
|
5c51a88346 | ||
|
|
53bbe30ee7 | ||
|
|
1ca2d4316e | ||
|
|
87d0a3b594 | ||
|
|
c2c0b9f861 | ||
|
|
d1c356ad3d | ||
|
|
4f5622fb01 | ||
|
|
9ee10c93af | ||
|
|
490b71d15d | ||
|
|
60f42f2dc9 | ||
|
|
4dab699e96 | ||
|
|
1ca9ca2c7d | ||
|
|
5359255ce2 | ||
|
|
c9805a0c3c | ||
|
|
3545f453aa | ||
|
|
2319b2d2d7 | ||
|
|
da22a78bd4 | ||
|
|
0a69e60cfc | ||
|
|
2816cc0db8 | ||
|
|
c998000630 | ||
|
|
bf8d577f1d | ||
|
|
e3e50d2c69 | ||
|
|
e5cce8a57d | ||
|
|
bb855dab75 | ||
|
|
7779a1fedc | ||
|
|
1c5171b251 | ||
|
|
5eabb17202 | ||
|
|
b3cb28df9f | ||
|
|
14c9af0056 | ||
|
|
d106d15cad | ||
|
|
72f06800bc | ||
|
|
53b15f2732 | ||
|
|
1b159ff35d | ||
|
|
eabe47ed8c | ||
|
|
5299510bd3 | ||
|
|
679e3ae6de | ||
|
|
6619eff40b | ||
|
|
4e41793b5c | ||
|
|
5b1d38c0ed | ||
|
|
67ef061d39 | ||
|
|
5d3bfbbd18 | ||
|
|
36c9135215 | ||
|
|
437950723f | ||
|
|
5f92b6262f | ||
|
|
65d61e2d11 | ||
|
|
4825604977 | ||
|
|
00996de4eb | ||
|
|
5a9b3fecde | ||
|
|
2343f81fb4 | ||
|
|
d8f4a33500 | ||
|
|
a982aa5786 | ||
|
|
8404b657fa | ||
|
|
e4ab64389e | ||
|
|
9c43741ed6 | ||
|
|
586b7055b3 | ||
|
|
0401043d43 | ||
|
|
40a6a2612e | ||
|
|
2060a0d1f2 | ||
|
|
23a0019b1f | ||
|
|
aa37762223 | ||
|
|
5570e0ae78 | ||
|
|
310897df07 | ||
|
|
ca77772632 | ||
|
|
b8765d4efb | ||
|
|
c36361ed5a | ||
|
|
60ab27d71b | ||
|
|
d739fc53eb | ||
|
|
84d82c0685 | ||
|
|
9361df5ec2 | ||
|
|
5ec8233e2f | ||
|
|
c7301228c0 | ||
|
|
f77efdf544 | ||
|
|
f15a4a7677 | ||
|
|
0e55651fd0 | ||
|
|
8c888bf67a | ||
|
|
6f904b3550 | ||
|
|
5d01c9c296 | ||
|
|
55f72863b9 | ||
|
|
e086bc7c11 | ||
|
|
aa468ee163 | ||
|
|
94d2b2c563 | ||
|
|
f837ecebc6 | ||
|
|
dfb31f15b9 | ||
|
|
6bfb96bff3 | ||
|
|
88083714e3 | ||
|
|
2bd9b41760 | ||
|
|
e5f8d44d24 | ||
|
|
a3ed4e19e1 | ||
|
|
16c10b7a8d | ||
|
|
ce08910d62 | ||
|
|
d2492a6ee2 | ||
|
|
a05ffe7e61 | ||
|
|
05d95c7feb | ||
|
|
22a4bae306 | ||
|
|
dd99bbf1f3 | ||
|
|
6e902e0a31 | ||
|
|
1e10a0cf03 | ||
|
|
98820f5b74 | ||
|
|
e8486ec930 | ||
|
|
c0a58abed5 | ||
|
|
41d9bcdabe | ||
|
|
58e3304ea0 | ||
|
|
eb83549448 | ||
|
|
fdd4dc5db9 | ||
|
|
32d330889f | ||
|
|
a6620f2fcf | ||
|
|
8e4021a890 | ||
|
|
10a0dca45a | ||
|
|
347bbd1d4b | ||
|
|
da39a264ed | ||
|
|
292488656d | ||
|
|
6683544362 | ||
|
|
5ac1d6be71 | ||
|
|
97b223c6fc | ||
|
|
96bc30cf03 | ||
|
|
1d8535ccb7 | ||
|
|
6244cbc945 | ||
|
|
f76a807400 | ||
|
|
b1febbcb26 | ||
|
|
24b30e5285 | ||
|
|
47724b4320 | ||
|
|
058625b713 | ||
|
|
7d75d2cd94 | ||
|
|
4a17fc8a81 | ||
|
|
1327b6b06b | ||
|
|
8bc71db41f | ||
|
|
0137a98b28 | ||
|
|
326eb3f2cc | ||
|
|
5ed5ed5a0e | ||
|
|
e6668220f2 | ||
|
|
372e52ff6c | ||
|
|
3da8a8b9b9 | ||
|
|
841d084555 | ||
|
|
5a4d5b9c43 | ||
|
|
7959e40061 | ||
|
|
3d2c481ab0 | ||
|
|
232d7322b5 | ||
|
|
b116631418 | ||
|
|
9388aa62cf | ||
|
|
10ac9442f2 | ||
|
|
184a5c1c0a | ||
|
|
472a3b34d8 | ||
|
|
3c81ae17ea | ||
|
|
1528b88657 | ||
|
|
65a1eaf069 | ||
|
|
6d853bb196 | ||
|
|
74aeb0a2ec | ||
|
|
b02f8a482d | ||
|
|
0a11038665 | ||
|
|
01ab37c9ce | ||
|
|
db95181f8f | ||
|
|
8b6416db1e | ||
|
|
17600d23d8 | ||
|
|
e347cd769a | ||
|
|
25437936c4 | ||
|
|
063ede8698 | ||
|
|
82af8b9fb6 | ||
|
|
7b8b77444d | ||
|
|
2176606ff7 | ||
|
|
8c920456e4 | ||
|
|
a80791c568 | ||
|
|
ed8bcb28b2 | ||
|
|
a5d2854104 | ||
|
|
d3d7b1d679 | ||
|
|
4efe1437dd | ||
|
|
ee78d54023 | ||
|
|
bfdabe46df | ||
|
|
236357c05a | ||
|
|
06ba4f48dc | ||
|
|
d7635a9972 | ||
|
|
4a8dd99a9f | ||
|
|
bcc330c80e | ||
|
|
1743bba3ea | ||
|
|
74a635b919 | ||
|
|
1fc2d92bf6 | ||
|
|
df56b575cd | ||
|
|
8753278af8 | ||
|
|
6f139706ae | ||
|
|
b37e6a2234 | ||
|
|
f32ea8feff | ||
|
|
6f7f0810e0 | ||
|
|
8dee7adf47 | ||
|
|
bf4f7761b3 | ||
|
|
6f5703e473 | ||
|
|
c8bab9bca4 | ||
|
|
b209beb54b | ||
|
|
c1c7f61e80 | ||
|
|
48ea0ca37f | ||
|
|
60a7bca27e | ||
|
|
6e1e21942e | ||
|
|
8e70535583 | ||
|
|
5f5c9d133b | ||
|
|
6be2a5e54b | ||
|
|
334ff1fd4f | ||
|
|
b0df49cb10 | ||
|
|
a7b0c87a97 | ||
|
|
39734c77f7 | ||
|
|
3f689d6bfd | ||
|
|
dc08a1f933 | ||
|
|
8be338ed08 | ||
|
|
4c7131c26a | ||
|
|
3d732748b6 | ||
|
|
4d20c5ffd1 | ||
|
|
e6a8e53a8d | ||
|
|
fe6e54773e | ||
|
|
d659e6242b | ||
|
|
0cfdb4a029 | ||
|
|
37e29b5434 | ||
|
|
ed949c59cf | ||
|
|
185f2ac9ce | ||
|
|
387e05af6d | ||
|
|
806df0f8de | ||
|
|
47bbe6afe7 | ||
|
|
76f0cbaf1f | ||
|
|
51316230ba | ||
|
|
80c4ba0e03 | ||
|
|
97532bc759 | ||
|
|
a7d927af35 | ||
|
|
e9105d8b46 | ||
|
|
a4adf0d1ec | ||
|
|
0473eb2c22 | ||
|
|
d9d74a549d | ||
|
|
b5afabf41b | ||
|
|
b09e273fab | ||
|
|
6d990c8ca1 | ||
|
|
d065ae7311 | ||
|
|
f6185c6d85 | ||
|
|
0d4aa19918 | ||
|
|
4dfed39284 | ||
|
|
fc6863bea9 | ||
|
|
b4af02bcc4 | ||
|
|
811b28ae39 | ||
|
|
55b141c756 | ||
|
|
fbe5fdcd05 | ||
|
|
a2075d255b | ||
|
|
7ea36613da | ||
|
|
e4021e2d21 | ||
|
|
dfbc6b2d28 | ||
|
|
b14246e828 | ||
|
|
cc764902bc | ||
|
|
1156930bd7 | ||
|
|
a6f0062bd7 | ||
|
|
c86bd7f528 | ||
|
|
f971949135 | ||
|
|
93970e41e3 | ||
|
|
a250829cb6 | ||
|
|
aa3af99591 | ||
|
|
1800ff1c5f | ||
|
|
c7f5dcaf38 | ||
|
|
95fa18fd1b | ||
|
|
8797e389c6 | ||
|
|
8f0fc87a18 | ||
|
|
c455f4ccbd | ||
|
|
b8f4c95e21 | ||
|
|
498c628a1e | ||
|
|
5c0a84fd95 | ||
|
|
abcec8015c | ||
|
|
70febdf0ce | ||
|
|
a33a2cc024 | ||
|
|
d16085b67b | ||
|
|
5903a8fb4f | ||
|
|
e865b4f106 | ||
|
|
b507383230 | ||
|
|
ee0bd97330 | ||
|
|
cd7615343e | ||
|
|
3087be111c | ||
|
|
e415fd6d5b | ||
|
|
d6c639e64b | ||
|
|
6bb3da2236 | ||
|
|
f4b458f9e2 | ||
|
|
c966517392 | ||
|
|
1b774773ac | ||
|
|
095f420299 | ||
|
|
f6b945c739 | ||
|
|
4a7c467763 | ||
|
|
ff5680b8f1 | ||
|
|
111c268fbb | ||
|
|
20b41bd136 | ||
|
|
232dcb7241 | ||
|
|
09d166ebfd | ||
|
|
f432f1b010 | ||
|
|
d7fcae0778 | ||
|
|
223b4a9fb2 | ||
|
|
1af309aa19 | ||
|
|
13d14d0ddf | ||
|
|
66b30531ac | ||
|
|
66cf5423c6 | ||
|
|
3f0cec517b | ||
|
|
833b8160b5 | ||
|
|
a776cc376e | ||
|
|
83777bf1bc | ||
|
|
a15bc3ddd9 | ||
|
|
6dfddf5410 | ||
|
|
fb928dc8ea | ||
|
|
1bac3117fa | ||
|
|
07c55e9db4 | ||
|
|
5a8991913d | ||
|
|
fcce8449bc | ||
|
|
283d452ede | ||
|
|
52ba9b76e0 | ||
|
|
9d051f5808 | ||
|
|
b2ad1b9b42 | ||
|
|
a5d3c7c4f4 | ||
|
|
bef6f89563 | ||
|
|
4b77527f7a | ||
|
|
a080556e7e | ||
|
|
95fe31c60d | ||
|
|
8f1465aa9c | ||
|
|
1b11ff7752 | ||
|
|
101ce7109e | ||
|
|
7caf083ebe | ||
|
|
11f85405e0 | ||
|
|
be297836a1 | ||
|
|
91d72e822e | ||
|
|
8640414cca | ||
|
|
091ace83f8 | ||
|
|
e81957973d | ||
|
|
f3af7d55a8 | ||
|
|
e92f3a25ec | ||
|
|
ecbe894712 | ||
|
|
9a432a2328 | ||
|
|
976cb2d81d | ||
|
|
00d70680f9 | ||
|
|
3b8e7319f1 | ||
|
|
39c4f1f7c5 | ||
|
|
50a7f8483a | ||
|
|
52df73c3ff | ||
|
|
6adaf5a554 | ||
|
|
fc94ae7a77 | ||
|
|
ec8ab90763 | ||
|
|
5a0f713935 | ||
|
|
34921ffbba | ||
|
|
62ad9a8dc5 | ||
|
|
84752f34f9 | ||
|
|
3a39d96928 | ||
|
|
65d37c34b7 | ||
|
|
8e174d9437 | ||
|
|
4ec9b314c1 | ||
|
|
ba59c319b8 | ||
|
|
7708dde102 | ||
|
|
6c4c621475 | ||
|
|
9a8cc4eeb5 | ||
|
|
389ab65ab9 | ||
|
|
d3ae37234c | ||
|
|
f3c6ccd13c | ||
|
|
7305ee0962 | ||
|
|
38d6560c11 | ||
|
|
87ab152239 | ||
|
|
c387491661 | ||
|
|
7db4e07719 | ||
|
|
0073fae58e | ||
|
|
960c76bad2 | ||
|
|
93c36a6f68 | ||
|
|
781c12f2a9 | ||
|
|
55f3c2f438 | ||
|
|
60e922f180 | ||
|
|
a8a305a8ca | ||
|
|
87e8e1b31c | ||
|
|
f68e7a365f | ||
|
|
8abb5f60ca | ||
|
|
59aa9a23d8 | ||
|
|
6d79765420 | ||
|
|
49ca11e02d | ||
|
|
c004e18fb1 | ||
|
|
ee5918d9d7 | ||
|
|
9837e78bfc | ||
|
|
e08dc5aaae | ||
|
|
9ae2e2ef95 | ||
|
|
55b58a5d4c |
37
.gitignore
vendored
@@ -1,20 +1,37 @@
|
||||
*.pyc
|
||||
*.pyo
|
||||
build*/conf/local.conf
|
||||
build*/conf/bblayers.conf
|
||||
build*/downloads
|
||||
build*/tmp/
|
||||
build*/sstate-cache
|
||||
build*/pyshtables.py
|
||||
build/conf/local.conf
|
||||
build/conf/bblayers.conf
|
||||
build/downloads
|
||||
build/tmp/
|
||||
build/sstate-cache
|
||||
build/pyshtables.py
|
||||
pstage/
|
||||
scripts/oe-git-proxy-socks
|
||||
scripts/poky-git-proxy-socks
|
||||
sources/
|
||||
meta-*
|
||||
!meta-skeleton
|
||||
!meta-demoapps
|
||||
meta-darwin
|
||||
meta-maemo
|
||||
meta-extras
|
||||
meta-m2
|
||||
meta-prvt*
|
||||
poky-autobuilder*
|
||||
*.swp
|
||||
*.orig
|
||||
*.rej
|
||||
*~
|
||||
documentation/poky-ref-manual/poky-ref-manual.html
|
||||
documentation/poky-ref-manual/poky-ref-manual.pdf
|
||||
documentation/poky-ref-manual/poky-ref-manual.tgz
|
||||
documentation/poky-ref-manual/bsp-guide.html
|
||||
documentation/poky-ref-manual/bsp-guide.pdf
|
||||
documentation/bsp-guide/bsp-guide.html
|
||||
documentation/bsp-guide/bsp-guide.pdf
|
||||
documentation/bsp-guide/bsp-guide.tgz
|
||||
documentation/yocto-project-qs/yocto-project-qs.html
|
||||
documentation/yocto-project-qs/yocto-project-qs.tgz
|
||||
documentation/kernel-manual/kernel-manual.html
|
||||
documentation/kernel-manual/kernel-manual.tgz
|
||||
documentation/kernel-manual/kernel-manual.pdf
|
||||
|
||||
|
||||
|
||||
|
||||
30
README
@@ -1,25 +1,15 @@
|
||||
Poky
|
||||
====
|
||||
|
||||
Poky is an integration of various components to form a complete prepackaged
|
||||
build system and development environment. It features support for building
|
||||
customised embedded device style images. There are reference demo images
|
||||
featuring a X11/Matchbox/GTK themed UI called Sato. The system supports
|
||||
cross-architecture application development using QEMU emulation and a
|
||||
standalone toolchain and SDK with IDE integration.
|
||||
Poky platform builder is a combined cross build system and development
|
||||
environment. It features support for building X11/Matchbox/GTK based
|
||||
filesystem images for various embedded devices and boards. It also
|
||||
supports cross-architecture application development using QEMU emulation
|
||||
and a standalone toolchain and SDK with IDE integration.
|
||||
|
||||
Poky has an extensive handbook, the source of which is contained in
|
||||
the handbook directory. For compiled HTML or pdf versions of this,
|
||||
see the Poky website http://pokylinux.org.
|
||||
|
||||
Additional information on the specifics of hardware that Poky supports
|
||||
is available in README.hardware. Further hardware support can easily be added
|
||||
in the form of layers which extend the systems capabilities in a modular way.
|
||||
|
||||
As an integration layer Poky consists of several upstream projects such as
|
||||
BitBake, OpenEmbedded-Core, Yocto documentation and various sources of information
|
||||
e.g. for the hardware support. Poky is in turn a component of the Yocto Project.
|
||||
|
||||
The Yocto Project has extensive documentation about the system including a
|
||||
reference manual which can be found at:
|
||||
http://yoctoproject.org/community/documentation
|
||||
|
||||
For information about OpenEmbedded see their website:
|
||||
http://www.openembedded.org/
|
||||
|
||||
is available in README.hardware.
|
||||
|
||||
@@ -68,12 +68,12 @@ Intel Atom based PCs and devices (atom-pc)
|
||||
|
||||
The atom-pc MACHINE is tested on the following platforms:
|
||||
|
||||
o Asus EeePC 901
|
||||
o Asus eee901
|
||||
o Acer Aspire One
|
||||
o Toshiba NB305
|
||||
o Intel Embedded Development Board 1-N450 (Black Sand)
|
||||
|
||||
and is likely to work on many unlisted Atom based devices. The MACHINE type
|
||||
and is likely to work on many unlisted atom based devices. The MACHINE type
|
||||
supports ethernet, wifi, sound, and i915 graphics by default in addition to
|
||||
common PC input devices, busses, and so on.
|
||||
|
||||
@@ -83,18 +83,26 @@ straightforward with a caveat for USB devices. The following examples assume the
|
||||
target boot device is /dev/sdb, be sure to verify this and use the correct
|
||||
device as the following commands are run as root and are not reversable.
|
||||
|
||||
USB Device:
|
||||
1. Build a live image. This image type consists of a simple filesystem
|
||||
without a partition table, which is suitable for USB keys, and with the
|
||||
default setup for the atom-pc machine, this image type is built
|
||||
automatically for any image you build. For example:
|
||||
Hard Disk:
|
||||
1. Build a directdisk image format. This will generate proper partition tables
|
||||
that will in turn be written to the physical media. For example:
|
||||
|
||||
$ bitbake core-image-minimal
|
||||
$ bitbake poky-image-minimal-directdisk
|
||||
|
||||
2. Use the "dd" utility to write the image to the raw block device. For example:
|
||||
|
||||
# dd if=poky-image-minimal-directdisk-atom-pc.hdddirect of=/dev/sdb
|
||||
|
||||
USB Device:
|
||||
1. Build an hddimg image format. This is a simple filesystem without partition
|
||||
tables and is suitable for USB keys. For example:
|
||||
|
||||
$ bitbake poky-image-minimal-live
|
||||
|
||||
2. Use the "dd" utility to write the image to the raw block device. For
|
||||
example:
|
||||
|
||||
# dd if=core-image-minimal-atom-pc.hddimg of=/dev/sdb
|
||||
# dd if=poky-image-minimal-live-atom-pc.hddimg of=/dev/sdb
|
||||
|
||||
If the device fails to boot with "Boot error" displayed, it is likely the BIOS
|
||||
cannot understand the physical layout of the disk (or rather it expects a
|
||||
@@ -118,7 +126,7 @@ USB Device:
|
||||
|
||||
b. Copy the contents of the poky image to the USB-ZIP mode device:
|
||||
|
||||
# mount -o loop core-image-minimal-atom-pc.hddimg /tmp/image
|
||||
# mount -o loop poky-image-minimal-live-atom-pc.hddimg /tmp/image
|
||||
# mount /dev/sdb4 /tmp/usbkey
|
||||
# cp -rf /tmp/image/* /tmp/usbkey
|
||||
|
||||
@@ -142,7 +150,7 @@ faster CPU, more RAM, an ethernet port, more USB ports, microSD, and removes
|
||||
the NAND flash. The beagleboard MACHINE is tested on the following platforms:
|
||||
|
||||
o Beagleboard C4
|
||||
o Beagleboard xM rev A & B
|
||||
o Beagleboard xM Rev A
|
||||
|
||||
The Beagleboard C4 has NAND, while the xM does not. For the sake of simplicity,
|
||||
these instructions assume you have erased the NAND on the C4 so its boot
|
||||
@@ -188,7 +196,7 @@ if used via a usb card reader):
|
||||
# cp u-boot-beagleboard.bin /media/boot/u-boot.bin
|
||||
|
||||
3. Install the root filesystem
|
||||
# tar x -C /media/root -f core-image-$IMAGE_TYPE-beagleboard.tar.bz2
|
||||
# tar x -C /media/root -f poky-image-$IMAGE_TYPE-beagleboard.tar.bz2
|
||||
# tar x -C /media/root -f modules-$KERNEL_VERSION-beagleboard.tgz
|
||||
|
||||
4. Install the kernel uImage
|
||||
@@ -231,57 +239,30 @@ software development of network attached storage (NAS) and digital media server
|
||||
applications. The MPC8315E-RDB features the PowerQUICC II Pro processor, which
|
||||
includes a built-in security accelerator.
|
||||
|
||||
(Note: you may find it easier to order MPC8315E-RDBA; this appears to be the
|
||||
same board in an enclosure with accessories. In any case it is fully
|
||||
compatible with the instructions given here.)
|
||||
|
||||
Setup instructions
|
||||
------------------
|
||||
|
||||
You will need the following:
|
||||
* NFS root setup on your workstation
|
||||
* TFTP server installed on your workstation
|
||||
* Null modem cable connected from your workstation to the first serial port
|
||||
on the board
|
||||
* Ethernet connected to the first ethernet port on the board
|
||||
* nfs root setup on your workstation
|
||||
* tftp server installed on your workstation
|
||||
|
||||
--- Preparation ---
|
||||
Load the kernel and boot it as follows:
|
||||
|
||||
Note: if you have altered your board's ethernet MAC address(es) from the
|
||||
defaults, or you need to do so because you want multiple boards on the same
|
||||
network, then you will need to change the values in the dts file (patch
|
||||
linux/arch/powerpc/boot/dts/mpc8315erdb.dts within the kernel source). If
|
||||
you have left them at the factory default then you shouldn't need to do
|
||||
anything here.
|
||||
1. Get the kernel (uImage.mpc8315erdb) and dtb (mpc8315erdb.dtb) files from
|
||||
the Poky build tmp/deploy directory, and make them available on your tftp
|
||||
server.
|
||||
|
||||
--- Booting from NFS root ---
|
||||
2. Set up the environment in U-Boot:
|
||||
|
||||
Load the kernel and dtb (device tree blob), and boot the system as follows:
|
||||
=>setenv ipaddr <board ip>
|
||||
=>setenv serverip <tftp server ip>
|
||||
=>setenv bootargs root=/dev/nfs rw nfsroot=<nfsroot ip>:<rootfs path> ip=<board ip>:<server ip>:<gateway ip>:255.255.255.0:mpc8315e:eth0:off console=ttyS0,115200
|
||||
|
||||
1. Get the kernel (uImage-mpc8315e-rdb.bin) and dtb (uImage-mpc8315e-rdb.dtb)
|
||||
files from the Poky build tmp/deploy directory, and make them available on
|
||||
your TFTP server.
|
||||
3. Download kernel and dtb to boot kernel.
|
||||
|
||||
2. Connect the board's first serial port to your workstation and then start up
|
||||
your favourite serial terminal so that you will be able to interact with
|
||||
the serial console. If you don't have a favourite, picocom is suggested:
|
||||
|
||||
$ picocom /dev/ttyUSB0 -b 115200
|
||||
|
||||
3. Power up or reset the board and press a key on the terminal when prompted
|
||||
to get to the U-Boot command line
|
||||
|
||||
4. Set up the environment in U-Boot:
|
||||
|
||||
=> setenv ipaddr <board ip>
|
||||
=> setenv serverip <tftp server ip>
|
||||
=> setenv bootargs root=/dev/nfs rw nfsroot=<nfsroot ip>:<rootfs path> ip=<board ip>:<server ip>:<gateway ip>:255.255.255.0:mpc8315e:eth0:off console=ttyS0,115200
|
||||
|
||||
5. Download the kernel and dtb, and boot:
|
||||
|
||||
=> tftp 800000 uImage-mpc8315e-rdb.bin
|
||||
=> tftp 780000 uImage-mpc8315e-rdb.dtb
|
||||
=> bootm 800000 - 780000
|
||||
=>tftp 800000 uImage.mpc8315erdb
|
||||
=>tftp 780000 mpc8315erdb.dtb
|
||||
=>bootm 800000 - 780000
|
||||
|
||||
|
||||
Ubiquiti Networks RouterStation Pro (routerstationpro)
|
||||
@@ -310,11 +291,11 @@ name in all commands where appropriate.
|
||||
|
||||
--- Preparation ---
|
||||
|
||||
1) Build an image (e.g. core-image-minimal) using "routerstationpro" as the
|
||||
1) Build an image (e.g. poky-image-minimal) using "routerstationpro" as the
|
||||
MACHINE
|
||||
|
||||
2) Partition the USB drive so that primary partition 1 is type Linux (83).
|
||||
Minimum size depends on your root image size - core-image-minimal probably
|
||||
Minimum size depends on your root image size - poky-image-minimal probably
|
||||
only needs 8-16MB, other images will need more.
|
||||
|
||||
# fdisk /dev/sdb
|
||||
@@ -335,11 +316,11 @@ only needs 8-16MB, other images will need more.
|
||||
# mke2fs -j /dev/sdb1
|
||||
|
||||
4) Mount partition 1 and then extract the contents of
|
||||
tmp/deploy/images/core-image-XXXX.tar.bz2 into it (preserving permissions).
|
||||
tmp/deploy/images/poky-image-XXXX.tar.bz2 into it (preserving permissions).
|
||||
|
||||
# mount /dev/sdb1 /media/sdb1
|
||||
# cd /media/sdb1
|
||||
# tar -xvjpf tmp/deploy/images/core-image-XXXX.tar.bz2
|
||||
# tar -xvjpf tmp/deploy/images/poky-image-XXXX.tar.bz2
|
||||
|
||||
5) Unmount the USB drive and then plug it into the board's USB port
|
||||
|
||||
|
||||
@@ -32,15 +32,17 @@ import warnings
|
||||
from traceback import format_exception
|
||||
try:
|
||||
import bb
|
||||
except RuntimeError as exc:
|
||||
except RuntimeError, exc:
|
||||
sys.exit(str(exc))
|
||||
from bb import event
|
||||
import bb.msg
|
||||
from bb import cooker
|
||||
from bb import ui
|
||||
from bb import server
|
||||
from bb.server import none
|
||||
#from bb.server import xmlrpc
|
||||
|
||||
__version__ = "1.15.0"
|
||||
__version__ = "1.11.0"
|
||||
logger = logging.getLogger("BitBake")
|
||||
|
||||
|
||||
@@ -102,7 +104,7 @@ It expects that BBFILES is defined, which is a space separated list of files to
|
||||
be executed. BBFILES does support wildcards.
|
||||
Default BBFILES are the .bb files in the current directory.""")
|
||||
|
||||
parser.add_option("-b", "--buildfile", help = "execute the task against this .bb file, rather than a package from BBFILES. Does not handle any dependencies.",
|
||||
parser.add_option("-b", "--buildfile", help = "execute the task against this .bb file, rather than a package from BBFILES.",
|
||||
action = "store", dest = "buildfile", default = None)
|
||||
|
||||
parser.add_option("-k", "--continue", help = "continue as much as possible after an error. While the target that failed, and those that depend on it, cannot be remade, the other dependencies of these targets can be processed all the same.",
|
||||
@@ -118,10 +120,7 @@ Default BBFILES are the .bb files in the current directory.""")
|
||||
action = "store", dest = "cmd")
|
||||
|
||||
parser.add_option("-r", "--read", help = "read the specified file before bitbake.conf",
|
||||
action = "append", dest = "prefile", default = [])
|
||||
|
||||
parser.add_option("-R", "--postread", help = "read the specified file after bitbake.conf",
|
||||
action = "append", dest = "postfile", default = [])
|
||||
action = "append", dest = "file", default = [])
|
||||
|
||||
parser.add_option("-v", "--verbose", help = "output more chit-chat to the terminal",
|
||||
action = "store_true", dest = "verbose", default = False)
|
||||
@@ -138,6 +137,9 @@ Default BBFILES are the .bb files in the current directory.""")
|
||||
parser.add_option("-p", "--parse-only", help = "quit after parsing the BB files (developers only)",
|
||||
action = "store_true", dest = "parse_only", default = False)
|
||||
|
||||
parser.add_option("-d", "--disable-psyco", help = "disable using the psyco just-in-time compiler (not recommended)",
|
||||
action = "store_true", dest = "disable_psyco", default = False)
|
||||
|
||||
parser.add_option("-s", "--show-versions", help = "show current and preferred versions of all packages",
|
||||
action = "store_true", dest = "show_versions", default = False)
|
||||
|
||||
@@ -159,9 +161,6 @@ Default BBFILES are the .bb files in the current directory.""")
|
||||
parser.add_option("-u", "--ui", help = "userinterface to use",
|
||||
action = "store", dest = "ui")
|
||||
|
||||
parser.add_option("-t", "--servertype", help = "Choose which server to use, none, process or xmlrpc",
|
||||
action = "store", dest = "servertype")
|
||||
|
||||
parser.add_option("", "--revisions-changed", help = "Set the exit code depending on whether upstream floating revisions have changed or not",
|
||||
action = "store_true", dest = "revisions_changed", default = False)
|
||||
|
||||
@@ -169,70 +168,52 @@ Default BBFILES are the .bb files in the current directory.""")
|
||||
|
||||
configuration = BBConfiguration(options)
|
||||
configuration.pkgs_to_build.extend(args[1:])
|
||||
configuration.initial_path = os.environ['PATH']
|
||||
|
||||
ui_main = get_ui(configuration)
|
||||
|
||||
# Server type can be xmlrpc, process or none currently, if nothing is specified,
|
||||
# the default server is process
|
||||
if configuration.servertype:
|
||||
server_type = configuration.servertype
|
||||
else:
|
||||
server_type = 'process'
|
||||
loghandler = event.LogHandler()
|
||||
logger.addHandler(loghandler)
|
||||
|
||||
try:
|
||||
module = __import__("bb.server", fromlist = [server_type])
|
||||
server = getattr(module, server_type)
|
||||
except AttributeError:
|
||||
sys.exit("FATAL: Invalid server type '%s' specified.\n"
|
||||
"Valid interfaces: xmlrpc, process [default], none." % servertype)
|
||||
#server = bb.server.xmlrpc
|
||||
server = bb.server.none
|
||||
|
||||
# Save a logfile for cooker into the current working directory. When the
|
||||
# server is daemonized this logfile will be truncated.
|
||||
cooker_logfile = os.path.join(os.getcwd(), "cooker.log")
|
||||
|
||||
bb.msg.init_msgconfig(configuration.verbose, configuration.debug,
|
||||
bb.utils.init_logger(bb.msg, configuration.verbose, configuration.debug,
|
||||
configuration.debug_domains)
|
||||
|
||||
# Ensure logging messages get sent to the UI as events
|
||||
handler = bb.event.LogHandler()
|
||||
logger.addHandler(handler)
|
||||
|
||||
# Before we start modifying the environment we should take a pristine
|
||||
# copy for possible later use
|
||||
initialenv = os.environ.copy()
|
||||
# Clear away any spurious environment variables. But don't wipe the
|
||||
# environment totally. This is necessary to ensure the correct operation
|
||||
# of the UIs (e.g. for DISPLAY, etc.)
|
||||
bb.utils.clean_environment()
|
||||
|
||||
server = server.BitBakeServer()
|
||||
|
||||
server.initServer()
|
||||
idle = server.getServerIdleCB()
|
||||
|
||||
cooker = bb.cooker.BBCooker(configuration, idle, initialenv)
|
||||
cooker = bb.cooker.BBCooker(configuration, server)
|
||||
cooker.parseCommandLine()
|
||||
|
||||
server.addcooker(cooker)
|
||||
server.saveConnectionDetails()
|
||||
server.detach(cooker_logfile)
|
||||
serverinfo = server.BitbakeServerInfo(cooker.server)
|
||||
|
||||
# Should no longer need to ever reference cooker
|
||||
server.BitBakeServerFork(cooker, cooker.server, serverinfo, cooker_logfile)
|
||||
del cooker
|
||||
|
||||
logger.removeHandler(handler)
|
||||
logger.removeHandler(loghandler)
|
||||
|
||||
# Setup a connection to the server (cooker)
|
||||
server_connection = server.establishConnection()
|
||||
server_connection = server.BitBakeServerConnection(serverinfo)
|
||||
|
||||
# Launch the UI
|
||||
if configuration.ui:
|
||||
ui = configuration.ui
|
||||
else:
|
||||
ui = "knotty"
|
||||
|
||||
try:
|
||||
return server.launchUI(ui_main, server_connection.connection, server_connection.events)
|
||||
return server.BitbakeUILauch().launch(serverinfo, ui_main, server_connection.connection, server_connection.events)
|
||||
finally:
|
||||
bb.event.ui_queue = []
|
||||
server_connection.terminate()
|
||||
|
||||
return 1
|
||||
|
||||
if __name__ == "__main__":
|
||||
try:
|
||||
ret = main()
|
||||
@@ -241,4 +222,3 @@ if __name__ == "__main__":
|
||||
import traceback
|
||||
traceback.print_exc(5)
|
||||
sys.exit(ret)
|
||||
|
||||
|
||||
@@ -2,11 +2,13 @@
|
||||
|
||||
# This script has subcommands which operate against your bitbake layers, either
|
||||
# displaying useful information, or acting against them.
|
||||
# See the help output for details on available commands.
|
||||
# Currently, it only provides a show_appends command, which shows you what
|
||||
# bbappends are in effect, and warns you if you have appends which are not being
|
||||
# utilized.
|
||||
|
||||
import cmd
|
||||
import logging
|
||||
import os
|
||||
import os.path
|
||||
import sys
|
||||
|
||||
bindir = os.path.dirname(__file__)
|
||||
@@ -16,50 +18,41 @@ sys.path[0:0] = [os.path.join(topdir, 'lib')]
|
||||
import bb.cache
|
||||
import bb.cooker
|
||||
import bb.providers
|
||||
import bb.utils
|
||||
from bb.cooker import state
|
||||
from bb.server import none
|
||||
|
||||
|
||||
logger = logging.getLogger('BitBake')
|
||||
default_cmd = 'show_appends'
|
||||
|
||||
|
||||
def main(args):
|
||||
# Set up logging
|
||||
console = logging.StreamHandler(sys.stdout)
|
||||
format = bb.msg.BBLogFormatter("%(levelname)s: %(message)s")
|
||||
bb.msg.addDefaultlogFilter(console)
|
||||
console.setFormatter(format)
|
||||
logger.addHandler(console)
|
||||
|
||||
initialenv = os.environ.copy()
|
||||
logging.basicConfig(format='%(levelname)s: %(message)s')
|
||||
bb.utils.clean_environment()
|
||||
|
||||
cmds = Commands(initialenv)
|
||||
cmds = Commands()
|
||||
if args:
|
||||
cmds.onecmd(' '.join(args))
|
||||
else:
|
||||
cmds.do_help('')
|
||||
cmds.onecmd(default_cmd)
|
||||
return cmds.returncode
|
||||
|
||||
|
||||
class Commands(cmd.Cmd):
|
||||
def __init__(self, initialenv):
|
||||
def __init__(self):
|
||||
cmd.Cmd.__init__(self)
|
||||
|
||||
self.returncode = 0
|
||||
self.config = Config(parse_only=True)
|
||||
self.cooker = bb.cooker.BBCooker(self.config,
|
||||
self.register_idle_function,
|
||||
initialenv)
|
||||
bb.server.none)
|
||||
self.config_data = self.cooker.configuration.data
|
||||
bb.providers.logger.setLevel(logging.ERROR)
|
||||
self.cooker_data = None
|
||||
|
||||
def register_idle_function(self, function, data):
|
||||
pass
|
||||
self.prepare_cooker()
|
||||
|
||||
def prepare_cooker(self):
|
||||
sys.stderr.write("Parsing recipes..")
|
||||
logger.setLevel(logging.WARNING)
|
||||
logger.setLevel(logging.ERROR)
|
||||
|
||||
try:
|
||||
while self.cooker.state in (state.initial, state.parsing):
|
||||
@@ -75,161 +68,20 @@ class Commands(cmd.Cmd):
|
||||
self.cooker_data = self.cooker.status
|
||||
self.cooker_data.appends = self.cooker.appendlist
|
||||
|
||||
def check_prepare_cooker(self):
|
||||
if not self.cooker_data:
|
||||
self.prepare_cooker()
|
||||
|
||||
def default(self, line):
|
||||
"""Handle unrecognised commands"""
|
||||
sys.stderr.write("Unrecognised command or option\n")
|
||||
self.do_help('')
|
||||
|
||||
def do_help(self, topic):
|
||||
"""display general help or help on a specified command"""
|
||||
if topic:
|
||||
sys.stdout.write('%s: ' % topic)
|
||||
cmd.Cmd.do_help(self,topic)
|
||||
else:
|
||||
sys.stdout.write("usage: bitbake-layers <command> [arguments]\n\n")
|
||||
sys.stdout.write("Available commands:\n")
|
||||
procnames = self.get_names()
|
||||
for procname in procnames:
|
||||
if procname[:3] == 'do_':
|
||||
sys.stdout.write(" %s\n" % procname[3:])
|
||||
doc = getattr(self, procname).__doc__
|
||||
if doc:
|
||||
sys.stdout.write(" %s\n" % doc.splitlines()[0])
|
||||
|
||||
def do_show_layers(self, args):
|
||||
"""show current configured layers"""
|
||||
self.check_prepare_cooker()
|
||||
logger.plain('')
|
||||
logger.plain("%s %s %s" % ("layer".ljust(20), "path".ljust(40), "priority"))
|
||||
logger.plain('=' * 74)
|
||||
layerdirs = str(self.config_data.getVar('BBLAYERS', True)).split()
|
||||
for layerdir in layerdirs:
|
||||
layername = '?'
|
||||
layerpri = 0
|
||||
for layer, _, regex, pri in self.cooker.status.bbfile_config_priorities:
|
||||
if regex.match(os.path.join(layerdir, 'test')):
|
||||
layername = layer
|
||||
layerpri = pri
|
||||
break
|
||||
|
||||
logger.plain("%s %s %d" % (layername.ljust(20), layerdir.ljust(40), layerpri))
|
||||
|
||||
def do_show_overlayed(self, args):
|
||||
"""list overlayed recipes (where there is a recipe in another layer that has a higher layer priority)
|
||||
|
||||
usage: show_overlayed
|
||||
|
||||
Highest priority recipes are listed with the recipes they overlay as subitems.
|
||||
"""
|
||||
self.check_prepare_cooker()
|
||||
if self.cooker.overlayed:
|
||||
logger.plain('Overlayed recipes:')
|
||||
for f in self.cooker.overlayed.iterkeys():
|
||||
logger.plain('%s' % f)
|
||||
for of in self.cooker.overlayed[f]:
|
||||
logger.plain(' %s' % of)
|
||||
else:
|
||||
logger.plain('No overlayed recipes found')
|
||||
|
||||
def do_flatten(self, args):
|
||||
"""flattens layer configuration into a separate output directory.
|
||||
|
||||
usage: flatten <outputdir>
|
||||
|
||||
Takes the current layer configuration and builds a "flattened" directory
|
||||
containing the contents of all layers, with any overlayed recipes removed
|
||||
and bbappends appended to the corresponding recipes. Note that some manual
|
||||
cleanup may still be necessary afterwards, in particular:
|
||||
|
||||
* where non-recipe files (such as patches) are overwritten (the flatten
|
||||
command will show a warning for these)
|
||||
* where anything beyond the normal layer setup has been added to
|
||||
layer.conf (only the lowest priority layer's layer.conf is used)
|
||||
* overridden/appended items from bbappends will need to be tidied up
|
||||
"""
|
||||
arglist = args.split()
|
||||
if len(arglist) != 1:
|
||||
logger.error('Please specify an output directory')
|
||||
self.do_help('flatten')
|
||||
return
|
||||
|
||||
if os.path.exists(arglist[0]) and os.listdir(arglist[0]):
|
||||
logger.error('Directory %s exists and is non-empty, please clear it out first' % arglist[0])
|
||||
return
|
||||
|
||||
self.check_prepare_cooker()
|
||||
layers = (self.config_data.getVar('BBLAYERS', True) or "").split()
|
||||
for layer in layers:
|
||||
overlayed = []
|
||||
for f in self.cooker.overlayed.iterkeys():
|
||||
for of in self.cooker.overlayed[f]:
|
||||
if of.startswith(layer):
|
||||
overlayed.append(of)
|
||||
|
||||
logger.plain('Copying files from %s...' % layer )
|
||||
for root, dirs, files in os.walk(layer):
|
||||
for f1 in files:
|
||||
f1full = os.sep.join([root, f1])
|
||||
if f1full in overlayed:
|
||||
logger.plain(' Skipping overlayed file %s' % f1full )
|
||||
else:
|
||||
ext = os.path.splitext(f1)[1]
|
||||
if ext != '.bbappend':
|
||||
fdest = f1full[len(layer):]
|
||||
fdest = os.path.normpath(os.sep.join([arglist[0],fdest]))
|
||||
bb.utils.mkdirhier(os.path.dirname(fdest))
|
||||
if os.path.exists(fdest):
|
||||
if f1 == 'layer.conf' and root.endswith('/conf'):
|
||||
logger.plain(' Skipping layer config file %s' % f1full )
|
||||
continue
|
||||
else:
|
||||
logger.warn('Overwriting file %s', fdest)
|
||||
bb.utils.copyfile(f1full, fdest)
|
||||
if ext == '.bb':
|
||||
if f1 in self.cooker_data.appends:
|
||||
appends = self.cooker_data.appends[f1]
|
||||
if appends:
|
||||
logger.plain(' Applying appends to %s' % fdest )
|
||||
for appendname in appends:
|
||||
self.apply_append(appendname, fdest)
|
||||
|
||||
def get_append_layer(self, appendname):
|
||||
for layer, _, regex, _ in self.cooker.status.bbfile_config_priorities:
|
||||
if regex.match(appendname):
|
||||
return layer
|
||||
return "?"
|
||||
|
||||
def apply_append(self, appendname, recipename):
|
||||
appendfile = open(appendname, 'r')
|
||||
recipefile = open(recipename, 'a')
|
||||
recipefile.write('\n')
|
||||
recipefile.write('##### bbappended from %s #####\n' % self.get_append_layer(appendname))
|
||||
recipefile.writelines(appendfile.readlines())
|
||||
logger.info(str(self.config_data.getVar('BBLAYERS', True)))
|
||||
|
||||
def do_show_appends(self, args):
|
||||
"""list bbappend files and recipe files they apply to
|
||||
|
||||
usage: show_appends
|
||||
|
||||
Recipes are listed with the bbappends that apply to them as subitems.
|
||||
"""
|
||||
self.check_prepare_cooker()
|
||||
if not self.cooker_data.appends:
|
||||
logger.plain('No append files found')
|
||||
logger.info('No append files found')
|
||||
return
|
||||
|
||||
logger.plain('State of append files:')
|
||||
logger.info('State of append files:')
|
||||
|
||||
pnlist = list(self.cooker_data.pkg_pn.keys())
|
||||
pnlist.sort()
|
||||
for pn in pnlist:
|
||||
for pn in self.cooker_data.pkg_pn:
|
||||
self.show_appends_for_pn(pn)
|
||||
|
||||
self.show_appends_for_skipped()
|
||||
self.show_appends_with_no_recipes()
|
||||
|
||||
def show_appends_for_pn(self, pn):
|
||||
filenames = self.cooker_data.pkg_pn[pn]
|
||||
@@ -240,30 +92,20 @@ Recipes are listed with the bbappends that apply to them as subitems.
|
||||
self.cooker_data.pkg_pn)
|
||||
best_filename = os.path.basename(best[3])
|
||||
|
||||
self.show_appends_output(filenames, best_filename)
|
||||
|
||||
def show_appends_for_skipped(self):
|
||||
filenames = [os.path.basename(f)
|
||||
for f in self.cooker.skiplist.iterkeys()]
|
||||
self.show_appends_output(filenames, None, " (skipped)")
|
||||
|
||||
def show_appends_output(self, filenames, best_filename, name_suffix = ''):
|
||||
appended, missing = self.get_appends_for_files(filenames)
|
||||
if appended:
|
||||
for basename, appends in appended:
|
||||
logger.plain('%s%s:', basename, name_suffix)
|
||||
logger.info('%s:', basename)
|
||||
for append in appends:
|
||||
logger.plain(' %s', append)
|
||||
|
||||
if best_filename:
|
||||
if best_filename in missing:
|
||||
logger.warn('%s: missing append for preferred version',
|
||||
best_filename)
|
||||
self.returncode |= 1
|
||||
logger.info(' %s', append)
|
||||
|
||||
if best_filename in missing:
|
||||
logger.warn('%s: missing append for preferred version',
|
||||
best_filename)
|
||||
self.returncode |= 1
|
||||
|
||||
def get_appends_for_files(self, filenames):
|
||||
appended, notappended = [], []
|
||||
appended, notappended = set(), set()
|
||||
for filename in filenames:
|
||||
_, cls = bb.cache.Cache.virtualfn2realfn(filename)
|
||||
if cls:
|
||||
@@ -272,19 +114,36 @@ Recipes are listed with the bbappends that apply to them as subitems.
|
||||
basename = os.path.basename(filename)
|
||||
appends = self.cooker_data.appends.get(basename)
|
||||
if appends:
|
||||
appended.append((basename, list(appends)))
|
||||
appended.add((basename, frozenset(appends)))
|
||||
else:
|
||||
notappended.append(basename)
|
||||
notappended.add(basename)
|
||||
return appended, notappended
|
||||
|
||||
def show_appends_with_no_recipes(self):
|
||||
recipes = set(os.path.basename(f)
|
||||
for f in self.cooker_data.pkg_fn.iterkeys())
|
||||
appended_recipes = self.cooker_data.appends.iterkeys()
|
||||
appends_without_recipes = [self.cooker_data.appends[recipe]
|
||||
for recipe in appended_recipes
|
||||
if recipe not in recipes]
|
||||
if appends_without_recipes:
|
||||
appendlines = (' %s' % append
|
||||
for appends in appends_without_recipes
|
||||
for append in appends)
|
||||
logger.warn('No recipes available for:\n%s',
|
||||
'\n'.join(appendlines))
|
||||
self.returncode |= 4
|
||||
|
||||
def do_EOF(self, line):
|
||||
return True
|
||||
|
||||
|
||||
class Config(object):
|
||||
def __init__(self, **options):
|
||||
self.pkgs_to_build = []
|
||||
self.debug_domains = []
|
||||
self.extra_assume_provided = []
|
||||
self.prefile = []
|
||||
self.postfile = []
|
||||
self.file = []
|
||||
self.debug = 0
|
||||
self.__dict__.update(options)
|
||||
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
import os
|
||||
import sys,logging
|
||||
import optparse
|
||||
|
||||
sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname(__file__)),'lib'))
|
||||
|
||||
import prserv
|
||||
import prserv.serv
|
||||
|
||||
__version__="1.0.0"
|
||||
|
||||
PRHOST_DEFAULT=''
|
||||
PRPORT_DEFAULT=8585
|
||||
|
||||
def main():
|
||||
parser = optparse.OptionParser(
|
||||
version="Bitbake PR Service Core version %s, %%prog version %s" % (prserv.__version__, __version__),
|
||||
usage = "%prog [options]")
|
||||
|
||||
parser.add_option("-f", "--file", help="database filename(default prserv.db)", action="store",
|
||||
dest="dbfile", type="string", default="prserv.db")
|
||||
parser.add_option("-l", "--log", help="log filename(default prserv.log)", action="store",
|
||||
dest="logfile", type="string", default="prserv.log")
|
||||
parser.add_option("--loglevel", help="logging level, i.e. CRITICAL, ERROR, WARNING, INFO, DEBUG",
|
||||
action = "store", type="string", dest="loglevel", default = "WARNING")
|
||||
parser.add_option("--start", help="start daemon",
|
||||
action="store_true", dest="start", default="True")
|
||||
parser.add_option("--stop", help="stop daemon",
|
||||
action="store_false", dest="start")
|
||||
parser.add_option("--host", help="ip address to bind", action="store",
|
||||
dest="host", type="string", default=PRHOST_DEFAULT)
|
||||
parser.add_option("--port", help="port number(default 8585)", action="store",
|
||||
dest="port", type="int", default=PRPORT_DEFAULT)
|
||||
|
||||
options, args = parser.parse_args(sys.argv)
|
||||
|
||||
prserv.init_logger(os.path.abspath(options.logfile),options.loglevel)
|
||||
|
||||
if options.start:
|
||||
prserv.serv.start_daemon(options)
|
||||
else:
|
||||
prserv.serv.stop_daemon()
|
||||
|
||||
if __name__ == "__main__":
|
||||
try:
|
||||
ret = main()
|
||||
except Exception:
|
||||
ret = 1
|
||||
import traceback
|
||||
traceback.print_exc(5)
|
||||
sys.exit(ret)
|
||||
|
||||
@@ -4,10 +4,6 @@ import os
|
||||
import sys
|
||||
import warnings
|
||||
sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname(sys.argv[0])), 'lib'))
|
||||
from bb import fetch2
|
||||
import logging
|
||||
|
||||
logger = logging.getLogger("BitBake")
|
||||
|
||||
try:
|
||||
import cPickle as pickle
|
||||
@@ -20,20 +16,13 @@ class BBConfiguration(object):
|
||||
Manages build options and configurations for one run
|
||||
"""
|
||||
|
||||
def __init__(self, **options):
|
||||
self.data = {}
|
||||
self.file = []
|
||||
self.cmd = None
|
||||
self.dump_signatures = True
|
||||
self.prefile = []
|
||||
self.postfile = []
|
||||
self.parse_only = True
|
||||
|
||||
def __getattr__(self, attribute):
|
||||
try:
|
||||
return super(BBConfiguration, self).__getattribute__(attribute)
|
||||
except AttributeError:
|
||||
return None
|
||||
def __init__(self, debug, debug_domains):
|
||||
setattr(self, "data", {})
|
||||
setattr(self, "file", [])
|
||||
setattr(self, "cmd", None)
|
||||
setattr(self, "dump_signatures", True)
|
||||
setattr(self, "debug", debug)
|
||||
setattr(self, "debug_domains", debug_domains)
|
||||
|
||||
_warnings_showwarning = warnings.showwarning
|
||||
def _showwarning(message, category, filename, lineno, file=None, line=None):
|
||||
@@ -50,70 +39,82 @@ warnings.showwarning = _showwarning
|
||||
warnings.simplefilter("ignore", DeprecationWarning)
|
||||
|
||||
import bb.event
|
||||
|
||||
# Need to map our I/O correctly. stdout is a pipe to the server expecting
|
||||
# events. We save this and then map stdout to stderr.
|
||||
|
||||
eventfd = os.dup(sys.stdout.fileno())
|
||||
bb.event.worker_pipe = os.fdopen(eventfd, 'w', 0)
|
||||
|
||||
# map stdout to stderr
|
||||
os.dup2(sys.stderr.fileno(), sys.stdout.fileno())
|
||||
|
||||
# Replace those fds with our own
|
||||
#logout = data.expand("${TMPDIR}/log/stdout.%s" % os.getpid(), self.cfgData, True)
|
||||
#mkdirhier(os.path.dirname(logout))
|
||||
#newso = open("/tmp/stdout.%s" % os.getpid(), 'w')
|
||||
#os.dup2(newso.fileno(), sys.stdout.fileno())
|
||||
#os.dup2(newso.fileno(), sys.stderr.fileno())
|
||||
|
||||
# Don't read from stdin from the parent
|
||||
si = file("/dev/null", 'r')
|
||||
os.dup2(si.fileno( ), sys.stdin.fileno( ))
|
||||
|
||||
# We don't want to see signals to our parent, e.g. Ctrl+C
|
||||
os.setpgrp()
|
||||
|
||||
# Save out the PID so that the event can include it the
|
||||
# events
|
||||
bb.event.worker_pid = os.getpid()
|
||||
bb.event.useStdout = False
|
||||
|
||||
hashfile = sys.argv[1]
|
||||
buildfile = sys.argv[2]
|
||||
taskname = sys.argv[3]
|
||||
|
||||
import bb.cooker
|
||||
|
||||
buildfile = sys.argv[1]
|
||||
taskname = sys.argv[2]
|
||||
if len(sys.argv) >= 4:
|
||||
dryrun = sys.argv[3]
|
||||
else:
|
||||
dryrun = False
|
||||
if len(sys.argv) >= 5:
|
||||
hashfile = sys.argv[4]
|
||||
p = pickle.Unpickler(file(hashfile, "rb"))
|
||||
hashdata = p.load()
|
||||
else:
|
||||
hashdata = None
|
||||
p = pickle.Unpickler(file(hashfile, "rb"))
|
||||
hashdata = p.load()
|
||||
|
||||
handler = bb.event.LogHandler()
|
||||
logger.addHandler(handler)
|
||||
debug = hashdata["msg-debug"]
|
||||
debug_domains = hashdata["msg-debug-domains"]
|
||||
verbose = hashdata["verbose"]
|
||||
|
||||
#An example to make debug log messages show up
|
||||
#bb.msg.init_msgconfig(True, 3, [])
|
||||
bb.utils.init_logger(bb.msg, verbose, debug, debug_domains)
|
||||
|
||||
console = logging.StreamHandler(sys.stdout)
|
||||
format = bb.msg.BBLogFormatter("%(levelname)s: %(message)s")
|
||||
bb.msg.addDefaultlogFilter(console)
|
||||
console.setFormatter(format)
|
||||
cooker = bb.cooker.BBCooker(BBConfiguration(debug, debug_domains), None)
|
||||
cooker.parseConfiguration()
|
||||
|
||||
def worker_fire(event, d):
|
||||
if isinstance(event, logging.LogRecord):
|
||||
console.handle(event)
|
||||
bb.event.worker_fire = worker_fire
|
||||
bb.event.worker_pid = os.getpid()
|
||||
cooker.bb_cache = bb.cache.init(cooker)
|
||||
cooker.status = bb.cache.CacheData()
|
||||
|
||||
initialenv = os.environ.copy()
|
||||
config = BBConfiguration()
|
||||
|
||||
def register_idle_function(self, function, data):
|
||||
pass
|
||||
|
||||
cooker = bb.cooker.BBCooker(config, register_idle_function, initialenv)
|
||||
config_data = cooker.configuration.data
|
||||
cooker.status = config_data
|
||||
cooker.handleCollections(config_data.getVar("BBFILE_COLLECTIONS", 1))
|
||||
|
||||
fn, cls = bb.cache.Cache.virtualfn2realfn(buildfile)
|
||||
(fn, cls) = cooker.bb_cache.virtualfn2realfn(buildfile)
|
||||
buildfile = cooker.matchFile(fn)
|
||||
fn = bb.cache.Cache.realfn2virtual(buildfile, cls)
|
||||
fn = cooker.bb_cache.realfn2virtual(buildfile, cls)
|
||||
|
||||
cooker.buildSetVars()
|
||||
|
||||
# Load data into the cache for fn and parse the loaded cache data
|
||||
the_data = bb.cache.Cache.loadDataFull(fn, cooker.get_file_appends(fn), cooker.configuration.data)
|
||||
the_data = cooker.bb_cache.loadDataFull(fn, cooker.get_file_appends(fn), cooker.configuration.data)
|
||||
cooker.bb_cache.setData(fn, buildfile, the_data)
|
||||
cooker.bb_cache.handle_data(fn, cooker.status)
|
||||
|
||||
#exportlist = bb.utils.preserved_envvars_export_list()
|
||||
#bb.utils.filter_environment(exportlist)
|
||||
|
||||
if taskname.endswith("_setscene"):
|
||||
the_data.setVarFlag(taskname, "quieterrors", "1")
|
||||
|
||||
if hashdata:
|
||||
bb.parse.siggen.set_taskdata(hashdata["hashes"], hashdata["deps"])
|
||||
for h in hashdata["hashes"]:
|
||||
the_data.setVar("BBHASH_%s" % h, hashdata["hashes"][h])
|
||||
for h in hashdata["deps"]:
|
||||
the_data.setVar("BBHASHDEPS_%s" % h, hashdata["deps"][h])
|
||||
bb.parse.siggen.set_taskdata(hashdata["hashes"], hashdata["deps"])
|
||||
|
||||
for h in hashdata["hashes"]:
|
||||
bb.data.setVar("BBHASH_%s" % h, hashdata["hashes"][h], the_data)
|
||||
for h in hashdata["deps"]:
|
||||
bb.data.setVar("BBHASHDEPS_%s" % h, hashdata["deps"][h], the_data)
|
||||
|
||||
ret = 0
|
||||
if dryrun != "True":
|
||||
if sys.argv[4] != "True":
|
||||
ret = bb.build.exec_task(fn, taskname, the_data)
|
||||
sys.exit(ret)
|
||||
|
||||
|
||||
@@ -430,8 +430,9 @@ Create a set of html pages (documentation) for a bitbake.conf....
|
||||
action = "store_true", dest = "verbose", default = False )
|
||||
|
||||
options, args = parser.parse_args( sys.argv )
|
||||
|
||||
bb.msg.init_msgconfig(options.verbose, options.debug)
|
||||
|
||||
if options.debug:
|
||||
bb.msg.set_debug_level(options.debug)
|
||||
|
||||
return options.config, options.output
|
||||
|
||||
@@ -462,7 +463,7 @@ def main():
|
||||
state_group = 2
|
||||
|
||||
for key in bb.data.keys(documentation):
|
||||
data = documentation.getVarFlag(key, "doc")
|
||||
data = bb.data.getVarFlag(key, "doc", documentation)
|
||||
if not data:
|
||||
continue
|
||||
|
||||
|
||||
@@ -85,6 +85,9 @@ don't execute, just go through the motions
|
||||
.B \-p, \-\-parse-only
|
||||
quit after parsing the BB files (developers only)
|
||||
.TP
|
||||
.B \-d, \-\-disable-psyco
|
||||
disable using the psyco just-in-time compiler (not recommended)
|
||||
.TP
|
||||
.B \-s, \-\-show-versions
|
||||
show current and preferred versions of all packages
|
||||
.TP
|
||||
|
||||
@@ -12,10 +12,9 @@
|
||||
<corpauthor>BitBake Team</corpauthor>
|
||||
</authorgroup>
|
||||
<copyright>
|
||||
<year>2004, 2005, 2006, 2011</year>
|
||||
<year>2004, 2005, 2006</year>
|
||||
<holder>Chris Larson</holder>
|
||||
<holder>Phil Blundell</holder>
|
||||
<holder>Richard Purdie</holder>
|
||||
</copyright>
|
||||
<legalnotice>
|
||||
<para>This work is licensed under the Creative Commons Attribution License. To view a copy of this license, visit <ulink url="http://creativecommons.org/licenses/by/2.5/">http://creativecommons.org/licenses/by/2.5/</ulink> or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.</para>
|
||||
@@ -27,10 +26,10 @@
|
||||
<title>Overview</title>
|
||||
<para>BitBake is, at its simplest, a tool for executing
|
||||
tasks and managing metadata. As such, its similarities to GNU make and other
|
||||
build tools are readily apparent. It was inspired by Portage, the package management system used by the Gentoo Linux distribution. BitBake is the basis of the <ulink url="http://www.openembedded.org/">OpenEmbedded</ulink> project, which is being used to build and maintain a number of embedded Linux distributions/projects such as Angstrom and the Yocto project.</para>
|
||||
build tools are readily apparent. It was inspired by Portage, the package management system used by the Gentoo Linux distribution. BitBake is the basis of the <ulink url="http://www.openembedded.org/">OpenEmbedded</ulink> project, which is being used to build and maintain a number of embedded Linux distributions, including OpenZaurus and Familiar.</para>
|
||||
</section>
|
||||
<section>
|
||||
<title>Background and goals</title>
|
||||
<title>Background and Goals</title>
|
||||
<para>Prior to BitBake, no other build tool adequately met
|
||||
the needs of an aspiring embedded Linux distribution. All of the
|
||||
buildsystems used by traditional desktop Linux distributions lacked
|
||||
@@ -38,14 +37,14 @@ important functionality, and none of the ad-hoc
|
||||
<emphasis>buildroot</emphasis> systems, prevalent in the
|
||||
embedded space, were scalable or maintainable.</para>
|
||||
|
||||
<para>Some important original goals for BitBake were:
|
||||
<para>Some important goals for BitBake were:
|
||||
<itemizedlist>
|
||||
<listitem><para>Handle crosscompilation.</para></listitem>
|
||||
<listitem><para>Handle interpackage dependencies (build time on target architecture, build time on native architecture, and runtime).</para></listitem>
|
||||
<listitem><para>Support running any number of tasks within a given package, including, but not limited to, fetching upstream sources, unpacking them, patching them, configuring them, et cetera.</para></listitem>
|
||||
<listitem><para>Must be Linux distribution agnostic (both build and target).</para></listitem>
|
||||
<listitem><para>Must be linux distribution agnostic (both build and target).</para></listitem>
|
||||
<listitem><para>Must be architecture agnostic</para></listitem>
|
||||
<listitem><para>Must support multiple build and target operating systems (including Cygwin, the BSDs, etc).</para></listitem>
|
||||
<listitem><para>Must support multiple build and target operating systems (including cygwin, the BSDs, etc).</para></listitem>
|
||||
<listitem><para>Must be able to be self contained, rather than tightly integrated into the build machine's root filesystem.</para></listitem>
|
||||
<listitem><para>There must be a way to handle conditional metadata (on target architecture, operating system, distribution, machine).</para></listitem>
|
||||
<listitem><para>It must be easy for the person using the tools to supply their own local metadata and packages to operate against.</para></listitem>
|
||||
@@ -54,18 +53,10 @@ between multiple projects using BitBake for their
|
||||
builds.</para></listitem>
|
||||
<listitem><para>Should provide an inheritance mechanism to
|
||||
share common metadata between many packages.</para></listitem>
|
||||
<listitem><para>Et cetera...</para></listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
<para>Over time it has become apparent that some further requirements were necessary:
|
||||
<itemizedlist>
|
||||
<listitem><para>Handle variants of a base recipe (native, sdk, multilib).</para></listitem>
|
||||
<listitem><para>Able to split metadata into layers and allow layers to override each other.</para></listitem>
|
||||
<listitem><para>Allow representation of a given set of input variables to a task as a checksum.</para></listitem>
|
||||
<listitem><para>based on that checksum, allow acceleration of builds with prebuilt components.</para></listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
|
||||
<para>BitBake satisfies all the original requirements and many more with extensions being made to the basic functionality to reflect the additionl requirements. Flexibility and power have always been the priorities. It is highly extensible, supporting embedded Python code and execution of any arbitrary tasks.</para>
|
||||
<para>BitBake satisfies all these and many more. Flexibility and power have always been the priorities. It is highly extensible, supporting embedded Python code and execution of any arbitrary tasks.</para>
|
||||
</section>
|
||||
</chapter>
|
||||
<chapter>
|
||||
@@ -100,13 +91,13 @@ share common metadata between many packages.</para></listitem>
|
||||
<section>
|
||||
<title>Setting a default value (?=)</title>
|
||||
<para><screen><varname>A</varname> ?= "aval"</screen></para>
|
||||
<para>If <varname>A</varname> is set before the above is called, it will retain its previous value. If <varname>A</varname> is unset prior to the above call, <varname>A</varname> will be set to <literal>aval</literal>. Note that this assignment is immediate, so if there are multiple ?= assignments to a single variable, the first of those will be used.</para>
|
||||
<para>If <varname>A</varname> is set before the above is called, it will retain it's previous value. If <varname>A</varname> is unset prior to the above call, <varname>A</varname> will be set to <literal>aval</literal>. Note that this assignment is immediate, so if there are multiple ?= assignments to a single variable, the first of those will be used.</para>
|
||||
</section>
|
||||
<section>
|
||||
<title>Setting a weak default value (??=)</title>
|
||||
<para><screen><varname>A</varname> ??= "somevalue"
|
||||
<varname>A</varname> ??= "someothervalue"</screen></para>
|
||||
<para>If <varname>A</varname> is set before the above, it will retain that value. If <varname>A</varname> is unset prior to the above, <varname>A</varname> will be set to <literal>someothervalue</literal>. This is a lazy/weak assignment in that the assignment does not occur until the end of the parsing process, so that the last, rather than the first, ??= assignment to a given variable will be used. Any other setting of A using = or ?= will however override the value set with ??=</para>
|
||||
<title>Setting a default value (??=)</title>
|
||||
<para><screen><varname>A</varname> ??= "somevalue"</screen></para>
|
||||
<para><screen><varname>A</varname> ??= "someothervalue"</screen></para>
|
||||
<para>If <varname>A</varname> is set before the above, it will retain that value. If <varname>A</varname> is unset prior to the above, <varname>A</varname> will be set to <literal>someothervalue</literal>. This is a lazy version of ?=, in that the assignment does not occur until the end of the parsing process, so that the last, rather than the first, ??= assignment to a given variable will be used.</para>
|
||||
</section>
|
||||
<section>
|
||||
<title>Immediate variable expansion (:=)</title>
|
||||
@@ -134,7 +125,7 @@ share common metadata between many packages.</para></listitem>
|
||||
<varname>B</varname> .= "additionaldata"
|
||||
<varname>C</varname> = "cval"
|
||||
<varname>C</varname> =. "test"</screen></para>
|
||||
<para>In this example, <varname>B</varname> is now <literal>bvaladditionaldata</literal> and <varname>C</varname> is <literal>testcval</literal>. In contrast to the above appending and prepending operators, no additional space
|
||||
<para>In this example, <varname>B</varname> is now <literal>bvaladditionaldata</literal> and <varname>C</varname> is <literal>testcval</literal>. In contrast to the above Appending and Prepending operators no additional space
|
||||
will be introduced.</para>
|
||||
</section>
|
||||
<section>
|
||||
@@ -156,12 +147,12 @@ will be introduced.</para>
|
||||
</section>
|
||||
<section>
|
||||
<title>Inclusion</title>
|
||||
<para>Next, there is the <literal>include</literal> directive, which causes BitBake to parse whatever file you specify, and insert it at that location, which is not unlike <command>make</command>. However, if the path specified on the <literal>include</literal> line is a relative path, BitBake will locate the first one it can find within <envar>BBPATH</envar>.</para>
|
||||
<para>Next, there is the <literal>include</literal> directive, which causes BitBake to parse in whatever file you specify, and insert it at that location, which is not unlike <command>make</command>. However, if the path specified on the <literal>include</literal> line is a relative path, BitBake will locate the first one it can find within <envar>BBPATH</envar>.</para>
|
||||
</section>
|
||||
<section>
|
||||
<title>Requiring inclusion</title>
|
||||
<title>Requiring Inclusion</title>
|
||||
<para>In contrast to the <literal>include</literal> directive, <literal>require</literal> will
|
||||
raise an ParseError if the file to be included cannot be found. Otherwise it will behave just like the <literal>
|
||||
raise an ParseError if the to be included file can not be found. Otherwise it will behave just like the <literal>
|
||||
include</literal> directive.</para>
|
||||
</section>
|
||||
<section>
|
||||
@@ -180,13 +171,13 @@ include</literal> directive.</para>
|
||||
import time
|
||||
print time.strftime('%Y%m%d', time.gmtime())
|
||||
}</screen></para>
|
||||
<para>This is the similar to the previous, but flags it as Python so that BitBake knows it is Python code.</para>
|
||||
<para>This is the similar to the previous, but flags it as python so that BitBake knows it is python code.</para>
|
||||
</section>
|
||||
<section>
|
||||
<title>Defining Python functions into the global Python namespace</title>
|
||||
<title>Defining python functions into the global python namespace</title>
|
||||
<para><emphasis>NOTE:</emphasis> This is only supported in .bb and .bbclass files.</para>
|
||||
<para><screen>def get_depends(bb, d):
|
||||
if d.getVar('SOMECONDITION', True):
|
||||
if bb.data.getVar('SOMECONDITION', d, True):
|
||||
return "dependencywithcond"
|
||||
else:
|
||||
return "dependency"
|
||||
@@ -196,8 +187,8 @@ include</literal> directive.</para>
|
||||
<para>This would result in <varname>DEPENDS</varname> containing <literal>dependencywithcond</literal>.</para>
|
||||
</section>
|
||||
<section>
|
||||
<title>Variable flags</title>
|
||||
<para>Variables can have associated flags which provide a way of tagging extra information onto a variable. Several flags are used internally by BitBake but they can be used externally too if needed. The standard operations mentioned above also work on flags.</para>
|
||||
<title>Variable Flags</title>
|
||||
<para>Variables can have associated flags which provide a way of tagging extra information onto a variable. Several flags are used internally by bitbake but they can be used externally too if needed. The standard operations mentioned above also work on flags.</para>
|
||||
<para><screen><varname>VARIABLE</varname>[<varname>SOMEFLAG</varname>] = "value"</screen></para>
|
||||
<para>In this example, <varname>VARIABLE</varname> has a flag, <varname>SOMEFLAG</varname> which is set to <literal>value</literal>.</para>
|
||||
</section>
|
||||
@@ -209,32 +200,19 @@ include</literal> directive.</para>
|
||||
<section>
|
||||
<title>Tasks</title>
|
||||
<para><emphasis>NOTE:</emphasis> This is only supported in .bb and .bbclass files.</para>
|
||||
<para>In BitBake, each step that needs to be run for a given .bb is known as a task. There is a command <literal>addtask</literal> to add new tasks (must be a defined Python executable metadata and must start with <quote>do_</quote>) and describe intertask dependencies.</para>
|
||||
<para>In BitBake, each step that needs to be run for a given .bb is known as a task. There is a command <literal>addtask</literal> to add new tasks (must be a defined python executable metadata and must start with <quote>do_</quote>) and describe intertask dependencies.</para>
|
||||
<para><screen>python do_printdate () {
|
||||
import time
|
||||
print time.strftime('%Y%m%d', time.gmtime())
|
||||
}
|
||||
|
||||
addtask printdate before do_build</screen></para>
|
||||
<para>This defines the necessary Python function and adds it as a task which is now a dependency of do_build, the default task. If anyone executes the do_build task, that will result in do_printdate being run first.</para>
|
||||
<para>This defines the necessary python function and adds it as a task which is now a dependency of do_build (the default task). If anyone executes the do_build task, that will result in do_printdate being run first.</para>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>Task Flags</title>
|
||||
<para>Tasks support a number of flags which control various functionality of the task. These are as follows:</para>
|
||||
<para>'dirs' - directories which should be created before the task runs</para>
|
||||
<para>'cleandirs' - directories which should created before the task runs but should be empty</para>
|
||||
<para>'noexec' - marks the tasks as being empty and no execution required. These are used as dependency placeholders or used when added tasks need to be subsequently disabled.</para>
|
||||
<para>'nostamp' - don't generate a stamp file for a task. This means the task is always rexecuted.</para>
|
||||
<para>'fakeroot' - this task needs to be run in a fakeroot environment, obtained by adding the variables in FAKEROOTENV to the environment.</para>
|
||||
<para>'umask' - the umask to run the task under.</para>
|
||||
<para> For the 'deptask', 'rdeptask', 'recdeptask' and 'recrdeptask' flags please see the dependencies section.</para>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>Events</title>
|
||||
<para><emphasis>NOTE:</emphasis> This is only supported in .bb and .bbclass files.</para>
|
||||
<para>BitBake allows installation of event handlers. Events are triggered at certain points during operation, such as the beginning of operation against a given .bb, the start of a given task, task failure, task success, et cetera. The intent is to make it easy to do things like email notification on build failure.</para>
|
||||
<para>BitBake allows to install event handlers. Events are triggered at certain points during operation, such as, the beginning of operation against a given .bb, the start of a given task, task failure, task success, et cetera. The intent was to make it easy to do things like email notifications on build failure.</para>
|
||||
<para><screen>addhandler myclass_eventhandler
|
||||
python myclass_eventhandler() {
|
||||
from bb.event import getName
|
||||
@@ -250,65 +228,20 @@ of the event and the content of the <varname>FILE</varname> variable.</para>
|
||||
</section>
|
||||
<section>
|
||||
<title>Variants</title>
|
||||
<para>Two BitBake features exist to facilitate the creation of multiple buildable incarnations from a single recipe file.</para>
|
||||
<para>The first is <varname>BBCLASSEXTEND</varname>. This variable is a space separated list of classes used to "extend" the recipe for each variant. As an example, setting <screen>BBCLASSEXTEND = "native"</screen> results in a second incarnation of the current recipe being available. This second incarantion will have the "native" class inherited.</para>
|
||||
<para>The second feature is <varname>BBVERSIONS</varname>. This variable allows a single recipe to build multiple versions of a project from a single recipe file, and allows you to specify conditional metadata (using the <varname>OVERRIDES</varname> mechanism) for a single version, or an optionally named range of versions:</para>
|
||||
<para>Two Bitbake features exist to facilitate the creation of multiple buildable incarnations from a single recipe file.</para>
|
||||
<para>The first is <varname>BBCLASSEXTEND</varname>. This variable is a space separated list of classes to utilize to "extend" the recipe for each variant. As an example, setting <screen>BBCLASSEXTEND = "native"</screen> results in a second incarnation of the current recipe being available. This second incarantion will have the "native" class inherited.</para>
|
||||
<para>The second feature is <varname>BBVERSIONS</varname>. This variable allows a single recipe to be able to build multiple versions of a project from a single recipe file, and allows you to specify conditional metadata (using the <varname>OVERRIDES</varname> mechanism) for a single version, or an optionally named range of versions:</para>
|
||||
<para><screen>BBVERSIONS = "1.0 2.0 git"
|
||||
SRC_URI_git = "git://someurl/somepath.git"</screen></para>
|
||||
<para><screen>BBVERSIONS = "1.0.[0-6]:1.0.0+ \
|
||||
1.0.[7-9]:1.0.7+"
|
||||
SRC_URI_append_1.0.7+ = "file://some_patch_which_the_new_versions_need.patch;patch=1"</screen></para>
|
||||
<para>Note that the name of the range will default to the original version of the recipe, so given OE, a recipe file of foo_1.0.0+.bb will default the name of its versions to 1.0.0+. This is useful, as the range name is not only placed into overrides; it's also made available for the metadata to use in the form of the <varname>BPV</varname> variable, for use in file:// search paths (<varname>FILESPATH</varname>).</para>
|
||||
<para>Note that the name of the range will default to the original version of the recipe, so given OE, a recipe file of foo_1.0.0+.bb will default the name of its versions to 1.0.0+. This is useful, as the range name is not only placed into overrides, it's also made available for the metadata to use in the form of the <varname>BPV</varname> variable, for use in file:// search paths (<varname>FILESPATH</varname>).</para>
|
||||
</section>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>Variable interaction: Worked Examples</title>
|
||||
<para>Despite the documentation of the different forms of variable definition above, it can be hard to work out what happens when variable operators are combined. This section documents some common questions people have regarding the way variables interact.</para>
|
||||
|
||||
<section>
|
||||
<title>Override and append ordering</title>
|
||||
|
||||
<para>There is often confusion about which order overrides and the various append operators take effect.</para>
|
||||
|
||||
<para><screen><varname>OVERRIDES</varname> = "foo"
|
||||
<varname>A_foo_append</varname> = "X"</screen></para>
|
||||
<para>In this case, X is unconditionally appended to the variable <varname>A_foo</varname>. Since foo is an override, A_foo would then replace <varname>A</varname>.</para>
|
||||
|
||||
<para><screen><varname>OVERRIDES</varname> = "foo"
|
||||
<varname>A</varname> = "X"
|
||||
<varname>A_append_foo</varname> = "Y"</screen></para>
|
||||
<para>In this case, only when foo is in OVERRIDES, Y is appended to the variable <varname>A</varname> so the value of <varname>A</varname> would become XY (NB: no spaces are appended).</para>
|
||||
|
||||
<para><screen><varname>OVERRIDES</varname> = "foo"
|
||||
<varname>A_foo_append</varname> = "X"
|
||||
<varname>A_foo_append</varname> += "Y"</screen></para>
|
||||
<para>This behaves as per the first case above, but the value of <varname>A</varname> would be "X Y" instead of just "X".</para>
|
||||
|
||||
<para><screen><varname>A</varname> = "1"
|
||||
<varname>A_append</varname> = "2"
|
||||
<varname>A_append</varname> = "3"
|
||||
<varname>A</varname> += "4"
|
||||
<varname>A</varname> .= "5"</screen></para>
|
||||
|
||||
<para>Would ultimately result in <varname>A</varname> taking the value "1 4523" since the _append operator executes at the same time as the expansion of other overrides.</para>
|
||||
|
||||
</section>
|
||||
<section>
|
||||
<title>Key Expansion</title>
|
||||
|
||||
<para>Key expansion happens at the data store finalisation time just before overrides are expanded.</para>
|
||||
|
||||
<para><screen><varname>A${B}</varname> = "X"
|
||||
<varname>B</varname> = "2"
|
||||
<varname>A2</varname> = "Y"</screen></para>
|
||||
<para>So in this case <varname>A2</varname> would take the value of "X".</para>
|
||||
</section>
|
||||
|
||||
</section>
|
||||
<section>
|
||||
<title>Dependency handling</title>
|
||||
<para>BitBake 1.7.x onwards works with the metadata at the task level since this is optimal when dealing with multiple threads of execution. A robust method of specifing task dependencies is therefore needed. </para>
|
||||
<title>Dependency Handling</title>
|
||||
<para>Bitbake 1.7.x onwards works with the metadata at the task level since this is optimal when dealing with multiple threads of execution. A robust method of specifing task dependencies is therefore needed. </para>
|
||||
<section>
|
||||
<title>Dependencies internal to the .bb file</title>
|
||||
<para>Where the dependencies are internal to a given .bb file, the dependencies are handled by the previously detailed addtask directive.</para>
|
||||
@@ -316,26 +249,26 @@ SRC_URI_append_1.0.7+ = "file://some_patch_which_the_new_versions_need.patch;pat
|
||||
|
||||
<section>
|
||||
<title>DEPENDS</title>
|
||||
<para>DEPENDS lists build time dependencies. The 'deptask' flag for tasks is used to signify the task of each item listed in DEPENDS which must have completed before that task can be executed.</para>
|
||||
<para>DEPENDS is taken to specify build time dependencies. The 'deptask' flag for tasks is used to signify the task of each DEPENDS which must have completed before that task can be executed.</para>
|
||||
<para><screen>do_configure[deptask] = "do_populate_staging"</screen></para>
|
||||
<para>means the do_populate_staging task of each item in DEPENDS must have completed before do_configure can execute.</para>
|
||||
</section>
|
||||
<section>
|
||||
<title>RDEPENDS</title>
|
||||
<para>RDEPENDS lists runtime dependencies. The 'rdeptask' flag for tasks is used to signify the task of each item listed in RDEPENDS which must have completed before that task can be executed.</para>
|
||||
<para>RDEPENDS is taken to specify runtime dependencies. The 'rdeptask' flag for tasks is used to signify the task of each RDEPENDS which must have completed before that task can be executed.</para>
|
||||
<para><screen>do_package_write[rdeptask] = "do_package"</screen></para>
|
||||
<para>means the do_package task of each item in RDEPENDS must have completed before do_package_write can execute.</para>
|
||||
</section>
|
||||
<section>
|
||||
<title>Recursive DEPENDS</title>
|
||||
<para>These are specified with the 'recdeptask' flag and is used signify the task(s) of each DEPENDS which must have completed before that task can be executed. It applies recursively so the DEPENDS of each item in the original DEPENDS must be met and so on.</para>
|
||||
<para>These are specified with the 'recdeptask' flag and is used signify the task(s) of each DEPENDS which must have completed before that task can be executed. It applies recursively so also, the DEPENDS of each item in the original DEPENDS must be met and so on.</para>
|
||||
</section>
|
||||
<section>
|
||||
<title>Recursive RDEPENDS</title>
|
||||
<para>These are specified with the 'recrdeptask' flag and is used signify the task(s) of each RDEPENDS which must have completed before that task can be executed. It applies recursively so the RDEPENDS of each item in the original RDEPENDS must be met and so on. It also runs all DEPENDS first.</para>
|
||||
<para>These are specified with the 'recrdeptask' flag and is used signify the task(s) of each RDEPENDS which must have completed before that task can be executed. It applies recursively so also, the RDEPENDS of each item in the original RDEPENDS must be met and so on. It also runs all DEPENDS first too.</para>
|
||||
</section>
|
||||
<section>
|
||||
<title>Inter task</title>
|
||||
<title>Inter Task</title>
|
||||
<para>The 'depends' flag for tasks is a more generic form of which allows an interdependency on specific tasks rather than specifying the data in DEPENDS or RDEPENDS.</para>
|
||||
<para><screen>do_patch[depends] = "quilt-native:do_populate_staging"</screen></para>
|
||||
<para>means the do_populate_staging task of the target quilt-native must have completed before the do_patch can execute.</para>
|
||||
@@ -345,56 +278,35 @@ SRC_URI_append_1.0.7+ = "file://some_patch_which_the_new_versions_need.patch;pat
|
||||
<section>
|
||||
<title>Parsing</title>
|
||||
<section>
|
||||
<title>Configuration files</title>
|
||||
<para>The first kind of metadata in BitBake is configuration metadata. This metadata is global, and therefore affects <emphasis>all</emphasis> packages and tasks which are executed.</para>
|
||||
<para>BitBake will first search the current working directory for an optional "conf/bblayers.conf" configuration file. This file is expected to contain a BBLAYERS variable which is a space delimited list of 'layer' directories. For each directory in this list, a "conf/layer.conf" file will be searched for and parsed with the LAYERDIR variable being set to the directory where the layer was found. The idea is these files will setup BBPATH and other variables correctly for a given build directory automatically for the user.</para>
|
||||
<para>BitBake will then expect to find 'conf/bitbake.conf' somewhere in the user specified <envar>BBPATH</envar>. That configuration file generally has include directives to pull in any other metadata (generally files specific to architecture, machine, <emphasis>local</emphasis> and so on).</para>
|
||||
<title>Configuration Files</title>
|
||||
<para>The first of the classifications of metadata in BitBake is configuration metadata. This metadata is global, and therefore affects <emphasis>all</emphasis> packages and tasks which are executed.</para>
|
||||
<para>Bitbake will first search the current working directory for an optional "conf/bblayers.conf" configuration file. This file is expected to contain a BBLAYERS variable which is a space delimited list of 'layer' directories. For each directory in this list a "conf/layer.conf" file will be searched for and parsed with the LAYERDIR variable being set to the directory where the layer was found. The idea is these files will setup BBPATH and other variables correctly for a given build directory automatically for the user.</para>
|
||||
<para>Bitbake will then expect to find 'conf/bitbake.conf' somewhere in the user specified <envar>BBPATH</envar>. That configuration file generally has include directives to pull in any other metadata (generally files specific to architecture, machine, <emphasis>local</emphasis> and so on.</para>
|
||||
<para>Only variable definitions and include directives are allowed in .conf files.</para>
|
||||
</section>
|
||||
<section>
|
||||
<title>Classes</title>
|
||||
<para>BitBake classes are our rudimentary inheritance mechanism. As briefly mentioned in the metadata introduction, they're parsed when an <literal>inherit</literal> directive is encountered, and they are located in classes/ relative to the directories in <envar>BBPATH</envar>.</para>
|
||||
<para>BitBake classes are our rudimentary inheritance mechanism. As briefly mentioned in the metadata introduction, they're parsed when an <literal>inherit</literal> directive is encountered, and they are located in classes/ relative to the dirs in <envar>BBPATH</envar>.</para>
|
||||
</section>
|
||||
<section>
|
||||
<title>.bb files</title>
|
||||
<title>.bb Files</title>
|
||||
<para>A BitBake (.bb) file is a logical unit of tasks to be executed. Normally this is a package to be built. Inter-.bb dependencies are obeyed. The files themselves are located via the <varname>BBFILES</varname> variable, which is set to a space separated list of .bb files, and does handle wildcards.</para>
|
||||
</section>
|
||||
</section>
|
||||
</chapter>
|
||||
|
||||
<chapter>
|
||||
<title>File download support</title>
|
||||
<title>File Download support</title>
|
||||
<section>
|
||||
<title>Overview</title>
|
||||
<para>BitBake provides support to download files this procedure is called fetching and it handled by the fetch and fetch2 modules. At this point the original fetch code is considered to be replaced by fetch2 and this manual only related to the fetch2 codebase.</para>
|
||||
|
||||
<para>The SRC_URI is normally used to tell BitBake which files to fetch. The next sections will describe the available fetchers and their options. Each fetcher honors a set of variables and per URI parameters separated by a <quote>;</quote> consisting of a key and a value. The semantics of the variables and parameters are defined by the fetcher. BitBake tries to have consistent semantics between the different fetchers.
|
||||
<para>BitBake provides support to download files this procedure is called fetching. The SRC_URI is normally used to indicate BitBake which files to fetch. The next sections will describe th available fetchers and the options they have. Each Fetcher honors a set of Variables and
|
||||
a per URI parameters separated by a <quote>;</quote> consisting of a key and a value. The semantic of the Variables and Parameters are defined by the Fetcher. BitBakes tries to have a consistent semantic between the different Fetchers.
|
||||
</para>
|
||||
|
||||
<para>The overall fetch process is that first, fetches are attempted from PREMIRRORS. If those don't work, the original SRC_URI is attempted and if that fails, BitBake will fall back to MIRRORS. Cross urls are supported, so its possible to mirror a git repository on an http server as a tarball for example. Some example commonly used mirror definitions are:</para>
|
||||
|
||||
<para><screen><varname>PREMIRRORS</varname> ?= "\
|
||||
bzr://.*/.* http://somemirror.org/sources/ \n \
|
||||
cvs://.*/.* http://somemirror.org/sources/ \n \
|
||||
git://.*/.* http://somemirror.org/sources/ \n \
|
||||
hg://.*/.* http://somemirror.org/sources/ \n \
|
||||
osc://.*/.* http://somemirror.org/sources/ \n \
|
||||
p4://.*/.* http://somemirror.org/sources/ \n \
|
||||
svk://.*/.* http://somemirror.org/sources/ \n \
|
||||
svn://.*/.* http://somemirror.org/sources/ \n"
|
||||
|
||||
<varname>MIRRORS</varname> =+ "\
|
||||
ftp://.*/.* http://somemirror.org/sources/ \n \
|
||||
http://.*/.* http://somemirror.org/sources/ \n \
|
||||
https://.*/.* http://somemirror.org/sources/ \n"</screen></para>
|
||||
|
||||
<para>Non-local downloaded output is placed into the directory specified by the <varname>DL_DIR</varname>. For non local archive downloads the code can verify sha256 and md5 checksums for the download to ensure the file has been downloaded correctly. These may be specified either in the form <varname>SRC_URI[md5sum]</varname> for the md5 checksum and <varname>SRC_URI[sha256sum]</varname> for the sha256 checksum or as parameters on the SRC_URI such as SRC_URI="http://example.com/foobar.tar.bz2;md5sum=4a8e0f237e961fd7785d19d07fdb994d". If <varname>BB_STRICT_CHECKSUM</varname> is set, any download without a checksum will trigger an error message. In cases where multiple files are listed in SRC_URI, the name parameter is used assign names to the urls and these are then specified in the checksums in the form SRC_URI[name.sha256sum].</para>
|
||||
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>Local file fetcher</title>
|
||||
<para>The URN for the local file fetcher is <emphasis>file</emphasis>. The filename can be either absolute or relative. If the filename is relative, <varname>FILESPATH</varname> and failing that <varname>FILESDIR</varname> will be used to find the appropriate relative file. The metadata usually extend these variables to include variations of the values in <varname>OVERRIDES</varname>. Single files and complete directories can be specified.
|
||||
<title>Local File Fetcher</title>
|
||||
<para>The URN for the Local File Fetcher is <emphasis>file</emphasis>. The filename can be either absolute or relative. If the filename is relative <varname>FILESPATH</varname> and <varname>FILESDIR</varname> will be used to find the appropriate relative file depending on the <varname>OVERRIDES</varname>. Single files and complete directories can be specified.
|
||||
<screen><varname>SRC_URI</varname>= "file://relativefile.patch"
|
||||
<varname>SRC_URI</varname>= "file://relativefile.patch;this=ignored"
|
||||
<varname>SRC_URI</varname>= "file:///Users/ich/very_important_software"
|
||||
@@ -403,11 +315,10 @@ https://.*/.* http://somemirror.org/sources/ \n"</screen></para>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>CVS fetcher</title>
|
||||
<para>The URN for the CVS fetcher is <emphasis>cvs</emphasis>. This fetcher honors the variables <varname>CVSDIR</varname>, <varname>SRCDATE</varname>, <varname>FETCHCOMMAND_cvs</varname>, <varname>UPDATECOMMAND_cvs</varname>. <varname>DL_DIR</varname> specifies where a temporary checkout is saved. <varname>SRCDATE</varname> specifies which date to use when doing the fetching (the special value of "now" will cause the checkout to be updated on every build). <varname>FETCHCOMMAND</varname> and <varname>UPDATECOMMAND</varname> specify which executables to use for the CVS checkout or update.
|
||||
<title>CVS File Fetcher</title>
|
||||
<para>The URN for the CVS Fetcher is <emphasis>cvs</emphasis>. This Fetcher honors the variables <varname>DL_DIR</varname>, <varname>SRCDATE</varname>, <varname>FETCHCOMMAND_cvs</varname>, <varname>UPDATECOMMAND_cvs</varname>. <varname>DL_DIR</varname> specifies where a temporary checkout is saved, <varname>SRCDATE</varname> specifies which date to use when doing the fetching (the special value of "now" will cause the checkout to be updated on every build), <varname>FETCHCOMMAND</varname> and <varname>UPDATECOMMAND</varname> specify which executables should be used when doing the CVS checkout or update.
|
||||
</para>
|
||||
<para>The supported parameters are <varname>module</varname>, <varname>tag</varname>, <varname>date</varname>, <varname>method</varname>, <varname>localdir</varname>, <varname>rsh</varname> and <varname>scmdata</varname>. The <varname>module</varname> specifies which module to check out, the <varname>tag</varname> describes which CVS TAG should be used for the checkout. By default the TAG is empty. A <varname>date</varname> can be specified to override the SRCDATE of the configuration to checkout a specific date. The special value of "now" will cause the checkout to be updated on every build.<varname>method</varname> is by default <emphasis>pserver</emphasis>. If <emphasis>ext</emphasis> is used the <varname>rsh</varname> parameter will be evaluated and <varname>CVS_RSH</varname> will be set. Finally, <varname>localdir</varname> is used to checkout into a special directory relative to <varname>CVSDIR</varname>.
|
||||
|
||||
<para>The supported Parameters are <varname>module</varname>, <varname>tag</varname>, <varname>date</varname>, <varname>method</varname>, <varname>localdir</varname>, <varname>rsh</varname> and <varname>scmdata</varname>. The <varname>module</varname> specifies which module to check out, the <varname>tag</varname> describes which CVS TAG should be used for the checkout. By default the TAG is empty. A <varname>date</varname> can be specified to override the SRCDATE of the configuration to checkout a specific date. The special value of "now" will cause the checkout to be updated on every build.<varname>method</varname> is by default <emphasis>pserver</emphasis>, if <emphasis>ext</emphasis> is used the <varname>rsh</varname> parameter will be evaluated and <varname>CVS_RSH</varname> will be set. Finally <varname>localdir</varname> is used to checkout into a special directory relative to <varname>CVSDIR</varname>. If <varname>scmdata</varname> is set to <quote>keep</quote>
|
||||
<screen><varname>SRC_URI</varname> = "cvs://CVSROOT;module=mymodule;tag=some-version;method=ext"
|
||||
<varname>SRC_URI</varname> = "cvs://CVSROOT;module=mymodule;date=20060126;localdir=usethat"
|
||||
</screen>
|
||||
@@ -415,22 +326,32 @@ https://.*/.* http://somemirror.org/sources/ \n"</screen></para>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>HTTP/FTP fetcher</title>
|
||||
<para>The URNs for the HTTP/FTP fetcher are <emphasis>http</emphasis>, <emphasis>https</emphasis> and <emphasis>ftp</emphasis>. This fetcher honors the variables <varname>FETCHCOMMAND_wget</varname>. <varname>FETCHCOMMAND</varname> contains the command used for fetching. <quote>${URI}</quote> and <quote>${FILES}</quote> will be replaced by the URI and basename of the file to be fetched.
|
||||
<title>HTTP/FTP Fetcher</title>
|
||||
<para>The URNs for the HTTP/FTP are <emphasis>http</emphasis>, <emphasis>https</emphasis> and <emphasis>ftp</emphasis>. This Fetcher honors the variables <varname>DL_DIR</varname>, <varname>FETCHCOMMAND_wget</varname>, <varname>PREMIRRORS</varname>, <varname>MIRRORS</varname>. The <varname>DL_DIR</varname> defines where to store the fetched file, <varname>FETCHCOMMAND</varname> contains the command used for fetching. <quote>${URI}</quote> and <quote>${FILES}</quote> will be replaced by the uri and basename of the to be fetched file. <varname>PREMIRRORS</varname>
|
||||
will be tried first when fetching a file if that fails the actual file will be tried and finally all <varname>MIRRORS</varname> will be tried.
|
||||
</para>
|
||||
<para><screen><varname>SRC_URI</varname> = "http://oe.handhelds.org/not_there.aac"
|
||||
<varname>SRC_URI</varname> = "ftp://oe.handhelds.org/not_there_as_well.aac"
|
||||
<varname>SRC_URI</varname> = "ftp://you@oe.handheld.sorg/home/you/secret.plan"
|
||||
<para>The only supported Parameter is <varname>md5sum</varname>. After a fetch the <varname>md5sum</varname> of the file will be calculated and the two sums will be compared.
|
||||
</para>
|
||||
<para><screen><varname>SRC_URI</varname> = "http://oe.handhelds.org/not_there.aac;md5sum=12343"
|
||||
<varname>SRC_URI</varname> = "ftp://oe.handhelds.org/not_there_as_well.aac;md5sum=1234"
|
||||
<varname>SRC_URI</varname> = "ftp://you@oe.handheld.sorg/home/you/secret.plan;md5sum=1234"
|
||||
</screen></para>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>SVN fetcher</title>
|
||||
<para>The URN for the SVN fetcher is <emphasis>svn</emphasis>.
|
||||
<title>SVK Fetcher</title>
|
||||
<para>
|
||||
<emphasis>Currently NOT supported</emphasis>
|
||||
</para>
|
||||
<para>This fetcher honors the variables <varname>FETCHCOMMAND_svn</varname>, <varname>SVNDIR</varname>, <varname>SRCREV</varname>. <varname>FETCHCOMMAND</varname> contains the subversion command. <varname>SRCREV</varname> specifies which revision to use when doing the fetching.
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>SVN Fetcher</title>
|
||||
<para>The URN for the SVN Fetcher is <emphasis>svn</emphasis>.
|
||||
</para>
|
||||
<para>The supported parameters are <varname>proto</varname>, <varname>rev</varname> and <varname>scmdata</varname>. <varname>proto</varname> is the Subversion protocol, <varname>rev</varname> is the Subversion revision. If <varname>scmdata</varname> is set to <quote>keep</quote>, the <quote>.svn</quote> directories will be available during compile-time.
|
||||
<para>This Fetcher honors the variables <varname>FETCHCOMMAND_svn</varname>, <varname>DL_DIR</varname>, <varname>SRCDATE</varname>. <varname>FETCHCOMMAND</varname> contains the subversion command, <varname>DL_DIR</varname> is the directory where tarballs will be saved, <varname>SRCDATE</varname> specifies which date to use when doing the fetching (the special value of "now" will cause the checkout to be updated on every build).
|
||||
</para>
|
||||
<para>The supported Parameters are <varname>proto</varname>, <varname>rev</varname> and <varname>scmdata</varname>. <varname>proto</varname> is the subversion protocol, <varname>rev</varname> is the subversion revision. If <varname>scmdata</varname> is set to <quote>keep</quote>, the <quote>.svn</quote> directories will be available during compile-time.
|
||||
</para>
|
||||
<para><screen><varname>SRC_URI</varname> = "svn://svn.oe.handhelds.org/svn;module=vip;proto=http;rev=667"
|
||||
<varname>SRC_URI</varname> = "svn://svn.oe.handhelds.org/svn/;module=opie;proto=svn+ssh;date=20060126"
|
||||
@@ -438,12 +359,12 @@ https://.*/.* http://somemirror.org/sources/ \n"</screen></para>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>GIT fetcher</title>
|
||||
<title>GIT Fetcher</title>
|
||||
<para>The URN for the GIT Fetcher is <emphasis>git</emphasis>.
|
||||
</para>
|
||||
<para>The variable <varname>GITDIR</varname> will be used as the base directory where the git tree is cloned to.
|
||||
<para>The Variables <varname>DL_DIR</varname>, <varname>GITDIR</varname> are used. <varname>DL_DIR</varname> will be used to store the checkedout version. <varname>GITDIR</varname> will be used as the base directory where the git tree is cloned to.
|
||||
</para>
|
||||
<para>The parameters are <emphasis>tag</emphasis>, <emphasis>protocol</emphasis> and <emphasis>scmdata</emphasis>. <emphasis>tag</emphasis> is a Git tag, the default is <quote>master</quote>. <emphasis>protocol</emphasis> is the Git protocol to use and defaults to <quote>git</quote> if a hostname is set, otherwise its <quote>file</quote>. If <emphasis>scmdata</emphasis> is set to <quote>keep</quote>, the <quote>.git</quote> directory will be available during compile-time.
|
||||
<para>The Parameters are <emphasis>tag</emphasis>, <emphasis>protocol</emphasis> and <emphasis>scmdata</emphasis>. <emphasis>tag</emphasis> is a git tag, the default is <quote>master</quote>. <emphasis>protocol</emphasis> is the git protocol to use and defaults to <quote>rsync</quote>. If <emphasis>scmdata</emphasis> is set to <quote>keep</quote>, the <quote>.git</quote> directory will be available during compile-time.
|
||||
</para>
|
||||
<para><screen><varname>SRC_URI</varname> = "git://git.oe.handhelds.org/git/vip.git;tag=version-1"
|
||||
<varname>SRC_URI</varname> = "git://git.oe.handhelds.org/git/vip.git;protocol=http"
|
||||
@@ -454,13 +375,13 @@ https://.*/.* http://somemirror.org/sources/ \n"</screen></para>
|
||||
|
||||
|
||||
<chapter>
|
||||
<title>The BitBake command</title>
|
||||
<title>The bitbake command</title>
|
||||
<section>
|
||||
<title>Introduction</title>
|
||||
<para>bitbake is the primary command in the system. It facilitates executing tasks in a single .bb file, or executing a given task on a set of multiple .bb files, accounting for interdependencies amongst them.</para>
|
||||
</section>
|
||||
<section>
|
||||
<title>Usage and syntax</title>
|
||||
<title>Usage and Syntax</title>
|
||||
<para>
|
||||
<screen><prompt>$ </prompt>bitbake --help
|
||||
usage: bitbake [options] [package ...]
|
||||
@@ -496,6 +417,8 @@ options:
|
||||
than once.
|
||||
-n, --dry-run don't execute, just go through the motions
|
||||
-p, --parse-only quit after parsing the BB files (developers only)
|
||||
-d, --disable-psyco disable using the psyco just-in-time compiler (not
|
||||
recommended)
|
||||
-s, --show-versions show current and preferred versions of all packages
|
||||
-e, --environment show the global or per-package environment (this is
|
||||
what used to be bbread)
|
||||
@@ -515,7 +438,7 @@ options:
|
||||
<para>
|
||||
<example>
|
||||
<title>Executing a task against a single .bb</title>
|
||||
<para>Executing tasks for a single file is relatively simple. You specify the file in question, and BitBake parses it and executes the specified task (or <quote>build</quote> by default). It obeys intertask dependencies when doing so.</para>
|
||||
<para>Executing tasks for a single file is relatively simple. You specify the file in question, and bitbake parses it and executes the specified task (or <quote>build</quote> by default). It obeys intertask dependencies when doing so.</para>
|
||||
<para><quote>clean</quote> task:</para>
|
||||
<para><screen><prompt>$ </prompt>bitbake -b blah_1.0.bb -c clean</screen></para>
|
||||
<para><quote>build</quote> task:</para>
|
||||
@@ -525,8 +448,8 @@ options:
|
||||
<para>
|
||||
<example>
|
||||
<title>Executing tasks against a set of .bb files</title>
|
||||
<para>There are a number of additional complexities introduced when one wants to manage multiple .bb files. Clearly there needs to be a way to tell BitBake what files are available, and of those, which we want to execute at this time. There also needs to be a way for each .bb to express its dependencies, both for build time and runtime. There must be a way for the user to express their preferences when multiple .bb's provide the same functionality, or when there are multiple versions of a .bb.</para>
|
||||
<para>The next section, Metadata, outlines how to specify such things.</para>
|
||||
<para>There are a number of additional complexities introduced when one wants to manage multiple .bb files. Clearly there needs to be a way to tell bitbake what files are available, and of those, which we want to execute at this time. There also needs to be a way for each .bb to express its dependencies, both for build time and runtime. There must be a way for the user to express their preferences when multiple .bb's provide the same functionality, or when there are multiple versions of a .bb.</para>
|
||||
<para>The next section, Metadata, outlines how one goes about specifying such things.</para>
|
||||
<para>Note that the bitbake command, when not using --buildfile, accepts a <varname>PROVIDER</varname>, not a filename or anything else. By default, a .bb generally PROVIDES its packagename, packagename-version, and packagename-version-revision.</para>
|
||||
<screen><prompt>$ </prompt>bitbake blah</screen>
|
||||
<screen><prompt>$ </prompt>bitbake blah-1.0</screen>
|
||||
@@ -538,8 +461,8 @@ options:
|
||||
<example>
|
||||
<title>Generating dependency graphs</title>
|
||||
<para>BitBake is able to generate dependency graphs using the dot syntax. These graphs can be converted
|
||||
to images using the <application>dot</application> application from <ulink url="http://www.graphviz.org">Graphviz</ulink>.
|
||||
Two files will be written into the current working directory, <emphasis>depends.dot</emphasis> containing dependency information at the package level and <emphasis>task-depends.dot</emphasis> containing a breakdown of the dependencies at the task level. To stop depending on common depends, one can use the <prompt>-I depend</prompt> to omit these from the graph. This can lead to more readable graphs. This way, <varname>DEPENDS</varname> from inherited classes such as base.bbclass can be removed from the graph.</para>
|
||||
to images using the <application>dot</application> application from <ulink url="http://www.graphviz.org">graphviz</ulink>.
|
||||
Two files will be written into the current working directory, <emphasis>depends.dot</emphasis> containing dependency information at the package level and <emphasis>task-depends.dot</emphasis> containing a breakdown of the dependencies at the task level. To stop depending on common depends one can use the <prompt>-I depend</prompt> to omit these from the graph. This can lead to more readable graphs. E.g. this way <varname>DEPENDS</varname> from inherited classes, e.g. base.bbclass, can be removed from the graph.</para>
|
||||
<screen><prompt>$ </prompt>bitbake -g blah</screen>
|
||||
<screen><prompt>$ </prompt>bitbake -g -I virtual/whatever -I bloom blah</screen>
|
||||
</example>
|
||||
@@ -547,20 +470,20 @@ Two files will be written into the current working directory, <emphasis>depends.
|
||||
</section>
|
||||
<section>
|
||||
<title>Special variables</title>
|
||||
<para>Certain variables affect BitBake operation:</para>
|
||||
<para>Certain variables affect bitbake operation:</para>
|
||||
<section>
|
||||
<title><varname>BB_NUMBER_THREADS</varname></title>
|
||||
<para> The number of threads BitBake should run at once (default: 1).</para>
|
||||
<para> The number of threads bitbake should run at once (default: 1).</para>
|
||||
</section>
|
||||
</section>
|
||||
<section>
|
||||
<title>Metadata</title>
|
||||
<para>As you may have seen in the usage information, or in the information about .bb files, the <varname>BBFILES</varname> variable is how the BitBake tool locates its files. This variable is a space separated list of files that are available, and supports wildcards.
|
||||
<para>As you may have seen in the usage information, or in the information about .bb files, the BBFILES variable is how the bitbake tool locates its files. This variable is a space separated list of files that are available, and supports wildcards.
|
||||
<example>
|
||||
<title>Setting BBFILES</title>
|
||||
<programlisting><varname>BBFILES</varname> = "/path/to/bbfiles/*.bb"</programlisting>
|
||||
</example></para>
|
||||
<para>With regard to dependencies, it expects the .bb to define a <varname>DEPENDS</varname> variable, which contains a space separated list of <quote>package names</quote>, which themselves are the <varname>PN</varname> variable. The <varname>PN</varname> variable is, in general, set to a component of the .bb filename by default.</para>
|
||||
<para>With regard to dependencies, it expects the .bb to define a <varname>DEPENDS</varname> variable, which contains a space separated list of <quote>package names</quote>, which themselves are the <varname>PN</varname> variable. The <varname>PN</varname> variable is, in general, by default, set to a component of the .bb filename.</para>
|
||||
<example>
|
||||
<title>Depending on another .bb</title>
|
||||
<para>a.bb:
|
||||
@@ -573,7 +496,7 @@ DEPENDS += "package-b"</screen>
|
||||
</example>
|
||||
<example>
|
||||
<title>Using PROVIDES</title>
|
||||
<para>This example shows the usage of the <varname>PROVIDES</varname> variable, which allows a given .bb to specify what functionality it provides.</para>
|
||||
<para>This example shows the usage of the PROVIDES variable, which allows a given .bb to specify what functionality it provides.</para>
|
||||
<para>package1.bb:
|
||||
<screen>PROVIDES += "virtual/package"</screen>
|
||||
</para>
|
||||
@@ -583,16 +506,16 @@ DEPENDS += "package-b"</screen>
|
||||
<para>package3.bb:
|
||||
<screen>PROVIDES += "virtual/package"</screen>
|
||||
</para>
|
||||
<para>As you can see, we have two different .bb's that provide the same functionality (virtual/package). Clearly, there needs to be a way for the person running BitBake to control which of those providers gets used. There is, indeed, such a way.</para>
|
||||
<para>As you can see, here there are two different .bb's that provide the same functionality (virtual/package). Clearly, there needs to be a way for the person running bitbake to control which of those providers gets used. There is, indeed, such a way.</para>
|
||||
<para>The following would go into a .conf file, to select package1:
|
||||
<screen>PREFERRED_PROVIDER_virtual/package = "package1"</screen>
|
||||
</para>
|
||||
</example>
|
||||
<example>
|
||||
<title>Specifying version preference</title>
|
||||
<para>When there are multiple <quote>versions</quote> of a given package, BitBake defaults to selecting the most recent version, unless otherwise specified. If the .bb in question has a <varname>DEFAULT_PREFERENCE</varname> set lower than the other .bb's (default is 0), then it will not be selected. This allows the person or persons maintaining the repository of .bb files to specify their preference for the default selected version. In addition, the user can specify their preferred version.</para>
|
||||
<para>When there are multiple <quote>versions</quote> of a given package, bitbake defaults to selecting the most recent version, unless otherwise specified. If the .bb in question has a <varname>DEFAULT_PREFERENCE</varname> set lower than the other .bb's (default is 0), then it will not be selected. This allows the person or persons maintaining the repository of .bb files to specify their preferences for the default selected version. In addition, the user can specify their preferences with regard to version.</para>
|
||||
<para>If the first .bb is named <filename>a_1.1.bb</filename>, then the <varname>PN</varname> variable will be set to <quote>a</quote>, and the <varname>PV</varname> variable will be set to 1.1.</para>
|
||||
<para>If we then have an <filename>a_1.2.bb</filename>, BitBake will choose 1.2 by default. However, if we define the following variable in a .conf that BitBake parses, we can change that.
|
||||
<para>If we then have an <filename>a_1.2.bb</filename>, bitbake will choose 1.2 by default. However, if we define the following variable in a .conf that bitbake parses, we can change that.
|
||||
<screen>PREFERRED_VERSION_a = "1.1"</screen>
|
||||
</para>
|
||||
</example>
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
# with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
__version__ = "1.15.0"
|
||||
__version__ = "1.11.0"
|
||||
|
||||
import sys
|
||||
if sys.version_info < (2, 6, 0):
|
||||
@@ -29,7 +29,7 @@ if sys.version_info < (2, 6, 0):
|
||||
|
||||
import os
|
||||
import logging
|
||||
|
||||
import traceback
|
||||
|
||||
class NullHandler(logging.Handler):
|
||||
def emit(self, record):
|
||||
@@ -51,12 +51,15 @@ class BBLogger(Logger):
|
||||
def verbose(self, msg, *args, **kwargs):
|
||||
return self.log(logging.INFO - 1, msg, *args, **kwargs)
|
||||
|
||||
def exception(self, msg, *args, **kwargs):
|
||||
return self.critical("%s\n%s" % (msg, traceback.format_exc()), *args, **kwargs)
|
||||
|
||||
logging.raiseExceptions = False
|
||||
logging.setLoggerClass(BBLogger)
|
||||
|
||||
logger = logging.getLogger("BitBake")
|
||||
logger.addHandler(NullHandler())
|
||||
logger.setLevel(logging.DEBUG - 2)
|
||||
logger.setLevel(logging.INFO)
|
||||
|
||||
# This has to be imported after the setLoggerClass, as the import of bb.msg
|
||||
# can result in construction of the various loggers.
|
||||
@@ -67,7 +70,7 @@ if "BBDEBUG" in os.environ:
|
||||
if level:
|
||||
bb.msg.set_debug_level(level)
|
||||
|
||||
if os.environ.get("BBFETCH2"):
|
||||
if True or os.environ.get("BBFETCH2"):
|
||||
from bb import fetch2 as fetch
|
||||
sys.modules['bb.fetch'] = sys.modules['bb.fetch2']
|
||||
|
||||
@@ -76,10 +79,6 @@ def plain(*args):
|
||||
logger.plain(''.join(args))
|
||||
|
||||
def debug(lvl, *args):
|
||||
if isinstance(lvl, basestring):
|
||||
logger.warn("Passed invalid debug level '%s' to bb.debug", lvl)
|
||||
args = (lvl,) + args
|
||||
lvl = 1
|
||||
logger.debug(lvl, ''.join(args))
|
||||
|
||||
def note(*args):
|
||||
@@ -96,7 +95,7 @@ def fatal(*args):
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
def deprecated(func, name=None, advice=""):
|
||||
def deprecated(func, name = None, advice = ""):
|
||||
"""This is a decorator which can be used to mark functions
|
||||
as deprecated. It will result in a warning being emmitted
|
||||
when the function is used."""
|
||||
@@ -110,8 +109,8 @@ def deprecated(func, name=None, advice=""):
|
||||
def newFunc(*args, **kwargs):
|
||||
warnings.warn("Call to deprecated function %s%s." % (name,
|
||||
advice),
|
||||
category=DeprecationWarning,
|
||||
stacklevel=2)
|
||||
category = PendingDeprecationWarning,
|
||||
stacklevel = 2)
|
||||
return func(*args, **kwargs)
|
||||
newFunc.__name__ = func.__name__
|
||||
newFunc.__doc__ = func.__doc__
|
||||
|
||||
@@ -28,12 +28,11 @@
|
||||
import os
|
||||
import sys
|
||||
import logging
|
||||
import shlex
|
||||
import bb
|
||||
import bb.msg
|
||||
import bb.process
|
||||
from contextlib import nested
|
||||
from bb import data, event, utils
|
||||
from bb import data, event, mkdirhier, utils
|
||||
|
||||
bblogger = logging.getLogger('BitBake')
|
||||
logger = logging.getLogger('BitBake.Build')
|
||||
@@ -70,9 +69,9 @@ class TaskBase(event.Event):
|
||||
|
||||
def __init__(self, t, d ):
|
||||
self._task = t
|
||||
self._package = d.getVar("PF", 1)
|
||||
self._package = bb.data.getVar("PF", d, 1)
|
||||
event.Event.__init__(self)
|
||||
self._message = "package %s: task %s: %s" % (d.getVar("PF", 1), t, bb.event.getName(self)[4:])
|
||||
self._message = "package %s: task %s: %s" % (bb.data.getVar("PF", d, 1), t, bb.event.getName(self)[4:])
|
||||
|
||||
def getTask(self):
|
||||
return self._task
|
||||
@@ -149,7 +148,8 @@ def exec_func(func, d, dirs = None):
|
||||
adir = dirs[-1]
|
||||
else:
|
||||
adir = data.getVar('B', d, 1)
|
||||
bb.utils.mkdirhier(adir)
|
||||
if not os.path.exists(adir):
|
||||
adir = None
|
||||
|
||||
ispython = flags.get('python')
|
||||
if flags.get('fakeroot') and not flags.get('task'):
|
||||
@@ -162,7 +162,6 @@ def exec_func(func, d, dirs = None):
|
||||
lockfiles = None
|
||||
|
||||
tempdir = data.getVar('T', d, 1)
|
||||
bb.utils.mkdirhier(tempdir)
|
||||
runfile = os.path.join(tempdir, 'run.{0}.{1}'.format(func, os.getpid()))
|
||||
|
||||
with bb.utils.fileslocked(lockfiles):
|
||||
@@ -182,16 +181,16 @@ def exec_func_python(func, d, runfile, cwd=None):
|
||||
"""Execute a python BB 'function'"""
|
||||
|
||||
bbfile = d.getVar('FILE', True)
|
||||
try:
|
||||
olddir = os.getcwd()
|
||||
except OSError:
|
||||
olddir = None
|
||||
code = _functionfmt.format(function=func, body=d.getVar(func, True))
|
||||
bb.utils.mkdirhier(os.path.dirname(runfile))
|
||||
with open(runfile, 'w') as script:
|
||||
script.write(code)
|
||||
|
||||
if cwd:
|
||||
try:
|
||||
olddir = os.getcwd()
|
||||
except OSError:
|
||||
olddir = None
|
||||
os.chdir(cwd)
|
||||
|
||||
try:
|
||||
@@ -203,11 +202,8 @@ def exec_func_python(func, d, runfile, cwd=None):
|
||||
|
||||
raise FuncFailed(func, None)
|
||||
finally:
|
||||
if cwd and olddir:
|
||||
try:
|
||||
os.chdir(olddir)
|
||||
except OSError:
|
||||
pass
|
||||
if olddir:
|
||||
os.chdir(olddir)
|
||||
|
||||
def exec_func_shell(function, d, runfile, cwd=None):
|
||||
"""Execute a shell function from the metadata
|
||||
@@ -222,24 +218,28 @@ def exec_func_shell(function, d, runfile, cwd=None):
|
||||
|
||||
with open(runfile, 'w') as script:
|
||||
script.write('#!/bin/sh -e\n')
|
||||
if bb.msg.loggerDefaultVerbose:
|
||||
if logger.isEnabledFor(logging.DEBUG):
|
||||
script.write("set -x\n")
|
||||
data.emit_func(function, script, d)
|
||||
if cwd:
|
||||
script.write("cd %s\n" % cwd)
|
||||
script.write("%s\n" % function)
|
||||
os.fchmod(script.fileno(), 0775)
|
||||
|
||||
os.chmod(runfile, 0775)
|
||||
env = {
|
||||
'PATH': d.getVar('PATH', True),
|
||||
'LC_ALL': 'C',
|
||||
}
|
||||
|
||||
cmd = runfile
|
||||
|
||||
if bb.msg.loggerDefaultVerbose:
|
||||
if logger.isEnabledFor(logging.DEBUG):
|
||||
logfile = LogTee(logger, sys.stdout)
|
||||
else:
|
||||
logfile = sys.stdout
|
||||
|
||||
try:
|
||||
bb.process.run(cmd, shell=False, stdin=NULL, log=logfile)
|
||||
bb.process.run(cmd, env=env, shell=False, stdin=NULL, log=logfile)
|
||||
except bb.process.CmdError:
|
||||
logfn = d.getVar('BB_LOGFILE', True)
|
||||
raise FuncFailed(function, logfn)
|
||||
@@ -307,8 +307,6 @@ def _exec_task(fn, task, d, quieterr):
|
||||
# Ensure python logging goes to the logfile
|
||||
handler = logging.StreamHandler(logfile)
|
||||
handler.setFormatter(logformatter)
|
||||
# Always enable full debug output into task logfiles
|
||||
handler.setLevel(logging.DEBUG - 2)
|
||||
bblogger.addHandler(handler)
|
||||
|
||||
localdata.setVar('BB_LOGFILE', logfn)
|
||||
@@ -384,10 +382,10 @@ def stamp_internal(taskname, d, file_name):
|
||||
taskflagname = taskname.replace("_setscene", "")
|
||||
|
||||
if file_name:
|
||||
stamp = d.stamp_base[file_name].get(taskflagname) or d.stamp[file_name]
|
||||
stamp = d.stamp[file_name]
|
||||
extrainfo = d.stamp_extrainfo[file_name].get(taskflagname) or ""
|
||||
else:
|
||||
stamp = d.getVarFlag(taskflagname, 'stamp-base', True) or d.getVar('STAMP', True)
|
||||
stamp = d.getVar('STAMP', True)
|
||||
file_name = d.getVar('BB_FILENAME', True)
|
||||
extrainfo = d.getVarFlag(taskflagname, 'stamp-extra-info', True) or ""
|
||||
|
||||
@@ -413,12 +411,6 @@ def make_stamp(task, d, file_name = None):
|
||||
f = open(stamp, "w")
|
||||
f.close()
|
||||
|
||||
# If we're in task context, write out a signature file for each task
|
||||
# as it completes
|
||||
if not task.endswith("_setscene") and task != "do_setscene" and not file_name:
|
||||
file_name = d.getVar('BB_FILENAME', True)
|
||||
bb.parse.siggen.dump_sigtask(file_name, task, d.getVar('STAMP', True), True)
|
||||
|
||||
def del_stamp(task, d, file_name = None):
|
||||
"""
|
||||
Removes a stamp for a given task
|
||||
@@ -464,7 +456,6 @@ def add_tasks(tasklist, d):
|
||||
getTask('nostamp')
|
||||
getTask('fakeroot')
|
||||
getTask('noexec')
|
||||
getTask('umask')
|
||||
task_deps['parents'][task] = []
|
||||
for dep in flags['deps']:
|
||||
dep = data.expand(dep, d)
|
||||
|
||||
@@ -30,7 +30,8 @@
|
||||
|
||||
import os
|
||||
import logging
|
||||
from collections import defaultdict
|
||||
from collections import defaultdict, namedtuple
|
||||
import bb.data
|
||||
import bb.utils
|
||||
|
||||
logger = logging.getLogger("BitBake.Cache")
|
||||
@@ -42,15 +43,48 @@ except ImportError:
|
||||
logger.info("Importing cPickle failed. "
|
||||
"Falling back to a very slow implementation.")
|
||||
|
||||
__cache_version__ = "142"
|
||||
__cache_version__ = "138"
|
||||
|
||||
def getCacheFile(path, filename):
|
||||
return os.path.join(path, filename)
|
||||
recipe_fields = (
|
||||
'pn',
|
||||
'pv',
|
||||
'pr',
|
||||
'pe',
|
||||
'defaultpref',
|
||||
'depends',
|
||||
'provides',
|
||||
'task_deps',
|
||||
'stamp',
|
||||
'stamp_extrainfo',
|
||||
'broken',
|
||||
'not_world',
|
||||
'skipped',
|
||||
'timestamp',
|
||||
'packages',
|
||||
'packages_dynamic',
|
||||
'rdepends',
|
||||
'rdepends_pkg',
|
||||
'rprovides',
|
||||
'rprovides_pkg',
|
||||
'rrecommends',
|
||||
'rrecommends_pkg',
|
||||
'nocache',
|
||||
'variants',
|
||||
'file_depends',
|
||||
'tasks',
|
||||
'basetaskhashes',
|
||||
'hashfilename',
|
||||
'inherits',
|
||||
'summary',
|
||||
'license',
|
||||
'section',
|
||||
'fakerootenv',
|
||||
'fakerootdirs'
|
||||
)
|
||||
|
||||
# RecipeInfoCommon defines common data retrieving methods
|
||||
# from meta data for caches. CoreRecipeInfo as well as other
|
||||
# Extra RecipeInfo needs to inherit this class
|
||||
class RecipeInfoCommon(object):
|
||||
|
||||
class RecipeInfo(namedtuple('RecipeInfo', recipe_fields)):
|
||||
__slots__ = ()
|
||||
|
||||
@classmethod
|
||||
def listvar(cls, var, metadata):
|
||||
@@ -83,170 +117,66 @@ class RecipeInfoCommon(object):
|
||||
def getvar(cls, var, metadata):
|
||||
return metadata.getVar(var, True) or ''
|
||||
|
||||
|
||||
class CoreRecipeInfo(RecipeInfoCommon):
|
||||
__slots__ = ()
|
||||
|
||||
cachefile = "bb_cache.dat"
|
||||
|
||||
def __init__(self, filename, metadata):
|
||||
self.file_depends = metadata.getVar('__depends', False)
|
||||
self.timestamp = bb.parse.cached_mtime(filename)
|
||||
self.variants = self.listvar('__VARIANTS', metadata) + ['']
|
||||
self.appends = self.listvar('__BBAPPEND', metadata)
|
||||
self.nocache = self.getvar('__BB_DONT_CACHE', metadata)
|
||||
|
||||
self.skipreason = self.getvar('__SKIPPED', metadata)
|
||||
if self.skipreason:
|
||||
self.pn = self.getvar('PN', metadata) or bb.parse.BBHandler.vars_from_file(filename,metadata)[0]
|
||||
self.skipped = True
|
||||
self.provides = self.depvar('PROVIDES', metadata)
|
||||
self.rprovides = self.depvar('RPROVIDES', metadata)
|
||||
return
|
||||
|
||||
self.tasks = metadata.getVar('__BBTASKS', False)
|
||||
|
||||
self.pn = self.getvar('PN', metadata)
|
||||
self.packages = self.listvar('PACKAGES', metadata)
|
||||
if not self.pn in self.packages:
|
||||
self.packages.append(self.pn)
|
||||
|
||||
self.basetaskhashes = self.taskvar('BB_BASEHASH', self.tasks, metadata)
|
||||
self.hashfilename = self.getvar('BB_HASHFILENAME', metadata)
|
||||
|
||||
self.file_depends = metadata.getVar('__depends', False)
|
||||
self.task_deps = metadata.getVar('_task_deps', False) or {'tasks': [], 'parents': {}}
|
||||
|
||||
self.skipped = False
|
||||
self.pe = self.getvar('PE', metadata)
|
||||
self.pv = self.getvar('PV', metadata)
|
||||
self.pr = self.getvar('PR', metadata)
|
||||
self.defaultpref = self.intvar('DEFAULT_PREFERENCE', metadata)
|
||||
self.broken = self.getvar('BROKEN', metadata)
|
||||
self.not_world = self.getvar('EXCLUDE_FROM_WORLD', metadata)
|
||||
self.stamp = self.getvar('STAMP', metadata)
|
||||
self.stamp_base = self.flaglist('stamp-base', self.tasks, metadata)
|
||||
self.stamp_extrainfo = self.flaglist('stamp-extra-info', self.tasks, metadata)
|
||||
self.packages_dynamic = self.listvar('PACKAGES_DYNAMIC', metadata)
|
||||
self.depends = self.depvar('DEPENDS', metadata)
|
||||
self.provides = self.depvar('PROVIDES', metadata)
|
||||
self.rdepends = self.depvar('RDEPENDS', metadata)
|
||||
self.rprovides = self.depvar('RPROVIDES', metadata)
|
||||
self.rrecommends = self.depvar('RRECOMMENDS', metadata)
|
||||
self.rprovides_pkg = self.pkgvar('RPROVIDES', self.packages, metadata)
|
||||
self.rdepends_pkg = self.pkgvar('RDEPENDS', self.packages, metadata)
|
||||
self.rrecommends_pkg = self.pkgvar('RRECOMMENDS', self.packages, metadata)
|
||||
self.inherits = self.getvar('__inherit_cache', metadata)
|
||||
self.summary = self.getvar('SUMMARY', metadata)
|
||||
self.license = self.getvar('LICENSE', metadata)
|
||||
self.section = self.getvar('SECTION', metadata)
|
||||
self.fakerootenv = self.getvar('FAKEROOTENV', metadata)
|
||||
self.fakerootdirs = self.getvar('FAKEROOTDIRS', metadata)
|
||||
self.fakerootnoenv = self.getvar('FAKEROOTNOENV', metadata)
|
||||
@classmethod
|
||||
def make_optional(cls, default=None, **kwargs):
|
||||
"""Construct the namedtuple from the specified keyword arguments,
|
||||
with every value considered optional, using the default value if
|
||||
it was not specified."""
|
||||
for field in cls._fields:
|
||||
kwargs[field] = kwargs.get(field, default)
|
||||
return cls(**kwargs)
|
||||
|
||||
@classmethod
|
||||
def init_cacheData(cls, cachedata):
|
||||
# CacheData in Core RecipeInfo Class
|
||||
cachedata.task_deps = {}
|
||||
cachedata.pkg_fn = {}
|
||||
cachedata.pkg_pn = defaultdict(list)
|
||||
cachedata.pkg_pepvpr = {}
|
||||
cachedata.pkg_dp = {}
|
||||
def from_metadata(cls, filename, metadata):
|
||||
if cls.getvar('__SKIPPED', metadata):
|
||||
return cls.make_optional(skipped=True)
|
||||
|
||||
cachedata.stamp = {}
|
||||
cachedata.stamp_base = {}
|
||||
cachedata.stamp_extrainfo = {}
|
||||
cachedata.fn_provides = {}
|
||||
cachedata.pn_provides = defaultdict(list)
|
||||
cachedata.all_depends = []
|
||||
tasks = metadata.getVar('__BBTASKS', False)
|
||||
|
||||
cachedata.deps = defaultdict(list)
|
||||
cachedata.packages = defaultdict(list)
|
||||
cachedata.providers = defaultdict(list)
|
||||
cachedata.rproviders = defaultdict(list)
|
||||
cachedata.packages_dynamic = defaultdict(list)
|
||||
pn = cls.getvar('PN', metadata)
|
||||
packages = cls.listvar('PACKAGES', metadata)
|
||||
if not pn in packages:
|
||||
packages.append(pn)
|
||||
|
||||
cachedata.rundeps = defaultdict(lambda: defaultdict(list))
|
||||
cachedata.runrecs = defaultdict(lambda: defaultdict(list))
|
||||
cachedata.possible_world = []
|
||||
cachedata.universe_target = []
|
||||
cachedata.hashfn = {}
|
||||
return RecipeInfo(
|
||||
tasks = tasks,
|
||||
basetaskhashes = cls.taskvar('BB_BASEHASH', tasks, metadata),
|
||||
hashfilename = cls.getvar('BB_HASHFILENAME', metadata),
|
||||
|
||||
cachedata.basetaskhash = {}
|
||||
cachedata.inherits = {}
|
||||
cachedata.summary = {}
|
||||
cachedata.license = {}
|
||||
cachedata.section = {}
|
||||
cachedata.fakerootenv = {}
|
||||
cachedata.fakerootnoenv = {}
|
||||
cachedata.fakerootdirs = {}
|
||||
|
||||
def add_cacheData(self, cachedata, fn):
|
||||
cachedata.task_deps[fn] = self.task_deps
|
||||
cachedata.pkg_fn[fn] = self.pn
|
||||
cachedata.pkg_pn[self.pn].append(fn)
|
||||
cachedata.pkg_pepvpr[fn] = (self.pe, self.pv, self.pr)
|
||||
cachedata.pkg_dp[fn] = self.defaultpref
|
||||
cachedata.stamp[fn] = self.stamp
|
||||
cachedata.stamp_base[fn] = self.stamp_base
|
||||
cachedata.stamp_extrainfo[fn] = self.stamp_extrainfo
|
||||
|
||||
provides = [self.pn]
|
||||
for provide in self.provides:
|
||||
if provide not in provides:
|
||||
provides.append(provide)
|
||||
cachedata.fn_provides[fn] = provides
|
||||
|
||||
for provide in provides:
|
||||
cachedata.providers[provide].append(fn)
|
||||
if provide not in cachedata.pn_provides[self.pn]:
|
||||
cachedata.pn_provides[self.pn].append(provide)
|
||||
|
||||
for dep in self.depends:
|
||||
if dep not in cachedata.deps[fn]:
|
||||
cachedata.deps[fn].append(dep)
|
||||
if dep not in cachedata.all_depends:
|
||||
cachedata.all_depends.append(dep)
|
||||
|
||||
rprovides = self.rprovides
|
||||
for package in self.packages:
|
||||
cachedata.packages[package].append(fn)
|
||||
rprovides += self.rprovides_pkg[package]
|
||||
|
||||
for rprovide in rprovides:
|
||||
cachedata.rproviders[rprovide].append(fn)
|
||||
|
||||
for package in self.packages_dynamic:
|
||||
cachedata.packages_dynamic[package].append(fn)
|
||||
|
||||
# Build hash of runtime depends and rececommends
|
||||
for package in self.packages + [self.pn]:
|
||||
cachedata.rundeps[fn][package] = list(self.rdepends) + self.rdepends_pkg[package]
|
||||
cachedata.runrecs[fn][package] = list(self.rrecommends) + self.rrecommends_pkg[package]
|
||||
|
||||
# Collect files we may need for possible world-dep
|
||||
# calculations
|
||||
if not self.broken and not self.not_world:
|
||||
cachedata.possible_world.append(fn)
|
||||
|
||||
# create a collection of all targets for sanity checking
|
||||
# tasks, such as upstream versions, license, and tools for
|
||||
# task and image creation.
|
||||
cachedata.universe_target.append(self.pn)
|
||||
|
||||
cachedata.hashfn[fn] = self.hashfilename
|
||||
for task, taskhash in self.basetaskhashes.iteritems():
|
||||
identifier = '%s.%s' % (fn, task)
|
||||
cachedata.basetaskhash[identifier] = taskhash
|
||||
|
||||
cachedata.inherits[fn] = self.inherits
|
||||
cachedata.summary[fn] = self.summary
|
||||
cachedata.license[fn] = self.license
|
||||
cachedata.section[fn] = self.section
|
||||
cachedata.fakerootenv[fn] = self.fakerootenv
|
||||
cachedata.fakerootnoenv[fn] = self.fakerootnoenv
|
||||
cachedata.fakerootdirs[fn] = self.fakerootdirs
|
||||
file_depends = metadata.getVar('__depends', False),
|
||||
task_deps = metadata.getVar('_task_deps', False) or
|
||||
{'tasks': [], 'parents': {}},
|
||||
variants = cls.listvar('__VARIANTS', metadata) + [''],
|
||||
|
||||
skipped = False,
|
||||
timestamp = bb.parse.cached_mtime(filename),
|
||||
packages = cls.listvar('PACKAGES', metadata),
|
||||
pn = pn,
|
||||
pe = cls.getvar('PE', metadata),
|
||||
pv = cls.getvar('PV', metadata),
|
||||
pr = cls.getvar('PR', metadata),
|
||||
nocache = cls.getvar('__BB_DONT_CACHE', metadata),
|
||||
defaultpref = cls.intvar('DEFAULT_PREFERENCE', metadata),
|
||||
broken = cls.getvar('BROKEN', metadata),
|
||||
not_world = cls.getvar('EXCLUDE_FROM_WORLD', metadata),
|
||||
stamp = cls.getvar('STAMP', metadata),
|
||||
stamp_extrainfo = cls.flaglist('stamp-extra-info', tasks, metadata),
|
||||
packages_dynamic = cls.listvar('PACKAGES_DYNAMIC', metadata),
|
||||
depends = cls.depvar('DEPENDS', metadata),
|
||||
provides = cls.depvar('PROVIDES', metadata),
|
||||
rdepends = cls.depvar('RDEPENDS', metadata),
|
||||
rprovides = cls.depvar('RPROVIDES', metadata),
|
||||
rrecommends = cls.depvar('RRECOMMENDS', metadata),
|
||||
rprovides_pkg = cls.pkgvar('RPROVIDES', packages, metadata),
|
||||
rdepends_pkg = cls.pkgvar('RDEPENDS', packages, metadata),
|
||||
rrecommends_pkg = cls.pkgvar('RRECOMMENDS', packages, metadata),
|
||||
inherits = cls.getvar('__inherit_cache', metadata),
|
||||
summary = cls.getvar('SUMMARY', metadata),
|
||||
license = cls.getvar('LICENSE', metadata),
|
||||
section = cls.getvar('SECTION', metadata),
|
||||
fakerootenv = cls.getvar('FAKEROOTENV', metadata),
|
||||
fakerootdirs = cls.getvar('FAKEROOTDIRS', metadata),
|
||||
)
|
||||
|
||||
|
||||
class Cache(object):
|
||||
@@ -254,12 +184,8 @@ class Cache(object):
|
||||
BitBake Cache implementation
|
||||
"""
|
||||
|
||||
def __init__(self, data, caches_array):
|
||||
# Pass caches_array information into Cache Constructor
|
||||
# It will be used in later for deciding whether we
|
||||
# need extra cache file dump/load support
|
||||
self.caches_array = caches_array
|
||||
self.cachedir = data.getVar("CACHE", True)
|
||||
def __init__(self, data):
|
||||
self.cachedir = bb.data.getVar("CACHE", data, True)
|
||||
self.clean = set()
|
||||
self.checked = set()
|
||||
self.depends_cache = {}
|
||||
@@ -274,7 +200,7 @@ class Cache(object):
|
||||
return
|
||||
|
||||
self.has_cache = True
|
||||
self.cachefile = getCacheFile(self.cachedir, "bb_cache.dat")
|
||||
self.cachefile = os.path.join(self.cachedir, "bb_cache.dat")
|
||||
|
||||
logger.debug(1, "Using cache in '%s'", self.cachedir)
|
||||
bb.utils.mkdirhier(self.cachedir)
|
||||
@@ -282,27 +208,18 @@ class Cache(object):
|
||||
# If any of configuration.data's dependencies are newer than the
|
||||
# cache there isn't even any point in loading it...
|
||||
newest_mtime = 0
|
||||
deps = data.getVar("__base_depends")
|
||||
deps = bb.data.getVar("__base_depends", data)
|
||||
|
||||
old_mtimes = [old_mtime for _, old_mtime in deps]
|
||||
old_mtimes.append(newest_mtime)
|
||||
newest_mtime = max(old_mtimes)
|
||||
|
||||
cache_ok = True
|
||||
if self.caches_array:
|
||||
for cache_class in self.caches_array:
|
||||
if type(cache_class) is type and issubclass(cache_class, RecipeInfoCommon):
|
||||
cachefile = getCacheFile(self.cachedir, cache_class.cachefile)
|
||||
cache_ok = cache_ok and (bb.parse.cached_mtime_noerror(cachefile) >= newest_mtime)
|
||||
cache_class.init_cacheData(self)
|
||||
if cache_ok:
|
||||
if bb.parse.cached_mtime_noerror(self.cachefile) >= newest_mtime:
|
||||
self.load_cachefile()
|
||||
elif os.path.isfile(self.cachefile):
|
||||
logger.info("Out of date cache found, rebuilding...")
|
||||
|
||||
def load_cachefile(self):
|
||||
# Firstly, using core cache file information for
|
||||
# valid checking
|
||||
with open(self.cachefile, "rb") as cachefile:
|
||||
pickled = pickle.Unpickler(cachefile)
|
||||
try:
|
||||
@@ -319,52 +236,31 @@ class Cache(object):
|
||||
logger.info('Bitbake version mismatch, rebuilding...')
|
||||
return
|
||||
|
||||
cachesize = os.fstat(cachefile.fileno()).st_size
|
||||
bb.event.fire(bb.event.CacheLoadStarted(cachesize), self.data)
|
||||
|
||||
cachesize = 0
|
||||
previous_progress = 0
|
||||
previous_percent = 0
|
||||
previous_percent = 0
|
||||
while cachefile:
|
||||
try:
|
||||
key = pickled.load()
|
||||
value = pickled.load()
|
||||
except Exception:
|
||||
break
|
||||
|
||||
# Calculate the correct cachesize of all those cache files
|
||||
for cache_class in self.caches_array:
|
||||
if type(cache_class) is type and issubclass(cache_class, RecipeInfoCommon):
|
||||
cachefile = getCacheFile(self.cachedir, cache_class.cachefile)
|
||||
with open(cachefile, "rb") as cachefile:
|
||||
cachesize += os.fstat(cachefile.fileno()).st_size
|
||||
self.depends_cache[key] = value
|
||||
|
||||
bb.event.fire(bb.event.CacheLoadStarted(cachesize), self.data)
|
||||
|
||||
for cache_class in self.caches_array:
|
||||
if type(cache_class) is type and issubclass(cache_class, RecipeInfoCommon):
|
||||
cachefile = getCacheFile(self.cachedir, cache_class.cachefile)
|
||||
with open(cachefile, "rb") as cachefile:
|
||||
pickled = pickle.Unpickler(cachefile)
|
||||
while cachefile:
|
||||
try:
|
||||
key = pickled.load()
|
||||
value = pickled.load()
|
||||
except Exception:
|
||||
break
|
||||
if self.depends_cache.has_key(key):
|
||||
self.depends_cache[key].append(value)
|
||||
else:
|
||||
self.depends_cache[key] = [value]
|
||||
# only fire events on even percentage boundaries
|
||||
current_progress = cachefile.tell() + previous_progress
|
||||
current_percent = 100 * current_progress / cachesize
|
||||
if current_percent > previous_percent:
|
||||
previous_percent = current_percent
|
||||
bb.event.fire(bb.event.CacheLoadProgress(current_progress),
|
||||
self.data)
|
||||
# only fire events on even percentage boundaries
|
||||
current_progress = cachefile.tell()
|
||||
current_percent = 100 * current_progress / cachesize
|
||||
if current_percent > previous_percent:
|
||||
previous_percent = current_percent
|
||||
bb.event.fire(bb.event.CacheLoadProgress(current_progress),
|
||||
self.data)
|
||||
|
||||
previous_progress += current_progress
|
||||
bb.event.fire(bb.event.CacheLoadCompleted(cachesize,
|
||||
len(self.depends_cache)),
|
||||
self.data)
|
||||
|
||||
# Note: depends cache number is corresponding to the parsing file numbers.
|
||||
# The same file has several caches, still regarded as one item in the cache
|
||||
bb.event.fire(bb.event.CacheLoadCompleted(cachesize,
|
||||
len(self.depends_cache)),
|
||||
self.data)
|
||||
|
||||
|
||||
@staticmethod
|
||||
def virtualfn2realfn(virtualfn):
|
||||
"""
|
||||
@@ -374,9 +270,8 @@ class Cache(object):
|
||||
fn = virtualfn
|
||||
cls = ""
|
||||
if virtualfn.startswith('virtual:'):
|
||||
elems = virtualfn.split(':')
|
||||
cls = ":".join(elems[1:-1])
|
||||
fn = elems[-1]
|
||||
cls = virtualfn.split(':', 2)[1]
|
||||
fn = virtualfn.replace('virtual:' + cls + ':', '')
|
||||
return (fn, cls)
|
||||
|
||||
@staticmethod
|
||||
@@ -399,12 +294,11 @@ class Cache(object):
|
||||
|
||||
logger.debug(1, "Parsing %s (full)", fn)
|
||||
|
||||
cfgData.setVar("__ONLYFINALISE", virtual or "default")
|
||||
bb_data = cls.load_bbfile(fn, appends, cfgData)
|
||||
return bb_data[virtual]
|
||||
|
||||
@classmethod
|
||||
def parse(cls, filename, appends, configdata, caches_array):
|
||||
def parse(cls, filename, appends, configdata):
|
||||
"""Parse the specified filename, returning the recipe information"""
|
||||
infos = []
|
||||
datastores = cls.load_bbfile(filename, appends, configdata)
|
||||
@@ -416,14 +310,8 @@ class Cache(object):
|
||||
depends |= (data.getVar("__depends", False) or set())
|
||||
if depends and not variant:
|
||||
data.setVar("__depends", depends)
|
||||
|
||||
info_array = []
|
||||
for cache_class in caches_array:
|
||||
if type(cache_class) is type and issubclass(cache_class, RecipeInfoCommon):
|
||||
info = cache_class(filename, data)
|
||||
info_array.append(info)
|
||||
infos.append((virtualfn, info_array))
|
||||
|
||||
info = RecipeInfo.from_metadata(filename, data)
|
||||
infos.append((virtualfn, info))
|
||||
return infos
|
||||
|
||||
def load(self, filename, appends, configdata):
|
||||
@@ -434,17 +322,16 @@ class Cache(object):
|
||||
automatically add the information to the cache or to your
|
||||
CacheData. Use the add or add_info method to do so after
|
||||
running this, or use loadData instead."""
|
||||
cached = self.cacheValid(filename, appends)
|
||||
cached = self.cacheValid(filename)
|
||||
if cached:
|
||||
infos = []
|
||||
# info_array item is a list of [CoreRecipeInfo, XXXRecipeInfo]
|
||||
info_array = self.depends_cache[filename]
|
||||
for variant in info_array[0].variants:
|
||||
info = self.depends_cache[filename]
|
||||
for variant in info.variants:
|
||||
virtualfn = self.realfn2virtual(filename, variant)
|
||||
infos.append((virtualfn, self.depends_cache[virtualfn]))
|
||||
else:
|
||||
logger.debug(1, "Parsing %s", filename)
|
||||
return self.parse(filename, appends, configdata, self.caches_array)
|
||||
return self.parse(filename, appends, configdata)
|
||||
|
||||
return cached, infos
|
||||
|
||||
@@ -455,23 +342,23 @@ class Cache(object):
|
||||
skipped, virtuals = 0, 0
|
||||
|
||||
cached, infos = self.load(fn, appends, cfgData)
|
||||
for virtualfn, info_array in infos:
|
||||
if info_array[0].skipped:
|
||||
logger.debug(1, "Skipping %s: %s", virtualfn, info_array[0].skipreason)
|
||||
for virtualfn, info in infos:
|
||||
if info.skipped:
|
||||
logger.debug(1, "Skipping %s", virtualfn)
|
||||
skipped += 1
|
||||
else:
|
||||
self.add_info(virtualfn, info_array, cacheData, not cached)
|
||||
self.add_info(virtualfn, info, cacheData, not cached)
|
||||
virtuals += 1
|
||||
|
||||
return cached, skipped, virtuals
|
||||
|
||||
def cacheValid(self, fn, appends):
|
||||
def cacheValid(self, fn):
|
||||
"""
|
||||
Is the cache valid for fn?
|
||||
Fast version, no timestamps checked.
|
||||
"""
|
||||
if fn not in self.checked:
|
||||
self.cacheValidUpdate(fn, appends)
|
||||
self.cacheValidUpdate(fn)
|
||||
|
||||
# Is cache enabled?
|
||||
if not self.has_cache:
|
||||
@@ -480,7 +367,7 @@ class Cache(object):
|
||||
return True
|
||||
return False
|
||||
|
||||
def cacheValidUpdate(self, fn, appends):
|
||||
def cacheValidUpdate(self, fn):
|
||||
"""
|
||||
Is the cache valid for fn?
|
||||
Make thorough (slower) checks including timestamps.
|
||||
@@ -504,15 +391,15 @@ class Cache(object):
|
||||
self.remove(fn)
|
||||
return False
|
||||
|
||||
info_array = self.depends_cache[fn]
|
||||
info = self.depends_cache[fn]
|
||||
# Check the file's timestamp
|
||||
if mtime != info_array[0].timestamp:
|
||||
if mtime != info.timestamp:
|
||||
logger.debug(2, "Cache: %s changed", fn)
|
||||
self.remove(fn)
|
||||
return False
|
||||
|
||||
# Check dependencies are still valid
|
||||
depends = info_array[0].file_depends
|
||||
depends = info.file_depends
|
||||
if depends:
|
||||
for f, old_mtime in depends:
|
||||
fmtime = bb.parse.cached_mtime_noerror(f)
|
||||
@@ -529,14 +416,8 @@ class Cache(object):
|
||||
self.remove(fn)
|
||||
return False
|
||||
|
||||
if appends != info_array[0].appends:
|
||||
logger.debug(2, "Cache: appends for %s changed", fn)
|
||||
bb.note("%s to %s" % (str(appends), str(info_array[0].appends)))
|
||||
self.remove(fn)
|
||||
return False
|
||||
|
||||
invalid = False
|
||||
for cls in info_array[0].variants:
|
||||
for cls in info.variants:
|
||||
virtualfn = self.realfn2virtual(fn, cls)
|
||||
self.clean.add(virtualfn)
|
||||
if virtualfn not in self.depends_cache:
|
||||
@@ -545,7 +426,7 @@ class Cache(object):
|
||||
|
||||
# If any one of the variants is not present, mark as invalid for all
|
||||
if invalid:
|
||||
for cls in info_array[0].variants:
|
||||
for cls in info.variants:
|
||||
virtualfn = self.realfn2virtual(fn, cls)
|
||||
if virtualfn in self.clean:
|
||||
logger.debug(2, "Cache: Removing %s from cache", virtualfn)
|
||||
@@ -583,30 +464,13 @@ class Cache(object):
|
||||
logger.debug(2, "Cache is clean, not saving.")
|
||||
return
|
||||
|
||||
file_dict = {}
|
||||
pickler_dict = {}
|
||||
for cache_class in self.caches_array:
|
||||
if type(cache_class) is type and issubclass(cache_class, RecipeInfoCommon):
|
||||
cache_class_name = cache_class.__name__
|
||||
cachefile = getCacheFile(self.cachedir, cache_class.cachefile)
|
||||
file_dict[cache_class_name] = open(cachefile, "wb")
|
||||
pickler_dict[cache_class_name] = pickle.Pickler(file_dict[cache_class_name], pickle.HIGHEST_PROTOCOL)
|
||||
|
||||
pickler_dict['CoreRecipeInfo'].dump(__cache_version__)
|
||||
pickler_dict['CoreRecipeInfo'].dump(bb.__version__)
|
||||
|
||||
try:
|
||||
for key, info_array in self.depends_cache.iteritems():
|
||||
for info in info_array:
|
||||
if isinstance(info, RecipeInfoCommon):
|
||||
cache_class_name = info.__class__.__name__
|
||||
pickler_dict[cache_class_name].dump(key)
|
||||
pickler_dict[cache_class_name].dump(info)
|
||||
finally:
|
||||
for cache_class in self.caches_array:
|
||||
if type(cache_class) is type and issubclass(cache_class, RecipeInfoCommon):
|
||||
cache_class_name = cache_class.__name__
|
||||
file_dict[cache_class_name].close()
|
||||
with open(self.cachefile, "wb") as cachefile:
|
||||
pickler = pickle.Pickler(cachefile, pickle.HIGHEST_PROTOCOL)
|
||||
pickler.dump(__cache_version__)
|
||||
pickler.dump(bb.__version__)
|
||||
for key, value in self.depends_cache.iteritems():
|
||||
pickler.dump(key)
|
||||
pickler.dump(value)
|
||||
|
||||
del self.depends_cache
|
||||
|
||||
@@ -614,17 +478,15 @@ class Cache(object):
|
||||
def mtime(cachefile):
|
||||
return bb.parse.cached_mtime_noerror(cachefile)
|
||||
|
||||
def add_info(self, filename, info_array, cacheData, parsed=None):
|
||||
if isinstance(info_array[0], CoreRecipeInfo) and (not info_array[0].skipped):
|
||||
cacheData.add_from_recipeinfo(filename, info_array)
|
||||
|
||||
def add_info(self, filename, info, cacheData, parsed=None):
|
||||
cacheData.add_from_recipeinfo(filename, info)
|
||||
if not self.has_cache:
|
||||
return
|
||||
|
||||
if (info_array[0].skipped or 'SRCREVINACTION' not in info_array[0].pv) and not info_array[0].nocache:
|
||||
if 'SRCREVINACTION' not in info.pv and not info.nocache:
|
||||
if parsed:
|
||||
self.cacheclean = False
|
||||
self.depends_cache[filename] = info_array
|
||||
self.depends_cache[filename] = info
|
||||
|
||||
def add(self, file_name, data, cacheData, parsed=None):
|
||||
"""
|
||||
@@ -632,12 +494,8 @@ class Cache(object):
|
||||
"""
|
||||
|
||||
realfn = self.virtualfn2realfn(file_name)[0]
|
||||
|
||||
info_array = []
|
||||
for cache_class in self.caches_array:
|
||||
if type(cache_class) is type and issubclass(cache_class, RecipeInfoCommon):
|
||||
info_array.append(cache_class(realfn, data))
|
||||
self.add_info(file_name, info_array, cacheData, parsed)
|
||||
info = RecipeInfo.from_metadata(realfn, data)
|
||||
self.add_info(file_name, info, cacheData, parsed)
|
||||
|
||||
@staticmethod
|
||||
def load_bbfile(bbfile, appends, config):
|
||||
@@ -701,23 +559,99 @@ class CacheData(object):
|
||||
The data structures we compile from the cached data
|
||||
"""
|
||||
|
||||
def __init__(self, caches_array):
|
||||
self.caches_array = caches_array
|
||||
for cache_class in self.caches_array:
|
||||
if type(cache_class) is type and issubclass(cache_class, RecipeInfoCommon):
|
||||
cache_class.init_cacheData(self)
|
||||
|
||||
def __init__(self):
|
||||
# Direct cache variables
|
||||
self.providers = defaultdict(list)
|
||||
self.rproviders = defaultdict(list)
|
||||
self.packages = defaultdict(list)
|
||||
self.packages_dynamic = defaultdict(list)
|
||||
self.possible_world = []
|
||||
self.pkg_pn = defaultdict(list)
|
||||
self.pkg_fn = {}
|
||||
self.pkg_pepvpr = {}
|
||||
self.pkg_dp = {}
|
||||
self.pn_provides = defaultdict(list)
|
||||
self.fn_provides = {}
|
||||
self.all_depends = []
|
||||
self.deps = defaultdict(list)
|
||||
self.rundeps = defaultdict(lambda: defaultdict(list))
|
||||
self.runrecs = defaultdict(lambda: defaultdict(list))
|
||||
self.task_queues = {}
|
||||
self.task_deps = {}
|
||||
self.stamp = {}
|
||||
self.stamp_extrainfo = {}
|
||||
self.preferred = {}
|
||||
self.tasks = {}
|
||||
self.basetaskhash = {}
|
||||
self.hashfn = {}
|
||||
self.inherits = {}
|
||||
self.summary = {}
|
||||
self.license = {}
|
||||
self.section = {}
|
||||
self.fakerootenv = {}
|
||||
self.fakerootdirs = {}
|
||||
|
||||
# Indirect Cache variables (set elsewhere)
|
||||
self.ignored_dependencies = []
|
||||
self.world_target = set()
|
||||
self.bbfile_priority = {}
|
||||
self.bbfile_config_priorities = []
|
||||
|
||||
def add_from_recipeinfo(self, fn, info_array):
|
||||
for info in info_array:
|
||||
info.add_cacheData(self, fn)
|
||||
def add_from_recipeinfo(self, fn, info):
|
||||
self.task_deps[fn] = info.task_deps
|
||||
self.pkg_fn[fn] = info.pn
|
||||
self.pkg_pn[info.pn].append(fn)
|
||||
self.pkg_pepvpr[fn] = (info.pe, info.pv, info.pr)
|
||||
self.pkg_dp[fn] = info.defaultpref
|
||||
self.stamp[fn] = info.stamp
|
||||
self.stamp_extrainfo[fn] = info.stamp_extrainfo
|
||||
|
||||
|
||||
provides = [info.pn]
|
||||
for provide in info.provides:
|
||||
if provide not in provides:
|
||||
provides.append(provide)
|
||||
self.fn_provides[fn] = provides
|
||||
|
||||
for provide in provides:
|
||||
self.providers[provide].append(fn)
|
||||
if provide not in self.pn_provides[info.pn]:
|
||||
self.pn_provides[info.pn].append(provide)
|
||||
|
||||
for dep in info.depends:
|
||||
if dep not in self.deps[fn]:
|
||||
self.deps[fn].append(dep)
|
||||
if dep not in self.all_depends:
|
||||
self.all_depends.append(dep)
|
||||
|
||||
rprovides = info.rprovides
|
||||
for package in info.packages:
|
||||
self.packages[package].append(fn)
|
||||
rprovides += info.rprovides_pkg[package]
|
||||
|
||||
for rprovide in rprovides:
|
||||
self.rproviders[rprovide].append(fn)
|
||||
|
||||
for package in info.packages_dynamic:
|
||||
self.packages_dynamic[package].append(fn)
|
||||
|
||||
# Build hash of runtime depends and rececommends
|
||||
for package in info.packages + [info.pn]:
|
||||
self.rundeps[fn][package] = list(info.rdepends) + info.rdepends_pkg[package]
|
||||
self.runrecs[fn][package] = list(info.rrecommends) + info.rrecommends_pkg[package]
|
||||
|
||||
# Collect files we may need for possible world-dep
|
||||
# calculations
|
||||
if not info.broken and not info.not_world:
|
||||
self.possible_world.append(fn)
|
||||
|
||||
self.hashfn[fn] = info.hashfilename
|
||||
for task, taskhash in info.basetaskhashes.iteritems():
|
||||
identifier = '%s.%s' % (fn, task)
|
||||
self.basetaskhash[identifier] = taskhash
|
||||
|
||||
self.inherits[fn] = info.inherits
|
||||
self.summary[fn] = info.summary
|
||||
self.license[fn] = info.license
|
||||
self.section[fn] = info.section
|
||||
self.fakerootenv[fn] = info.fakerootenv
|
||||
self.fakerootdirs[fn] = info.fakerootdirs
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
# ex:ts=4:sw=4:sts=4:et
|
||||
# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
|
||||
#
|
||||
# Extra RecipeInfo will be all defined in this file. Currently,
|
||||
# Only Hob (Image Creator) Requests some extra fields. So
|
||||
# HobRecipeInfo is defined. It's named HobRecipeInfo because it
|
||||
# is introduced by 'hob'. Users could also introduce other
|
||||
# RecipeInfo or simply use those already defined RecipeInfo.
|
||||
# In the following patch, this newly defined new extra RecipeInfo
|
||||
# will be dynamically loaded and used for loading/saving the extra
|
||||
# cache fields
|
||||
|
||||
# Copyright (C) 2011, Intel Corporation. All rights reserved.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License version 2 as
|
||||
# published by the Free Software Foundation.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along
|
||||
# with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
from bb.cache import RecipeInfoCommon
|
||||
|
||||
class HobRecipeInfo(RecipeInfoCommon):
|
||||
__slots__ = ()
|
||||
|
||||
classname = "HobRecipeInfo"
|
||||
# please override this member with the correct data cache file
|
||||
# such as (bb_cache.dat, bb_extracache_hob.dat)
|
||||
cachefile = "bb_extracache_" + classname +".dat"
|
||||
|
||||
def __init__(self, filename, metadata):
|
||||
|
||||
self.summary = self.getvar('SUMMARY', metadata)
|
||||
self.license = self.getvar('LICENSE', metadata)
|
||||
self.section = self.getvar('SECTION', metadata)
|
||||
|
||||
@classmethod
|
||||
def init_cacheData(cls, cachedata):
|
||||
# CacheData in Hob RecipeInfo Class
|
||||
cachedata.summary = {}
|
||||
cachedata.license = {}
|
||||
cachedata.section = {}
|
||||
|
||||
def add_cacheData(self, cachedata, fn):
|
||||
cachedata.summary[fn] = self.summary
|
||||
cachedata.license[fn] = self.license
|
||||
cachedata.section[fn] = self.section
|
||||
@@ -21,13 +21,13 @@ def check_indent(codestr):
|
||||
"""If the code is indented, add a top level piece of code to 'remove' the indentation"""
|
||||
|
||||
i = 0
|
||||
while codestr[i] in ["\n", "\t", " "]:
|
||||
while codestr[i] in ["\n", " ", " "]:
|
||||
i = i + 1
|
||||
|
||||
if i == 0:
|
||||
return codestr
|
||||
|
||||
if codestr[i-1] == "\t" or codestr[i-1] == " ":
|
||||
if codestr[i-1] is " " or codestr[i-1] is " ":
|
||||
return "if 1:\n" + codestr
|
||||
|
||||
return codestr
|
||||
@@ -36,8 +36,8 @@ pythonparsecache = {}
|
||||
shellparsecache = {}
|
||||
|
||||
def parser_cachefile(d):
|
||||
cachedir = (d.getVar("PERSISTENT_DIR", True) or
|
||||
d.getVar("CACHE", True))
|
||||
cachedir = (bb.data.getVar("PERSISTENT_DIR", d, True) or
|
||||
bb.data.getVar("CACHE", d, True))
|
||||
if cachedir in [None, '']:
|
||||
return None
|
||||
bb.utils.mkdirhier(cachedir)
|
||||
@@ -70,159 +70,120 @@ def parser_cache_save(d):
|
||||
if not cachefile:
|
||||
return
|
||||
|
||||
glf = bb.utils.lockfile(cachefile + ".lock", shared=True)
|
||||
|
||||
i = os.getpid()
|
||||
lf = None
|
||||
while not lf:
|
||||
shellcache = {}
|
||||
pythoncache = {}
|
||||
|
||||
lf = bb.utils.lockfile(cachefile + ".lock." + str(i), retry=False)
|
||||
if not lf or os.path.exists(cachefile + "-" + str(i)):
|
||||
if lf:
|
||||
bb.utils.unlockfile(lf)
|
||||
lf = None
|
||||
i = i + 1
|
||||
continue
|
||||
|
||||
try:
|
||||
p = pickle.Unpickler(file(cachefile, "rb"))
|
||||
data, version = p.load()
|
||||
except (IOError, EOFError, ValueError):
|
||||
data, version = None, None
|
||||
|
||||
if version != PARSERCACHE_VERSION:
|
||||
shellcache = shellparsecache
|
||||
pythoncache = pythonparsecache
|
||||
else:
|
||||
for h in pythonparsecache:
|
||||
if h not in data[0]:
|
||||
pythoncache[h] = pythonparsecache[h]
|
||||
for h in shellparsecache:
|
||||
if h not in data[1]:
|
||||
shellcache[h] = shellparsecache[h]
|
||||
|
||||
p = pickle.Pickler(file(cachefile + "-" + str(i), "wb"), -1)
|
||||
p.dump([[pythoncache, shellcache], PARSERCACHE_VERSION])
|
||||
|
||||
bb.utils.unlockfile(lf)
|
||||
bb.utils.unlockfile(glf)
|
||||
|
||||
def parser_cache_savemerge(d):
|
||||
cachefile = parser_cachefile(d)
|
||||
if not cachefile:
|
||||
return
|
||||
|
||||
glf = bb.utils.lockfile(cachefile + ".lock")
|
||||
|
||||
try:
|
||||
p = pickle.Unpickler(file(cachefile, "rb"))
|
||||
data, version = p.load()
|
||||
except (IOError, EOFError):
|
||||
data, version = None, None
|
||||
|
||||
if version != PARSERCACHE_VERSION:
|
||||
data = [{}, {}]
|
||||
|
||||
for f in [y for y in os.listdir(os.path.dirname(cachefile)) if y.startswith(os.path.basename(cachefile) + '-')]:
|
||||
f = os.path.join(os.path.dirname(cachefile), f)
|
||||
try:
|
||||
p = pickle.Unpickler(file(f, "rb"))
|
||||
extradata, version = p.load()
|
||||
except (IOError, EOFError):
|
||||
extradata, version = [{}, {}], None
|
||||
|
||||
if version != PARSERCACHE_VERSION:
|
||||
continue
|
||||
|
||||
for h in extradata[0]:
|
||||
if h not in data[0]:
|
||||
data[0][h] = extradata[0][h]
|
||||
for h in extradata[1]:
|
||||
if h not in data[1]:
|
||||
data[1][h] = extradata[1][h]
|
||||
os.unlink(f)
|
||||
|
||||
p = pickle.Pickler(file(cachefile, "wb"), -1)
|
||||
p.dump([data, PARSERCACHE_VERSION])
|
||||
|
||||
bb.utils.unlockfile(glf)
|
||||
|
||||
|
||||
Logger = logging.getLoggerClass()
|
||||
class BufferedLogger(Logger):
|
||||
def __init__(self, name, level=0, target=None):
|
||||
Logger.__init__(self, name)
|
||||
self.setLevel(level)
|
||||
self.buffer = []
|
||||
self.target = target
|
||||
|
||||
def handle(self, record):
|
||||
self.buffer.append(record)
|
||||
|
||||
def flush(self):
|
||||
for record in self.buffer:
|
||||
self.target.handle(record)
|
||||
self.buffer = []
|
||||
p.dump([[pythonparsecache, shellparsecache], PARSERCACHE_VERSION])
|
||||
|
||||
class PythonParser():
|
||||
getvars = ("d.getVar", "bb.data.getVar", "data.getVar")
|
||||
execfuncs = ("bb.build.exec_func", "bb.build.exec_task")
|
||||
|
||||
def warn(self, func, arg):
|
||||
"""Warn about calls of bitbake APIs which pass a non-literal
|
||||
argument for the variable name, as we're not able to track such
|
||||
a reference.
|
||||
class ValueVisitor():
|
||||
"""Visitor to traverse a python abstract syntax tree and obtain
|
||||
the variables referenced via bitbake metadata APIs, and the external
|
||||
functions called.
|
||||
"""
|
||||
|
||||
try:
|
||||
funcstr = codegen.to_source(func)
|
||||
argstr = codegen.to_source(arg)
|
||||
except TypeError:
|
||||
self.log.debug(2, 'Failed to convert function and argument to source form')
|
||||
else:
|
||||
self.log.debug(1, self.unhandled_message % (funcstr, argstr))
|
||||
getvars = ("d.getVar", "bb.data.getVar", "data.getVar")
|
||||
expands = ("d.expand", "bb.data.expand", "data.expand")
|
||||
execs = ("bb.build.exec_func", "bb.build.exec_task")
|
||||
|
||||
def visit_Call(self, node):
|
||||
name = self.called_node_name(node.func)
|
||||
if name in self.getvars:
|
||||
if isinstance(node.args[0], ast.Str):
|
||||
self.var_references.add(node.args[0].s)
|
||||
else:
|
||||
self.warn(node.func, node.args[0])
|
||||
elif name in self.execfuncs:
|
||||
if isinstance(node.args[0], ast.Str):
|
||||
self.var_execs.add(node.args[0].s)
|
||||
else:
|
||||
self.warn(node.func, node.args[0])
|
||||
elif name and isinstance(node.func, (ast.Name, ast.Attribute)):
|
||||
self.execs.add(name)
|
||||
@classmethod
|
||||
def _compare_name(cls, strparts, node):
|
||||
"""Given a sequence of strings representing a python name,
|
||||
where the last component is the actual Name and the prior
|
||||
elements are Attribute nodes, determine if the supplied node
|
||||
matches.
|
||||
"""
|
||||
|
||||
def called_node_name(self, node):
|
||||
"""Given a called node, return its original string form"""
|
||||
components = []
|
||||
while node:
|
||||
if not strparts:
|
||||
return True
|
||||
|
||||
current, rest = strparts[0], strparts[1:]
|
||||
if isinstance(node, ast.Attribute):
|
||||
components.append(node.attr)
|
||||
node = node.value
|
||||
if current == node.attr:
|
||||
return cls._compare_name(rest, node.value)
|
||||
elif isinstance(node, ast.Name):
|
||||
components.append(node.id)
|
||||
return '.'.join(reversed(components))
|
||||
if current == node.id:
|
||||
return True
|
||||
return False
|
||||
|
||||
@classmethod
|
||||
def compare_name(cls, value, node):
|
||||
"""Convenience function for the _compare_node method, which
|
||||
can accept a string (which is split by '.' for you), or an
|
||||
iterable of strings, in which case it checks to see if any of
|
||||
them match, similar to isinstance.
|
||||
"""
|
||||
|
||||
if isinstance(value, basestring):
|
||||
return cls._compare_name(tuple(reversed(value.split("."))),
|
||||
node)
|
||||
else:
|
||||
break
|
||||
return any(cls.compare_name(item, node) for item in value)
|
||||
|
||||
def __init__(self, name, log):
|
||||
self.var_references = set()
|
||||
self.var_execs = set()
|
||||
def __init__(self, value):
|
||||
self.var_references = set()
|
||||
self.var_execs = set()
|
||||
self.direct_func_calls = set()
|
||||
self.var_expands = set()
|
||||
self.value = value
|
||||
|
||||
@classmethod
|
||||
def warn(cls, func, arg):
|
||||
"""Warn about calls of bitbake APIs which pass a non-literal
|
||||
argument for the variable name, as we're not able to track such
|
||||
a reference.
|
||||
"""
|
||||
|
||||
try:
|
||||
funcstr = codegen.to_source(func)
|
||||
argstr = codegen.to_source(arg)
|
||||
except TypeError:
|
||||
logger.debug(2, 'Failed to convert function and argument to source form')
|
||||
else:
|
||||
logger.debug(1, "Warning: in call to '%s', argument '%s' is "
|
||||
"not a literal", funcstr, argstr)
|
||||
|
||||
def visit_Call(self, node):
|
||||
if self.compare_name(self.getvars, node.func):
|
||||
if isinstance(node.args[0], ast.Str):
|
||||
self.var_references.add(node.args[0].s)
|
||||
else:
|
||||
self.warn(node.func, node.args[0])
|
||||
elif self.compare_name(self.expands, node.func):
|
||||
if isinstance(node.args[0], ast.Str):
|
||||
self.warn(node.func, node.args[0])
|
||||
self.var_expands.update(node.args[0].s)
|
||||
elif isinstance(node.args[0], ast.Call) and \
|
||||
self.compare_name(self.getvars, node.args[0].func):
|
||||
pass
|
||||
else:
|
||||
self.warn(node.func, node.args[0])
|
||||
elif self.compare_name(self.execs, node.func):
|
||||
if isinstance(node.args[0], ast.Str):
|
||||
self.var_execs.add(node.args[0].s)
|
||||
else:
|
||||
self.warn(node.func, node.args[0])
|
||||
elif isinstance(node.func, ast.Name):
|
||||
self.direct_func_calls.add(node.func.id)
|
||||
elif isinstance(node.func, ast.Attribute):
|
||||
# We must have a qualified name. Therefore we need
|
||||
# to walk the chain of 'Attribute' nodes to determine
|
||||
# the qualification.
|
||||
attr_node = node.func.value
|
||||
identifier = node.func.attr
|
||||
while isinstance(attr_node, ast.Attribute):
|
||||
identifier = attr_node.attr + "." + identifier
|
||||
attr_node = attr_node.value
|
||||
if isinstance(attr_node, ast.Name):
|
||||
identifier = attr_node.id + "." + identifier
|
||||
self.direct_func_calls.add(identifier)
|
||||
|
||||
def __init__(self):
|
||||
#self.funcdefs = set()
|
||||
self.execs = set()
|
||||
#self.external_cmds = set()
|
||||
self.references = set()
|
||||
self.log = BufferedLogger('BitBake.Data.%s' % name, logging.DEBUG, log)
|
||||
|
||||
self.unhandled_message = "in call of %s, argument '%s' is not a string literal"
|
||||
self.unhandled_message = "while parsing %s, %s" % (name, self.unhandled_message)
|
||||
|
||||
def parse_python(self, node):
|
||||
|
||||
h = hash(str(node))
|
||||
|
||||
if h in pythonparsecache:
|
||||
@@ -233,25 +194,24 @@ class PythonParser():
|
||||
code = compile(check_indent(str(node)), "<string>", "exec",
|
||||
ast.PyCF_ONLY_AST)
|
||||
|
||||
visitor = self.ValueVisitor(code)
|
||||
for n in ast.walk(code):
|
||||
if n.__class__.__name__ == "Call":
|
||||
self.visit_Call(n)
|
||||
visitor.visit_Call(n)
|
||||
|
||||
self.references.update(self.var_references)
|
||||
self.references.update(self.var_execs)
|
||||
self.references.update(visitor.var_references)
|
||||
self.references.update(visitor.var_execs)
|
||||
self.execs = visitor.direct_func_calls
|
||||
|
||||
pythonparsecache[h] = {}
|
||||
pythonparsecache[h]["refs"] = self.references
|
||||
pythonparsecache[h]["execs"] = self.execs
|
||||
|
||||
class ShellParser():
|
||||
def __init__(self, name, log):
|
||||
def __init__(self):
|
||||
self.funcdefs = set()
|
||||
self.allexecs = set()
|
||||
self.execs = set()
|
||||
self.log = BufferedLogger('BitBake.Data.%s' % name, logging.DEBUG, log)
|
||||
self.unhandled_template = "unable to handle non-literal command '%s'"
|
||||
self.unhandled_template = "while parsing %s, %s" % (name, self.unhandled_template)
|
||||
|
||||
def parse_shell(self, value):
|
||||
"""Parse the supplied shell code in a string, returning the external
|
||||
@@ -366,7 +326,8 @@ class ShellParser():
|
||||
|
||||
cmd = word[1]
|
||||
if cmd.startswith("$"):
|
||||
self.log.debug(1, self.unhandled_template % cmd)
|
||||
logger.debug(1, "Warning: execution of non-literal "
|
||||
"command '%s'", cmd)
|
||||
elif cmd == "eval":
|
||||
command = " ".join(word for _, word in words[1:])
|
||||
self.parse_shell(command)
|
||||
|
||||
@@ -30,6 +30,11 @@ Commands are queued in a CommandQueue
|
||||
|
||||
import bb.event
|
||||
import bb.cooker
|
||||
import bb.data
|
||||
|
||||
async_cmds = {}
|
||||
sync_cmds = {}
|
||||
|
||||
|
||||
class CommandCompleted(bb.event.Event):
|
||||
pass
|
||||
@@ -56,6 +61,16 @@ class Command:
|
||||
# FIXME Add lock for this
|
||||
self.currentAsyncCommand = None
|
||||
|
||||
for attr in CommandsSync.__dict__:
|
||||
command = attr[:].lower()
|
||||
method = getattr(CommandsSync, attr)
|
||||
sync_cmds[command] = (method)
|
||||
|
||||
for attr in CommandsAsync.__dict__:
|
||||
command = attr[:].lower()
|
||||
method = getattr(CommandsAsync, attr)
|
||||
async_cmds[command] = (method)
|
||||
|
||||
def runCommand(self, commandline):
|
||||
try:
|
||||
command = commandline.pop(0)
|
||||
@@ -67,7 +82,7 @@ class Command:
|
||||
if command not in CommandsAsync.__dict__:
|
||||
return "No such command"
|
||||
self.currentAsyncCommand = (command, commandline)
|
||||
self.cooker.server_registration_cb(self.cooker.runCommands, self.cooker)
|
||||
self.cooker.server.register_idle_function(self.cooker.runCommands, self.cooker)
|
||||
return True
|
||||
except:
|
||||
import traceback
|
||||
@@ -147,7 +162,7 @@ class CommandsSync:
|
||||
if len(params) > 1:
|
||||
expand = params[1]
|
||||
|
||||
return command.cooker.configuration.data.getVar(varname, expand)
|
||||
return bb.data.getVar(varname, command.cooker.configuration.data, expand)
|
||||
|
||||
def setVariable(self, command, params):
|
||||
"""
|
||||
@@ -155,14 +170,7 @@ class CommandsSync:
|
||||
"""
|
||||
varname = params[0]
|
||||
value = params[1]
|
||||
command.cooker.configuration.data.setVar(varname, value)
|
||||
|
||||
def resetCooker(self, command, params):
|
||||
"""
|
||||
Reset the cooker to its initial state, thus forcing a reparse for
|
||||
any async command that has the needcache property set to True
|
||||
"""
|
||||
command.cooker.reset()
|
||||
bb.data.setVar(varname, value, command.cooker.configuration.data)
|
||||
|
||||
|
||||
class CommandsAsync:
|
||||
@@ -216,19 +224,11 @@ class CommandsAsync:
|
||||
|
||||
def generateTargetsTree(self, command, params):
|
||||
"""
|
||||
Generate a tree of buildable targets.
|
||||
If klass is provided ensure all recipes that inherit the class are
|
||||
included in the package list.
|
||||
If pkg_list provided use that list (plus any extras brought in by
|
||||
klass) rather than generating a tree for all packages.
|
||||
Generate a tree of all buildable targets.
|
||||
"""
|
||||
klass = params[0]
|
||||
if len(params) > 1:
|
||||
pkg_list = params[1]
|
||||
else:
|
||||
pkg_list = []
|
||||
|
||||
command.cooker.generateTargetsTree(klass, pkg_list)
|
||||
command.cooker.generateTargetsTree(klass)
|
||||
command.finishAsyncCommand()
|
||||
generateTargetsTree.needcache = True
|
||||
|
||||
@@ -243,28 +243,6 @@ class CommandsAsync:
|
||||
command.finishAsyncCommand()
|
||||
findConfigFiles.needcache = True
|
||||
|
||||
def findFilesMatchingInDir(self, command, params):
|
||||
"""
|
||||
Find implementation files matching the specified pattern
|
||||
in the requested subdirectory of a BBPATH
|
||||
"""
|
||||
pattern = params[0]
|
||||
directory = params[1]
|
||||
|
||||
command.cooker.findFilesMatchingInDir(pattern, directory)
|
||||
command.finishAsyncCommand()
|
||||
findFilesMatchingInDir.needcache = True
|
||||
|
||||
def findConfigFilePath(self, command, params):
|
||||
"""
|
||||
Find the path of the requested configuration file
|
||||
"""
|
||||
configfile = params[0]
|
||||
|
||||
command.cooker.findConfigFilePath(configfile)
|
||||
command.finishAsyncCommand()
|
||||
findConfigFilePath.needcache = False
|
||||
|
||||
def showVersions(self, command, params):
|
||||
"""
|
||||
Show the currently selected versions
|
||||
@@ -303,14 +281,6 @@ class CommandsAsync:
|
||||
command.finishAsyncCommand()
|
||||
parseFiles.needcache = True
|
||||
|
||||
def reparseFiles(self, command, params):
|
||||
"""
|
||||
Reparse .bb files
|
||||
"""
|
||||
command.cooker.reparseFiles()
|
||||
command.finishAsyncCommand()
|
||||
reparseFiles.needcache = True
|
||||
|
||||
def compareRevisions(self, command, params):
|
||||
"""
|
||||
Parse the .bb files
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
"""Code pulled from future python versions, here for compatibility"""
|
||||
|
||||
def total_ordering(cls):
|
||||
"""Class decorator that fills in missing ordering methods"""
|
||||
convert = {
|
||||
'__lt__': [('__gt__', lambda self, other: other < self),
|
||||
('__le__', lambda self, other: not other < self),
|
||||
('__ge__', lambda self, other: not self < other)],
|
||||
'__le__': [('__ge__', lambda self, other: other <= self),
|
||||
('__lt__', lambda self, other: not other <= self),
|
||||
('__gt__', lambda self, other: not self <= other)],
|
||||
'__gt__': [('__lt__', lambda self, other: other > self),
|
||||
('__ge__', lambda self, other: not other > self),
|
||||
('__le__', lambda self, other: not self > other)],
|
||||
'__ge__': [('__le__', lambda self, other: other >= self),
|
||||
('__gt__', lambda self, other: not other >= self),
|
||||
('__lt__', lambda self, other: not self >= other)]
|
||||
}
|
||||
roots = set(dir(cls)) & set(convert)
|
||||
if not roots:
|
||||
raise ValueError('must define at least one ordering operation: < > <= >=')
|
||||
root = max(roots) # prefer __lt__ to __le__ to __gt__ to __ge__
|
||||
for opname, opfunc in convert[root]:
|
||||
if opname not in roots:
|
||||
opfunc.__name__ = opname
|
||||
opfunc.__doc__ = getattr(int, opname).__doc__
|
||||
setattr(cls, opname, opfunc)
|
||||
return cls
|
||||
@@ -49,7 +49,6 @@ from bb import data_smart
|
||||
from bb import codeparser
|
||||
import bb
|
||||
|
||||
logger = data_smart.logger
|
||||
_dict_type = data_smart.DataSmart
|
||||
|
||||
def init():
|
||||
@@ -160,17 +159,16 @@ def expandKeys(alterdata, readdata = None):
|
||||
ekey = todolist[key]
|
||||
renameVar(key, ekey, alterdata)
|
||||
|
||||
def inheritFromOS(d, savedenv, permitted):
|
||||
"""Inherit variables from the initial environment."""
|
||||
def inheritFromOS(d):
|
||||
"""Inherit variables from the environment."""
|
||||
exportlist = bb.utils.preserved_envvars_exported()
|
||||
for s in savedenv.keys():
|
||||
if s in permitted:
|
||||
try:
|
||||
setVar(s, getVar(s, savedenv, True), d)
|
||||
if s in exportlist:
|
||||
setVarFlag(s, "export", True, d)
|
||||
except TypeError:
|
||||
pass
|
||||
for s in os.environ.keys():
|
||||
try:
|
||||
setVar(s, os.environ[s], d)
|
||||
if s in exportlist:
|
||||
setVarFlag(s, "export", True, d)
|
||||
except TypeError:
|
||||
pass
|
||||
|
||||
def emit_var(var, o=sys.__stdout__, d = init(), all=False):
|
||||
"""Emit a variable to be sourced by a shell."""
|
||||
@@ -189,7 +187,7 @@ def emit_var(var, o=sys.__stdout__, d = init(), all=False):
|
||||
val = getVar(var, d, 1)
|
||||
except (KeyboardInterrupt, bb.build.FuncFailed):
|
||||
raise
|
||||
except Exception as exc:
|
||||
except Exception, exc:
|
||||
o.write('# expansion of %s threw %s: %s\n' % (var, exc.__class__.__name__, str(exc)))
|
||||
return 0
|
||||
|
||||
@@ -236,20 +234,25 @@ def emit_env(o=sys.__stdout__, d = init(), all=False):
|
||||
for key in keys:
|
||||
emit_var(key, o, d, all and not isfunc) and o.write('\n')
|
||||
|
||||
def exported_keys(d):
|
||||
return (key for key in d.keys() if not key.startswith('__') and
|
||||
d.getVarFlag(key, 'export') and
|
||||
not d.getVarFlag(key, 'unexport'))
|
||||
|
||||
def exported_vars(d):
|
||||
for key in exported_keys(d):
|
||||
def export_vars(d):
|
||||
keys = (key for key in d.keys() if d.getVarFlag(key, "export"))
|
||||
ret = {}
|
||||
for k in keys:
|
||||
try:
|
||||
value = d.getVar(key, True)
|
||||
except Exception:
|
||||
v = d.getVar(k, True)
|
||||
if v:
|
||||
ret[k] = v
|
||||
except (KeyboardInterrupt, bb.build.FuncFailed):
|
||||
raise
|
||||
except Exception, exc:
|
||||
pass
|
||||
return ret
|
||||
|
||||
if value is not None:
|
||||
yield key, str(value)
|
||||
def export_envvars(v, d):
|
||||
for s in os.environ.keys():
|
||||
if s not in v:
|
||||
v[s] = os.environ[s]
|
||||
return v
|
||||
|
||||
def emit_func(func, o=sys.__stdout__, d = init()):
|
||||
"""Emits all items in the data store in a format such that it can be sourced by a shell."""
|
||||
@@ -259,54 +262,48 @@ def emit_func(func, o=sys.__stdout__, d = init()):
|
||||
emit_var(key, o, d, False) and o.write('\n')
|
||||
|
||||
emit_var(func, o, d, False) and o.write('\n')
|
||||
newdeps = bb.codeparser.ShellParser(func, logger).parse_shell(d.getVar(func, True))
|
||||
newdeps = bb.codeparser.ShellParser().parse_shell(d.getVar(func, True))
|
||||
seen = set()
|
||||
while newdeps:
|
||||
deps = newdeps
|
||||
seen |= deps
|
||||
newdeps = set()
|
||||
for dep in deps:
|
||||
if d.getVarFlag(dep, "func"):
|
||||
if bb.data.getVarFlag(dep, "func", d):
|
||||
emit_var(dep, o, d, False) and o.write('\n')
|
||||
newdeps |= bb.codeparser.ShellParser(dep, logger).parse_shell(d.getVar(dep, True))
|
||||
newdeps |= bb.codeparser.ShellParser().parse_shell(d.getVar(dep, True))
|
||||
newdeps -= seen
|
||||
|
||||
def update_data(d):
|
||||
"""Performs final steps upon the datastore, including application of overrides"""
|
||||
d.finalize()
|
||||
|
||||
def build_dependencies(key, keys, shelldeps, vardepvals, d):
|
||||
def build_dependencies(key, keys, shelldeps, d):
|
||||
deps = set()
|
||||
vardeps = d.getVarFlag(key, "vardeps", True)
|
||||
try:
|
||||
value = d.getVar(key, False)
|
||||
if key in vardepvals:
|
||||
value = d.getVarFlag(key, "vardepvalue", True)
|
||||
elif d.getVarFlag(key, "func"):
|
||||
if d.getVarFlag(key, "func"):
|
||||
if d.getVarFlag(key, "python"):
|
||||
parsedvar = d.expandWithRefs(value, key)
|
||||
parser = bb.codeparser.PythonParser(key, logger)
|
||||
parsedvar = d.expandWithRefs(d.getVar(key, False), key)
|
||||
parser = bb.codeparser.PythonParser()
|
||||
parser.parse_python(parsedvar.value)
|
||||
deps = deps | parser.references
|
||||
else:
|
||||
parsedvar = d.expandWithRefs(value, key)
|
||||
parser = bb.codeparser.ShellParser(key, logger)
|
||||
parsedvar = d.expandWithRefs(d.getVar(key, False), key)
|
||||
parser = bb.codeparser.ShellParser()
|
||||
parser.parse_shell(parsedvar.value)
|
||||
deps = deps | shelldeps
|
||||
if vardeps is None:
|
||||
parser.log.flush()
|
||||
deps = deps | parsedvar.references
|
||||
deps = deps | (keys & parser.execs) | (keys & parsedvar.execs)
|
||||
else:
|
||||
parser = d.expandWithRefs(value, key)
|
||||
parser = d.expandWithRefs(d.getVar(key, False), key)
|
||||
deps |= parser.references
|
||||
deps = deps | (keys & parser.execs)
|
||||
deps |= set((vardeps or "").split())
|
||||
deps |= set((d.getVarFlag(key, "vardeps", True) or "").split())
|
||||
deps -= set((d.getVarFlag(key, "vardepsexclude", True) or "").split())
|
||||
except:
|
||||
bb.note("Error expanding variable %s" % key)
|
||||
raise
|
||||
return deps, value
|
||||
return deps
|
||||
#bb.note("Variable %s references %s and calls %s" % (key, str(deps), str(execs)))
|
||||
#d.setVarFlag(key, "vardeps", deps)
|
||||
|
||||
@@ -314,14 +311,12 @@ def generate_dependencies(d):
|
||||
|
||||
keys = set(key for key in d.keys() if not key.startswith("__"))
|
||||
shelldeps = set(key for key in keys if d.getVarFlag(key, "export") and not d.getVarFlag(key, "unexport"))
|
||||
vardepvals = set(key for key in keys if d.getVarFlag(key, "vardepvalue"))
|
||||
|
||||
deps = {}
|
||||
values = {}
|
||||
|
||||
tasklist = d.getVar('__BBTASKS') or []
|
||||
tasklist = bb.data.getVar('__BBTASKS', d) or []
|
||||
for task in tasklist:
|
||||
deps[task], values[task] = build_dependencies(task, keys, shelldeps, vardepvals, d)
|
||||
deps[task] = build_dependencies(task, keys, shelldeps, d)
|
||||
newdeps = deps[task]
|
||||
seen = set()
|
||||
while newdeps:
|
||||
@@ -330,11 +325,11 @@ def generate_dependencies(d):
|
||||
newdeps = set()
|
||||
for dep in nextdeps:
|
||||
if dep not in deps:
|
||||
deps[dep], values[dep] = build_dependencies(dep, keys, shelldeps, vardepvals, d)
|
||||
deps[dep] = build_dependencies(dep, keys, shelldeps, d)
|
||||
newdeps |= deps[dep]
|
||||
newdeps -= seen
|
||||
#print "For %s: %s" % (task, str(taskdeps[task]))
|
||||
return tasklist, deps, values
|
||||
return tasklist, deps
|
||||
|
||||
def inherits_class(klass, d):
|
||||
val = getVar('__inherit_cache', d) or []
|
||||
|
||||
@@ -68,14 +68,8 @@ class VariableParse:
|
||||
code = match.group()[3:-1]
|
||||
codeobj = compile(code.strip(), self.varname or "<expansion>", "eval")
|
||||
|
||||
parser = bb.codeparser.PythonParser(self.varname, logger)
|
||||
parser = bb.codeparser.PythonParser()
|
||||
parser.parse_python(code)
|
||||
if self.varname:
|
||||
vardeps = self.d.getVarFlag(self.varname, "vardeps", True)
|
||||
if vardeps is None:
|
||||
parser.log.flush()
|
||||
else:
|
||||
parser.log.flush()
|
||||
self.references |= parser.references
|
||||
self.execs |= parser.execs
|
||||
|
||||
@@ -146,7 +140,7 @@ class DataSmart(MutableMapping):
|
||||
|
||||
return varparse
|
||||
|
||||
def expand(self, s, varname = None):
|
||||
def expand(self, s, varname):
|
||||
return self.expandWithRefs(s, varname).value
|
||||
|
||||
|
||||
@@ -178,12 +172,11 @@ class DataSmart(MutableMapping):
|
||||
if o not in self._seen_overrides:
|
||||
continue
|
||||
|
||||
vars = self._seen_overrides[o].copy()
|
||||
vars = self._seen_overrides[o]
|
||||
for var in vars:
|
||||
name = var[:-l]
|
||||
try:
|
||||
self.setVar(name, self.getVar(var, False))
|
||||
self.delVar(var)
|
||||
except Exception:
|
||||
logger.info("Untracked delVar")
|
||||
|
||||
@@ -198,11 +191,11 @@ class DataSmart(MutableMapping):
|
||||
keep.append((a ,o))
|
||||
continue
|
||||
|
||||
if op == "_append":
|
||||
if op is "_append":
|
||||
sval = self.getVar(append, False) or ""
|
||||
sval += a
|
||||
self.setVar(append, sval)
|
||||
elif op == "_prepend":
|
||||
elif op is "_prepend":
|
||||
sval = a + (self.getVar(append, False) or "")
|
||||
self.setVar(append, sval)
|
||||
|
||||
@@ -265,19 +258,17 @@ class DataSmart(MutableMapping):
|
||||
# more cookies for the cookie monster
|
||||
if '_' in var:
|
||||
override = var[var.rfind('_')+1:]
|
||||
if len(override) > 0:
|
||||
if override not in self._seen_overrides:
|
||||
self._seen_overrides[override] = set()
|
||||
self._seen_overrides[override].add( var )
|
||||
if override not in self._seen_overrides:
|
||||
self._seen_overrides[override] = set()
|
||||
self._seen_overrides[override].add( var )
|
||||
|
||||
# setting var
|
||||
self.dict[var]["content"] = value
|
||||
|
||||
def getVar(self, var, expand=False, noweakdefault=False):
|
||||
value = self.getVarFlag(var, "content", False, noweakdefault)
|
||||
def getVar(self, var, exp):
|
||||
value = self.getVarFlag(var, "content")
|
||||
|
||||
# Call expand() separately to make use of the expand cache
|
||||
if expand and value:
|
||||
if exp and value:
|
||||
return self.expand(value, var)
|
||||
return value
|
||||
|
||||
@@ -304,34 +295,22 @@ class DataSmart(MutableMapping):
|
||||
|
||||
self.delVar(key)
|
||||
|
||||
def appendVar(self, key, value):
|
||||
value = (self.getVar(key, False) or "") + value
|
||||
self.setVar(key, value)
|
||||
|
||||
def prependVar(self, key, value):
|
||||
value = value + (self.getVar(key, False) or "")
|
||||
self.setVar(key, value)
|
||||
|
||||
def delVar(self, var):
|
||||
self.expand_cache = {}
|
||||
self.dict[var] = {}
|
||||
if '_' in var:
|
||||
override = var[var.rfind('_')+1:]
|
||||
if override and override in self._seen_overrides and var in self._seen_overrides[override]:
|
||||
self._seen_overrides[override].remove(var)
|
||||
|
||||
def setVarFlag(self, var, flag, flagvalue):
|
||||
if not var in self.dict:
|
||||
self._makeShadowCopy(var)
|
||||
self.dict[var][flag] = flagvalue
|
||||
|
||||
def getVarFlag(self, var, flag, expand=False, noweakdefault=False):
|
||||
def getVarFlag(self, var, flag, expand=False):
|
||||
local_var = self._findVar(var)
|
||||
value = None
|
||||
if local_var:
|
||||
if flag in local_var:
|
||||
value = copy.copy(local_var[flag])
|
||||
elif flag == "content" and "defaultval" in local_var and not noweakdefault:
|
||||
elif flag == "content" and "defaultval" in local_var:
|
||||
value = copy.copy(local_var["defaultval"])
|
||||
if expand and value:
|
||||
value = self.expand(value, None)
|
||||
@@ -347,14 +326,6 @@ class DataSmart(MutableMapping):
|
||||
if var in self.dict and flag in self.dict[var]:
|
||||
del self.dict[var][flag]
|
||||
|
||||
def appendVarFlag(self, key, flag, value):
|
||||
value = (self.getVarFlag(key, flag, False) or "") + value
|
||||
self.setVarFlag(key, flag, value)
|
||||
|
||||
def prependVarFlag(self, key, flag, value):
|
||||
value = value + (self.getVarFlag(key, flag, False) or "")
|
||||
self.setVarFlag(key, flag, value)
|
||||
|
||||
def setVarFlags(self, var, flags):
|
||||
if not var in self.dict:
|
||||
self._makeShadowCopy(var)
|
||||
@@ -427,22 +398,18 @@ class DataSmart(MutableMapping):
|
||||
yield key
|
||||
|
||||
def __iter__(self):
|
||||
def keylist(d):
|
||||
klist = set()
|
||||
for key in d:
|
||||
if key == "_data":
|
||||
continue
|
||||
if not d[key]:
|
||||
continue
|
||||
klist.add(key)
|
||||
|
||||
seen = set()
|
||||
def _keys(d):
|
||||
if "_data" in d:
|
||||
klist |= keylist(d["_data"])
|
||||
for key in _keys(d["_data"]):
|
||||
yield key
|
||||
|
||||
return klist
|
||||
|
||||
for k in keylist(self.dict):
|
||||
yield k
|
||||
for key in d:
|
||||
if key != "_data":
|
||||
if not key in seen:
|
||||
seen.add(key)
|
||||
yield key
|
||||
return _keys(self.dict)
|
||||
|
||||
def __len__(self):
|
||||
return len(frozenset(self))
|
||||
|
||||
@@ -30,7 +30,6 @@ except ImportError:
|
||||
import pickle
|
||||
import logging
|
||||
import atexit
|
||||
import traceback
|
||||
import bb.utils
|
||||
|
||||
# This is the pid for which we should generate the event. This is set when
|
||||
@@ -38,8 +37,6 @@ import bb.utils
|
||||
worker_pid = 0
|
||||
worker_pipe = None
|
||||
|
||||
logger = logging.getLogger('BitBake.Event')
|
||||
|
||||
class Event(object):
|
||||
"""Base class for events"""
|
||||
|
||||
@@ -61,37 +58,23 @@ _ui_handler_seq = 0
|
||||
bb.utils._context["NotHandled"] = NotHandled
|
||||
bb.utils._context["Handled"] = Handled
|
||||
|
||||
def execute_handler(name, handler, event, d):
|
||||
event.data = d
|
||||
try:
|
||||
ret = handler(event)
|
||||
except bb.parse.SkipPackage:
|
||||
raise
|
||||
except Exception:
|
||||
etype, value, tb = sys.exc_info()
|
||||
logger.error("Execution of event handler '%s' failed" % name,
|
||||
exc_info=(etype, value, tb.tb_next))
|
||||
raise
|
||||
except SystemExit as exc:
|
||||
if exc.code != 0:
|
||||
logger.error("Execution of event handler '%s' failed" % name)
|
||||
raise
|
||||
finally:
|
||||
del event.data
|
||||
|
||||
if ret is not None:
|
||||
warnings.warn("Using Handled/NotHandled in event handlers is deprecated",
|
||||
DeprecationWarning, stacklevel = 2)
|
||||
|
||||
def fire_class_handlers(event, d):
|
||||
if isinstance(event, logging.LogRecord):
|
||||
return
|
||||
|
||||
for name, handler in _handlers.iteritems():
|
||||
try:
|
||||
execute_handler(name, handler, event, d)
|
||||
except Exception:
|
||||
continue
|
||||
for handler in _handlers:
|
||||
h = _handlers[handler]
|
||||
event.data = d
|
||||
if type(h).__name__ == "code":
|
||||
locals = {"e": event}
|
||||
bb.utils.simple_exec(h, locals)
|
||||
ret = bb.utils.better_eval("tmpHandler(e)", locals)
|
||||
if ret is not None:
|
||||
warnings.warn("Using Handled/NotHandled in event handlers is deprecated",
|
||||
DeprecationWarning, stacklevel = 2)
|
||||
else:
|
||||
h(event)
|
||||
del event.data
|
||||
|
||||
ui_queue = []
|
||||
@atexit.register
|
||||
@@ -104,7 +87,8 @@ def print_ui_queue():
|
||||
console = logging.StreamHandler(sys.stdout)
|
||||
console.setFormatter(BBLogFormatter("%(levelname)s: %(message)s"))
|
||||
logger.handlers = [console]
|
||||
for event in ui_queue:
|
||||
while ui_queue:
|
||||
event = ui_queue.pop()
|
||||
if isinstance(event, logging.LogRecord):
|
||||
logger.handle(event)
|
||||
|
||||
@@ -121,10 +105,7 @@ def fire_ui_handlers(event, d):
|
||||
# We use pickle here since it better handles object instances
|
||||
# which xmlrpc's marshaller does not. Events *must* be serializable
|
||||
# by pickle.
|
||||
if hasattr(_ui_handlers[h].event, "sendpickle"):
|
||||
_ui_handlers[h].event.sendpickle((pickle.dumps(event)))
|
||||
else:
|
||||
_ui_handlers[h].event.send(event)
|
||||
_ui_handlers[h].event.send((pickle.dumps(event)))
|
||||
except:
|
||||
errors.append(h)
|
||||
for h in errors:
|
||||
@@ -155,7 +136,6 @@ def fire_from_worker(event, d):
|
||||
event = pickle.loads(event[7:-8])
|
||||
fire_ui_handlers(event, d)
|
||||
|
||||
noop = lambda _: None
|
||||
def register(name, handler):
|
||||
"""Register an Event handler"""
|
||||
|
||||
@@ -166,18 +146,9 @@ def register(name, handler):
|
||||
if handler is not None:
|
||||
# handle string containing python code
|
||||
if isinstance(handler, basestring):
|
||||
tmp = "def %s(e):\n%s" % (name, handler)
|
||||
try:
|
||||
code = compile(tmp, "%s(e)" % name, "exec")
|
||||
except SyntaxError:
|
||||
logger.error("Unable to register event handler '%s':\n%s", name,
|
||||
''.join(traceback.format_exc(limit=0)))
|
||||
_handlers[name] = noop
|
||||
return
|
||||
env = {}
|
||||
bb.utils.simple_exec(code, env)
|
||||
func = bb.utils.better_eval(name, env)
|
||||
_handlers[name] = func
|
||||
tmp = "def tmpHandler(e):\n%s" % handler
|
||||
comp = bb.utils.better_compile(tmp, "tmpHandler(e)", "bb.event._registerCode")
|
||||
_handlers[name] = comp
|
||||
else:
|
||||
_handlers[name] = handler
|
||||
|
||||
@@ -207,17 +178,13 @@ def getName(e):
|
||||
class ConfigParsed(Event):
|
||||
"""Configuration Parsing Complete"""
|
||||
|
||||
class RecipeEvent(Event):
|
||||
class RecipeParsed(Event):
|
||||
""" Recipe Parsing Complete """
|
||||
|
||||
def __init__(self, fn):
|
||||
self.fn = fn
|
||||
Event.__init__(self)
|
||||
|
||||
class RecipePreFinalise(RecipeEvent):
|
||||
""" Recipe Parsing Complete but not yet finialised"""
|
||||
|
||||
class RecipeParsed(RecipeEvent):
|
||||
""" Recipe Parsing Complete """
|
||||
|
||||
class StampUpdate(Event):
|
||||
"""Trigger for any adjustment of the stamp files to happen"""
|
||||
|
||||
@@ -289,12 +256,11 @@ class BuildCompleted(BuildBase):
|
||||
class NoProvider(Event):
|
||||
"""No Provider for an Event"""
|
||||
|
||||
def __init__(self, item, runtime=False, dependees=None, reasons=[]):
|
||||
def __init__(self, item, runtime=False, dependees=None):
|
||||
Event.__init__(self)
|
||||
self._item = item
|
||||
self._runtime = runtime
|
||||
self._dependees = dependees
|
||||
self._reasons = reasons
|
||||
|
||||
def getItem(self):
|
||||
return self._item
|
||||
@@ -392,16 +358,6 @@ class TargetsTreeGenerated(Event):
|
||||
Event.__init__(self)
|
||||
self._model = model
|
||||
|
||||
class FilesMatchingFound(Event):
|
||||
"""
|
||||
Event when a list of files matching the supplied pattern has
|
||||
been generated
|
||||
"""
|
||||
def __init__(self, pattern, matches):
|
||||
Event.__init__(self)
|
||||
self._pattern = pattern
|
||||
self._matches = matches
|
||||
|
||||
class ConfigFilesFound(Event):
|
||||
"""
|
||||
Event when a list of appropriate config files has been generated
|
||||
@@ -411,14 +367,6 @@ class ConfigFilesFound(Event):
|
||||
self._variable = variable
|
||||
self._values = values
|
||||
|
||||
class ConfigFilePathFound(Event):
|
||||
"""
|
||||
Event when a path for a config file has been found
|
||||
"""
|
||||
def __init__(self, path):
|
||||
Event.__init__(self)
|
||||
self._path = path
|
||||
|
||||
class MsgBase(Event):
|
||||
"""Base class for messages"""
|
||||
|
||||
@@ -448,12 +396,6 @@ class LogHandler(logging.Handler):
|
||||
"""Dispatch logging messages as bitbake events"""
|
||||
|
||||
def emit(self, record):
|
||||
if record.exc_info:
|
||||
etype, value, tb = record.exc_info
|
||||
if hasattr(tb, 'tb_next'):
|
||||
tb = list(bb.exceptions.extract_traceback(tb, context=3))
|
||||
record.bb_exc_info = (etype, value, tb)
|
||||
record.exc_info = None
|
||||
fire(record, None)
|
||||
|
||||
def filter(self, record):
|
||||
|
||||
@@ -1,84 +0,0 @@
|
||||
from __future__ import absolute_import
|
||||
import inspect
|
||||
import traceback
|
||||
import bb.namedtuple_with_abc
|
||||
from collections import namedtuple
|
||||
|
||||
|
||||
class TracebackEntry(namedtuple.abc):
|
||||
"""Pickleable representation of a traceback entry"""
|
||||
_fields = 'filename lineno function args code_context index'
|
||||
_header = ' File "{0.filename}", line {0.lineno}, in {0.function}{0.args}'
|
||||
|
||||
def format(self, formatter=None):
|
||||
if not self.code_context:
|
||||
return self._header.format(self) + '\n'
|
||||
|
||||
formatted = [self._header.format(self) + ':\n']
|
||||
|
||||
for lineindex, line in enumerate(self.code_context):
|
||||
if formatter:
|
||||
line = formatter(line)
|
||||
|
||||
if lineindex == self.index:
|
||||
formatted.append(' >%s' % line)
|
||||
else:
|
||||
formatted.append(' %s' % line)
|
||||
return formatted
|
||||
|
||||
def __str__(self):
|
||||
return ''.join(self.format())
|
||||
|
||||
def _get_frame_args(frame):
|
||||
"""Get the formatted arguments and class (if available) for a frame"""
|
||||
arginfo = inspect.getargvalues(frame)
|
||||
if not arginfo.args:
|
||||
return '', None
|
||||
|
||||
firstarg = arginfo.args[0]
|
||||
if firstarg == 'self':
|
||||
self = arginfo.locals['self']
|
||||
cls = self.__class__.__name__
|
||||
|
||||
arginfo.args.pop(0)
|
||||
del arginfo.locals['self']
|
||||
else:
|
||||
cls = None
|
||||
|
||||
formatted = inspect.formatargvalues(*arginfo)
|
||||
return formatted, cls
|
||||
|
||||
def extract_traceback(tb, context=1):
|
||||
frames = inspect.getinnerframes(tb, context)
|
||||
for frame, filename, lineno, function, code_context, index in frames:
|
||||
formatted_args, cls = _get_frame_args(frame)
|
||||
if cls:
|
||||
function = '%s.%s' % (cls, function)
|
||||
yield TracebackEntry(filename, lineno, function, formatted_args,
|
||||
code_context, index)
|
||||
|
||||
def format_extracted(extracted, formatter=None, limit=None):
|
||||
if limit:
|
||||
extracted = extracted[-limit:]
|
||||
|
||||
formatted = []
|
||||
for tracebackinfo in extracted:
|
||||
formatted.extend(tracebackinfo.format(formatter))
|
||||
return formatted
|
||||
|
||||
|
||||
def format_exception(etype, value, tb, context=1, limit=None, formatter=None):
|
||||
formatted = ['Traceback (most recent call last):\n']
|
||||
|
||||
if hasattr(tb, 'tb_next'):
|
||||
tb = extract_traceback(tb, context)
|
||||
|
||||
formatted.extend(format_extracted(tb, formatter, limit))
|
||||
formatted.extend(traceback.format_exception_only(etype, value))
|
||||
return formatted
|
||||
|
||||
def to_string(exc):
|
||||
if isinstance(exc, SystemExit):
|
||||
if not isinstance(exc.code, basestring):
|
||||
return 'Exited with "%d"' % exc.code
|
||||
return str(exc)
|
||||
@@ -153,18 +153,18 @@ def fetcher_init(d):
|
||||
Called to initialize the fetchers once the configuration data is known.
|
||||
Calls before this must not hit the cache.
|
||||
"""
|
||||
pd = persist_data.persist(d)
|
||||
# When to drop SCM head revisions controlled by user policy
|
||||
srcrev_policy = d.getVar('BB_SRCREV_POLICY', 1) or "clear"
|
||||
srcrev_policy = bb.data.getVar('BB_SRCREV_POLICY', d, 1) or "clear"
|
||||
if srcrev_policy == "cache":
|
||||
logger.debug(1, "Keeping SRCREV cache due to cache policy of: %s", srcrev_policy)
|
||||
elif srcrev_policy == "clear":
|
||||
logger.debug(1, "Clearing SRCREV cache due to cache policy of: %s", srcrev_policy)
|
||||
revs = persist_data.persist('BB_URI_HEADREVS', d)
|
||||
try:
|
||||
bb.fetch.saved_headrevs = revs.items()
|
||||
bb.fetch.saved_headrevs = pd['BB_URI_HEADREVS'].items()
|
||||
except:
|
||||
pass
|
||||
revs.clear()
|
||||
del pd['BB_URI_HEADREVS']
|
||||
else:
|
||||
raise FetchError("Invalid SRCREV cache policy of: %s" % srcrev_policy)
|
||||
|
||||
@@ -178,7 +178,8 @@ def fetcher_compare_revisions(d):
|
||||
return true/false on whether they've changed.
|
||||
"""
|
||||
|
||||
data = persist_data.persist('BB_URI_HEADREVS', d).items()
|
||||
pd = persist_data.persist(d)
|
||||
data = pd['BB_URI_HEADREVS'].items()
|
||||
data2 = bb.fetch.saved_headrevs
|
||||
|
||||
changed = False
|
||||
@@ -200,7 +201,7 @@ def fetcher_compare_revisions(d):
|
||||
def init(urls, d, setup = True):
|
||||
urldata = {}
|
||||
|
||||
fn = d.getVar('FILE', 1)
|
||||
fn = bb.data.getVar('FILE', d, 1)
|
||||
if fn in urldata_cache:
|
||||
urldata = urldata_cache[fn]
|
||||
|
||||
@@ -243,7 +244,7 @@ def verify_checksum(u, ud, d):
|
||||
'SRC_URI[%s] = "%s"\nSRC_URI[%s] = "%s"',
|
||||
ud.localpath, ud.md5_name, md5data,
|
||||
ud.sha256_name, sha256data)
|
||||
if d.getVar("BB_STRICT_CHECKSUM", True) == "1":
|
||||
if bb.data.getVar("BB_STRICT_CHECKSUM", d, True) == "1":
|
||||
raise FetchError("No checksum specified for %s." % u)
|
||||
return
|
||||
|
||||
@@ -276,7 +277,7 @@ def go(d, urls = None):
|
||||
|
||||
if m.try_premirror(u, ud, d):
|
||||
# First try fetching uri, u, from PREMIRRORS
|
||||
mirrors = mirror_from_string(d.getVar('PREMIRRORS', True))
|
||||
mirrors = mirror_from_string(bb.data.getVar('PREMIRRORS', d, True))
|
||||
localpath = try_mirrors(d, u, mirrors, False, m.forcefetch(u, ud, d))
|
||||
elif os.path.exists(ud.localfile):
|
||||
localpath = ud.localfile
|
||||
@@ -291,7 +292,7 @@ def go(d, urls = None):
|
||||
# Remove any incomplete file
|
||||
bb.utils.remove(ud.localpath)
|
||||
# Finally, try fetching uri, u, from MIRRORS
|
||||
mirrors = mirror_from_string(d.getVar('MIRRORS', True))
|
||||
mirrors = mirror_from_string(bb.data.getVar('MIRRORS', d, True))
|
||||
localpath = try_mirrors (d, u, mirrors)
|
||||
if not localpath or not os.path.exists(localpath):
|
||||
raise FetchError("Unable to fetch URL %s from any source." % u)
|
||||
@@ -327,7 +328,7 @@ def checkstatus(d, urls = None):
|
||||
m = ud.method
|
||||
logger.debug(1, "Testing URL %s", u)
|
||||
# First try checking uri, u, from PREMIRRORS
|
||||
mirrors = mirror_from_string(d.getVar('PREMIRRORS', True))
|
||||
mirrors = mirror_from_string(bb.data.getVar('PREMIRRORS', d, True))
|
||||
ret = try_mirrors(d, u, mirrors, True)
|
||||
if not ret:
|
||||
# Next try checking from the original uri, u
|
||||
@@ -335,7 +336,7 @@ def checkstatus(d, urls = None):
|
||||
ret = m.checkstatus(u, ud, d)
|
||||
except:
|
||||
# Finally, try checking uri, u, from MIRRORS
|
||||
mirrors = mirror_from_string(d.getVar('MIRRORS', True))
|
||||
mirrors = mirror_from_string(bb.data.getVar('MIRRORS', d, True))
|
||||
ret = try_mirrors (d, u, mirrors, True)
|
||||
|
||||
if not ret:
|
||||
@@ -383,7 +384,7 @@ def get_srcrev(d):
|
||||
scms = []
|
||||
|
||||
# Only call setup_localpath on URIs which supports_srcrev()
|
||||
urldata = init(d.getVar('SRC_URI', 1).split(), d, False)
|
||||
urldata = init(bb.data.getVar('SRC_URI', d, 1).split(), d, False)
|
||||
for u in urldata:
|
||||
ud = urldata[u]
|
||||
if ud.method.supports_srcrev():
|
||||
@@ -395,8 +396,8 @@ def get_srcrev(d):
|
||||
logger.error("SRCREV was used yet no valid SCM was found in SRC_URI")
|
||||
raise ParameterError
|
||||
|
||||
if d.getVar('BB_SRCREV_POLICY', True) != "cache":
|
||||
d.setVar('__BB_DONT_CACHE', '1')
|
||||
if bb.data.getVar('BB_SRCREV_POLICY', d, True) != "cache":
|
||||
bb.data.setVar('__BB_DONT_CACHE', '1', d)
|
||||
|
||||
if len(scms) == 1:
|
||||
return urldata[scms[0]].method.sortable_revision(scms[0], urldata[scms[0]], d)
|
||||
@@ -404,7 +405,7 @@ def get_srcrev(d):
|
||||
#
|
||||
# Mutiple SCMs are in SRC_URI so we resort to SRCREV_FORMAT
|
||||
#
|
||||
format = d.getVar('SRCREV_FORMAT', 1)
|
||||
format = bb.data.getVar('SRCREV_FORMAT', d, 1)
|
||||
if not format:
|
||||
logger.error("The SRCREV_FORMAT variable must be set when multiple SCMs are used.")
|
||||
raise ParameterError
|
||||
@@ -539,8 +540,8 @@ class FetchData(object):
|
||||
else:
|
||||
self.md5_name = "md5sum"
|
||||
self.sha256_name = "sha256sum"
|
||||
self.md5_expected = d.getVarFlag("SRC_URI", self.md5_name)
|
||||
self.sha256_expected = d.getVarFlag("SRC_URI", self.sha256_name)
|
||||
self.md5_expected = bb.data.getVarFlag("SRC_URI", self.md5_name, d)
|
||||
self.sha256_expected = bb.data.getVarFlag("SRC_URI", self.sha256_name, d)
|
||||
|
||||
for m in methods:
|
||||
if m.supports(url, self, d):
|
||||
@@ -555,7 +556,7 @@ class FetchData(object):
|
||||
self.localpath = self.parm["localpath"]
|
||||
self.basename = os.path.basename(self.localpath)
|
||||
else:
|
||||
premirrors = d.getVar('PREMIRRORS', True)
|
||||
premirrors = bb.data.getVar('PREMIRRORS', d, True)
|
||||
local = ""
|
||||
if premirrors and self.url:
|
||||
aurl = self.url.split(";")[0]
|
||||
@@ -755,13 +756,15 @@ class Fetch(object):
|
||||
if not hasattr(self, "_latest_revision"):
|
||||
raise ParameterError
|
||||
|
||||
revs = persist_data.persist('BB_URI_HEADREVS', d)
|
||||
pd = persist_data.persist(d)
|
||||
revs = pd['BB_URI_HEADREVS']
|
||||
key = self.generate_revision_key(url, ud, d)
|
||||
try:
|
||||
return revs[key]
|
||||
except KeyError:
|
||||
revs[key] = rev = self._latest_revision(url, ud, d)
|
||||
return rev
|
||||
rev = revs[key]
|
||||
if rev != None:
|
||||
return str(rev)
|
||||
|
||||
revs[key] = rev = self._latest_revision(url, ud, d)
|
||||
return rev
|
||||
|
||||
def sortable_revision(self, url, ud, d):
|
||||
"""
|
||||
@@ -770,17 +773,18 @@ class Fetch(object):
|
||||
if hasattr(self, "_sortable_revision"):
|
||||
return self._sortable_revision(url, ud, d)
|
||||
|
||||
localcounts = persist_data.persist('BB_URI_LOCALCOUNT', d)
|
||||
pd = persist_data.persist(d)
|
||||
localcounts = pd['BB_URI_LOCALCOUNT']
|
||||
key = self.generate_revision_key(url, ud, d)
|
||||
|
||||
latest_rev = self._build_revision(url, ud, d)
|
||||
last_rev = localcounts.get(key + '_rev')
|
||||
uselocalcount = d.getVar("BB_LOCALCOUNT_OVERRIDE", True) or False
|
||||
last_rev = localcounts[key + '_rev']
|
||||
uselocalcount = bb.data.getVar("BB_LOCALCOUNT_OVERRIDE", d, True) or False
|
||||
count = None
|
||||
if uselocalcount:
|
||||
count = Fetch.localcount_internal_helper(ud, d)
|
||||
if count is None:
|
||||
count = localcounts.get(key + '_count')
|
||||
count = localcounts[key + '_count']
|
||||
|
||||
if last_rev == latest_rev:
|
||||
return str(count + "+" + latest_rev)
|
||||
@@ -803,7 +807,7 @@ class Fetch(object):
|
||||
|
||||
def generate_revision_key(self, url, ud, d):
|
||||
key = self._revision_key(url, ud, d)
|
||||
return "%s-%s" % (key, d.getVar("PN", True) or "")
|
||||
return "%s-%s" % (key, bb.data.getVar("PN", d, True) or "")
|
||||
|
||||
from . import cvs
|
||||
from . import git
|
||||
|
||||
@@ -67,15 +67,15 @@ class Bzr(Fetch):
|
||||
|
||||
options = []
|
||||
|
||||
if command == "revno":
|
||||
if command is "revno":
|
||||
bzrcmd = "%s revno %s %s://%s" % (basecmd, " ".join(options), proto, bzrroot)
|
||||
else:
|
||||
if ud.revision:
|
||||
options.append("-r %s" % ud.revision)
|
||||
|
||||
if command == "fetch":
|
||||
if command is "fetch":
|
||||
bzrcmd = "%s co %s %s://%s" % (basecmd, " ".join(options), proto, bzrroot)
|
||||
elif command == "update":
|
||||
elif command is "update":
|
||||
bzrcmd = "%s pull %s --overwrite" % (basecmd, " ".join(options))
|
||||
else:
|
||||
raise FetchError("Invalid bzr command %s" % command)
|
||||
|
||||
@@ -34,7 +34,7 @@ class Git(Fetch):
|
||||
#
|
||||
# Only enable _sortable revision if the key is set
|
||||
#
|
||||
if d.getVar("BB_GIT_CLONE_FOR_SRCREV", True):
|
||||
if bb.data.getVar("BB_GIT_CLONE_FOR_SRCREV", d, True):
|
||||
self._sortable_buildindex = self._sortable_buildindex_disabled
|
||||
def supports(self, url, ud, d):
|
||||
"""
|
||||
@@ -220,7 +220,7 @@ class Git(Fetch):
|
||||
|
||||
def generate_revision_key(self, url, ud, d, branch=False):
|
||||
key = self._revision_key(url, ud, d, branch)
|
||||
return "%s-%s" % (key, d.getVar("PN", True) or "")
|
||||
return "%s-%s" % (key, bb.data.getVar("PN", d, True) or "")
|
||||
|
||||
def _latest_revision(self, url, ud, d):
|
||||
"""
|
||||
@@ -242,48 +242,48 @@ class Git(Fetch):
|
||||
"""
|
||||
Look in the cache for the latest revision, if not present ask the SCM.
|
||||
"""
|
||||
revs = bb.persist_data.persist('BB_URI_HEADREVS', d)
|
||||
persisted = bb.persist_data.persist(d)
|
||||
revs = persisted['BB_URI_HEADREVS']
|
||||
|
||||
key = self.generate_revision_key(url, ud, d, branch=True)
|
||||
|
||||
try:
|
||||
return revs[key]
|
||||
except KeyError:
|
||||
rev = revs[key]
|
||||
if rev is None:
|
||||
# Compatibility with old key format, no branch included
|
||||
oldkey = self.generate_revision_key(url, ud, d, branch=False)
|
||||
try:
|
||||
rev = revs[oldkey]
|
||||
except KeyError:
|
||||
rev = self._latest_revision(url, ud, d)
|
||||
else:
|
||||
rev = revs[oldkey]
|
||||
if rev is not None:
|
||||
del revs[oldkey]
|
||||
else:
|
||||
rev = self._latest_revision(url, ud, d)
|
||||
revs[key] = rev
|
||||
return rev
|
||||
|
||||
return str(rev)
|
||||
|
||||
def sortable_revision(self, url, ud, d):
|
||||
"""
|
||||
|
||||
"""
|
||||
localcounts = bb.persist_data.persist('BB_URI_LOCALCOUNT', d)
|
||||
pd = bb.persist_data.persist(d)
|
||||
localcounts = pd['BB_URI_LOCALCOUNT']
|
||||
key = self.generate_revision_key(url, ud, d, branch=True)
|
||||
oldkey = self.generate_revision_key(url, ud, d, branch=False)
|
||||
|
||||
latest_rev = self._build_revision(url, ud, d)
|
||||
last_rev = localcounts.get(key + '_rev')
|
||||
last_rev = localcounts[key + '_rev']
|
||||
if last_rev is None:
|
||||
last_rev = localcounts.get(oldkey + '_rev')
|
||||
last_rev = localcounts[oldkey + '_rev']
|
||||
if last_rev is not None:
|
||||
del localcounts[oldkey + '_rev']
|
||||
localcounts[key + '_rev'] = last_rev
|
||||
|
||||
uselocalcount = d.getVar("BB_LOCALCOUNT_OVERRIDE", True) or False
|
||||
uselocalcount = bb.data.getVar("BB_LOCALCOUNT_OVERRIDE", d, True) or False
|
||||
count = None
|
||||
if uselocalcount:
|
||||
count = Fetch.localcount_internal_helper(ud, d)
|
||||
if count is None:
|
||||
count = localcounts.get(key + '_count')
|
||||
count = localcounts[key + '_count']
|
||||
if count is None:
|
||||
count = localcounts.get(oldkey + '_count')
|
||||
count = localcounts[oldkey + '_count']
|
||||
if count is not None:
|
||||
del localcounts[oldkey + '_count']
|
||||
localcounts[key + '_count'] = count
|
||||
|
||||
@@ -28,8 +28,10 @@ from __future__ import absolute_import
|
||||
from __future__ import print_function
|
||||
import os, re
|
||||
import logging
|
||||
import bb.persist_data, bb.utils
|
||||
from bb import data
|
||||
import bb
|
||||
from bb import data
|
||||
from bb import persist_data
|
||||
from bb import utils
|
||||
|
||||
__version__ = "2"
|
||||
|
||||
@@ -93,6 +95,28 @@ class ParameterError(BBFetchException):
|
||||
BBFetchException.__init__(self, msg)
|
||||
self.args = (message, url)
|
||||
|
||||
class MD5SumError(BBFetchException):
|
||||
"""Exception raised when a MD5 checksum of a file does not match for a downloaded file"""
|
||||
def __init__(self, path, wanted, got, url):
|
||||
msg = "File: '%s' has md5 checksum %s when %s was expected (from URL: '%s')" % (path, got, wanted, url)
|
||||
self.url = url
|
||||
self.path = path
|
||||
self.wanted = wanted
|
||||
self.got = got
|
||||
BBFetchException.__init__(self, msg)
|
||||
self.args = (path, wanted, got, url)
|
||||
|
||||
class SHA256SumError(MD5SumError):
|
||||
"""Exception raised when a SHA256 checksum of a file does not match for a downloaded file"""
|
||||
def __init__(self, path, wanted, got, url):
|
||||
msg = "File: '%s' has sha256 checksum %s when %s was expected (from URL: '%s')" % (path, got, wanted, url)
|
||||
self.url = url
|
||||
self.path = path
|
||||
self.wanted = wanted
|
||||
self.got = got
|
||||
BBFetchException.__init__(self, msg)
|
||||
self.args = (path, wanted, got, url)
|
||||
|
||||
class NetworkAccess(BBFetchException):
|
||||
"""Exception raised when network access is disabled but it is required."""
|
||||
def __init__(self, url, cmd):
|
||||
@@ -175,31 +199,21 @@ def uri_replace(ud, uri_find, uri_replace, d):
|
||||
uri_decoded = list(decodeurl(ud.url))
|
||||
uri_find_decoded = list(decodeurl(uri_find))
|
||||
uri_replace_decoded = list(decodeurl(uri_replace))
|
||||
logger.debug(2, "For url %s comparing %s to %s" % (uri_decoded, uri_find_decoded, uri_replace_decoded))
|
||||
result_decoded = ['', '', '', '', '', {}]
|
||||
for i in uri_find_decoded:
|
||||
loc = uri_find_decoded.index(i)
|
||||
result_decoded[loc] = uri_decoded[loc]
|
||||
if isinstance(i, basestring):
|
||||
if (re.match(i, uri_decoded[loc])):
|
||||
if not uri_replace_decoded[loc]:
|
||||
result_decoded[loc] = ""
|
||||
else:
|
||||
result_decoded[loc] = re.sub(i, uri_replace_decoded[loc], uri_decoded[loc])
|
||||
result_decoded[loc] = re.sub(i, uri_replace_decoded[loc], uri_decoded[loc])
|
||||
if uri_find_decoded.index(i) == 2:
|
||||
if ud.mirrortarball:
|
||||
if result_decoded[loc].endswith("/"):
|
||||
result_decoded[loc] = os.path.dirname(result_decoded[loc])
|
||||
result_decoded[loc] = os.path.join(result_decoded[loc], os.path.basename(ud.mirrortarball))
|
||||
result_decoded[loc] = os.path.join(os.path.dirname(result_decoded[loc]), os.path.basename(ud.mirrortarball))
|
||||
elif ud.localpath:
|
||||
if result_decoded[loc].endswith("/"):
|
||||
result_decoded[loc] = os.path.dirname(result_decoded[loc])
|
||||
result_decoded[loc] = os.path.join(result_decoded[loc], os.path.basename(ud.localpath))
|
||||
result_decoded[loc] = os.path.join(os.path.dirname(result_decoded[loc]), os.path.basename(ud.localpath))
|
||||
else:
|
||||
return ud.url
|
||||
result = encodeurl(result_decoded)
|
||||
logger.debug(2, "For url %s returning %s" % (ud.url, result))
|
||||
return result
|
||||
return encodeurl(result_decoded)
|
||||
|
||||
methods = []
|
||||
urldata_cache = {}
|
||||
@@ -210,18 +224,18 @@ def fetcher_init(d):
|
||||
Called to initialize the fetchers once the configuration data is known.
|
||||
Calls before this must not hit the cache.
|
||||
"""
|
||||
pd = persist_data.persist(d)
|
||||
# When to drop SCM head revisions controlled by user policy
|
||||
srcrev_policy = d.getVar('BB_SRCREV_POLICY', True) or "clear"
|
||||
srcrev_policy = bb.data.getVar('BB_SRCREV_POLICY', d, True) or "clear"
|
||||
if srcrev_policy == "cache":
|
||||
logger.debug(1, "Keeping SRCREV cache due to cache policy of: %s", srcrev_policy)
|
||||
elif srcrev_policy == "clear":
|
||||
logger.debug(1, "Clearing SRCREV cache due to cache policy of: %s", srcrev_policy)
|
||||
revs = bb.persist_data.persist('BB_URI_HEADREVS', d)
|
||||
try:
|
||||
bb.fetch2.saved_headrevs = revs.items()
|
||||
bb.fetch2.saved_headrevs = pd['BB_URI_HEADREVS'].items()
|
||||
except:
|
||||
pass
|
||||
revs.clear()
|
||||
del pd['BB_URI_HEADREVS']
|
||||
else:
|
||||
raise FetchError("Invalid SRCREV cache policy of: %s" % srcrev_policy)
|
||||
|
||||
@@ -235,7 +249,8 @@ def fetcher_compare_revisions(d):
|
||||
return true/false on whether they've changed.
|
||||
"""
|
||||
|
||||
data = bb.persist_data.persist('BB_URI_HEADREVS', d).items()
|
||||
pd = persist_data.persist(d)
|
||||
data = pd['BB_URI_HEADREVS'].items()
|
||||
data2 = bb.fetch2.saved_headrevs
|
||||
|
||||
changed = False
|
||||
@@ -256,8 +271,8 @@ def verify_checksum(u, ud, d):
|
||||
verify the MD5 and SHA256 checksum for downloaded src
|
||||
|
||||
return value:
|
||||
- True: a checksum matched
|
||||
- False: neither checksum matched
|
||||
- True: checksum matched
|
||||
- False: checksum unmatched
|
||||
|
||||
if checksum is missing in recipes file, "BB_STRICT_CHECKSUM" decide the return value.
|
||||
if BB_STRICT_CHECKSUM = "1" then return false as unmatched, otherwise return true as
|
||||
@@ -270,62 +285,20 @@ def verify_checksum(u, ud, d):
|
||||
md5data = bb.utils.md5_file(ud.localpath)
|
||||
sha256data = bb.utils.sha256_file(ud.localpath)
|
||||
|
||||
# If strict checking enabled and neither sum defined, raise error
|
||||
strict = d.getVar("BB_STRICT_CHECKSUM", True) or None
|
||||
if (strict and ud.md5_expected == None and ud.sha256_expected == None):
|
||||
raise FetchError('No checksum specified for %s, please add at least one to the recipe:\n'
|
||||
'SRC_URI[%s] = "%s"\nSRC_URI[%s] = "%s"' %
|
||||
(ud.localpath, ud.md5_name, md5data,
|
||||
ud.sha256_name, sha256data), u)
|
||||
|
||||
# Log missing sums so user can more easily add them
|
||||
if ud.md5_expected == None:
|
||||
logger.warn('Missing md5 SRC_URI checksum for %s, consider adding to the recipe:\n'
|
||||
'SRC_URI[%s] = "%s"',
|
||||
ud.localpath, ud.md5_name, md5data)
|
||||
|
||||
if ud.sha256_expected == None:
|
||||
logger.warn('Missing sha256 SRC_URI checksum for %s, consider adding to the recipe:\n'
|
||||
'SRC_URI[%s] = "%s"',
|
||||
ud.localpath, ud.sha256_name, sha256data)
|
||||
|
||||
md5mismatch = False
|
||||
sha256mismatch = False
|
||||
if (ud.md5_expected == None or ud.sha256_expected == None):
|
||||
logger.warn('Missing SRC_URI checksum for %s, consider adding to the recipe:\n'
|
||||
'SRC_URI[%s] = "%s"\nSRC_URI[%s] = "%s"',
|
||||
ud.localpath, ud.md5_name, md5data,
|
||||
ud.sha256_name, sha256data)
|
||||
if bb.data.getVar("BB_STRICT_CHECKSUM", d, True) == "1":
|
||||
raise FetchError("No checksum specified for %s." % u, u)
|
||||
return
|
||||
|
||||
if ud.md5_expected != md5data:
|
||||
md5mismatch = True
|
||||
raise MD5SumError(ud.localpath, ud.md5_expected, md5data, u)
|
||||
|
||||
if ud.sha256_expected != sha256data:
|
||||
sha256mismatch = True
|
||||
|
||||
# We want to alert the user if a checksum is defined in the recipe but
|
||||
# it does not match.
|
||||
msg = ""
|
||||
if md5mismatch and ud.md5_expected:
|
||||
msg = msg + "\nFile: '%s' has %s checksum %s when %s was expected (from URL: '%s')" % (ud.localpath, 'md5', md5data, ud.md5_expected, u)
|
||||
|
||||
if sha256mismatch and ud.sha256_expected:
|
||||
msg = msg + "\nFile: '%s' has %s checksum %s when %s was expected (from URL: '%s')" % (ud.localpath, 'sha256', sha256data, ud.sha256_expected, u)
|
||||
|
||||
if len(msg):
|
||||
raise FetchError('Checksum mismatch!%s' % msg, u)
|
||||
|
||||
|
||||
def update_stamp(u, ud, d):
|
||||
"""
|
||||
donestamp is file stamp indicating the whole fetching is done
|
||||
this function update the stamp after verifying the checksum
|
||||
"""
|
||||
if os.path.exists(ud.donestamp):
|
||||
# Touch the done stamp file to show active use of the download
|
||||
try:
|
||||
os.utime(ud.donestamp, None)
|
||||
except:
|
||||
# Errors aren't fatal here
|
||||
pass
|
||||
else:
|
||||
verify_checksum(u, ud, d)
|
||||
open(ud.donestamp, 'w').close()
|
||||
raise SHA256SumError(ud.localpath, ud.sha256_expected, sha256data, u)
|
||||
|
||||
def subprocess_setup():
|
||||
import signal
|
||||
@@ -336,8 +309,8 @@ def subprocess_setup():
|
||||
|
||||
def get_autorev(d):
|
||||
# only not cache src rev in autorev case
|
||||
if d.getVar('BB_SRCREV_POLICY', True) != "cache":
|
||||
d.setVar('__BB_DONT_CACHE', '1')
|
||||
if bb.data.getVar('BB_SRCREV_POLICY', d, True) != "cache":
|
||||
bb.data.setVar('__BB_DONT_CACHE', '1', d)
|
||||
return "AUTOINC"
|
||||
|
||||
def get_srcrev(d):
|
||||
@@ -350,7 +323,7 @@ def get_srcrev(d):
|
||||
"""
|
||||
|
||||
scms = []
|
||||
fetcher = Fetch(d.getVar('SRC_URI', True).split(), d)
|
||||
fetcher = Fetch(bb.data.getVar('SRC_URI', d, True).split(), d)
|
||||
urldata = fetcher.ud
|
||||
for u in urldata:
|
||||
if urldata[u].method.supports_srcrev():
|
||||
@@ -365,7 +338,7 @@ def get_srcrev(d):
|
||||
#
|
||||
# Mutiple SCMs are in SRC_URI so we resort to SRCREV_FORMAT
|
||||
#
|
||||
format = d.getVar('SRCREV_FORMAT', True)
|
||||
format = bb.data.getVar('SRCREV_FORMAT', d, True)
|
||||
if not format:
|
||||
raise FetchError("The SRCREV_FORMAT variable must be set when multiple SCMs are used.")
|
||||
|
||||
@@ -379,7 +352,7 @@ def get_srcrev(d):
|
||||
|
||||
def localpath(url, d):
|
||||
fetcher = bb.fetch2.Fetch([url], d)
|
||||
return fetcher.localpath(url)
|
||||
return fetcher.localpath(url)
|
||||
|
||||
def runfetchcmd(cmd, d, quiet = False, cleanup = []):
|
||||
"""
|
||||
@@ -396,11 +369,10 @@ def runfetchcmd(cmd, d, quiet = False, cleanup = []):
|
||||
exportvars = ['PATH', 'GIT_PROXY_COMMAND', 'GIT_PROXY_HOST',
|
||||
'GIT_PROXY_PORT', 'GIT_CONFIG', 'http_proxy', 'ftp_proxy',
|
||||
'https_proxy', 'no_proxy', 'ALL_PROXY', 'all_proxy',
|
||||
'SSH_AUTH_SOCK', 'SSH_AGENT_PID', 'HOME',
|
||||
'GIT_PROXY_IGNORE', 'SOCKS5_USER', 'SOCKS5_PASSWD']
|
||||
'SSH_AUTH_SOCK', 'SSH_AGENT_PID', 'HOME']
|
||||
|
||||
for var in exportvars:
|
||||
val = d.getVar(var, True)
|
||||
val = data.getVar(var, d, True)
|
||||
if val:
|
||||
cmd = 'export ' + var + '=\"%s\"; %s' % (val, cmd)
|
||||
|
||||
@@ -440,7 +412,7 @@ def check_network_access(d, info = "", url = None):
|
||||
"""
|
||||
log remote network access, and error if BB_NO_NETWORK is set
|
||||
"""
|
||||
if d.getVar("BB_NO_NETWORK", True) == "1":
|
||||
if bb.data.getVar("BB_NO_NETWORK", d, True) == "1":
|
||||
raise NetworkAccess(url, info)
|
||||
else:
|
||||
logger.debug(1, "Fetcher accessed the network with the command %s" % info)
|
||||
@@ -526,15 +498,15 @@ def srcrev_internal_helper(ud, d, name):
|
||||
return ud.parm['tag']
|
||||
|
||||
rev = None
|
||||
pn = d.getVar("PN", True)
|
||||
pn = data.getVar("PN", d, True)
|
||||
if name != '':
|
||||
rev = d.getVar("SRCREV_%s_pn-%s" % (name, pn), True)
|
||||
rev = data.getVar("SRCREV_%s_pn-%s" % (name, pn), d, True)
|
||||
if not rev:
|
||||
rev = d.getVar("SRCREV_%s" % name, True)
|
||||
rev = data.getVar("SRCREV_%s" % name, d, True)
|
||||
if not rev:
|
||||
rev = d.getVar("SRCREV_pn-%s" % pn, True)
|
||||
rev = data.getVar("SRCREV_pn-%s" % pn, d, True)
|
||||
if not rev:
|
||||
rev = d.getVar("SRCREV", True)
|
||||
rev = data.getVar("SRCREV", d, True)
|
||||
if rev == "INVALID":
|
||||
raise FetchError("Please set SRCREV to a valid value", ud.url)
|
||||
if rev == "AUTOINC":
|
||||
@@ -569,14 +541,8 @@ class FetchData(object):
|
||||
else:
|
||||
self.md5_name = "md5sum"
|
||||
self.sha256_name = "sha256sum"
|
||||
if self.md5_name in self.parm:
|
||||
self.md5_expected = self.parm[self.md5_name]
|
||||
else:
|
||||
self.md5_expected = d.getVarFlag("SRC_URI", self.md5_name)
|
||||
if self.sha256_name in self.parm:
|
||||
self.sha256_expected = self.parm[self.sha256_name]
|
||||
else:
|
||||
self.sha256_expected = d.getVarFlag("SRC_URI", self.sha256_name)
|
||||
self.md5_expected = bb.data.getVarFlag("SRC_URI", self.md5_name, d)
|
||||
self.sha256_expected = bb.data.getVarFlag("SRC_URI", self.sha256_name, d)
|
||||
|
||||
self.names = self.parm.get("name",'default').split(',')
|
||||
|
||||
@@ -600,7 +566,7 @@ class FetchData(object):
|
||||
self.localpath = self.method.localpath(self.url, self, d)
|
||||
|
||||
# Note: These files should always be in DL_DIR whereas localpath may not be.
|
||||
basepath = d.expand("${DL_DIR}/%s" % os.path.basename(self.localpath or self.basename))
|
||||
basepath = bb.data.expand("${DL_DIR}/%s" % os.path.basename(self.localpath or self.basename), d)
|
||||
self.donestamp = basepath + '.done'
|
||||
self.lockfile = basepath + '.lock'
|
||||
|
||||
@@ -626,12 +592,12 @@ class FetchData(object):
|
||||
if "srcdate" in self.parm:
|
||||
return self.parm['srcdate']
|
||||
|
||||
pn = d.getVar("PN", True)
|
||||
pn = data.getVar("PN", d, True)
|
||||
|
||||
if pn:
|
||||
return d.getVar("SRCDATE_%s" % pn, True) or d.getVar("SRCDATE", True) or d.getVar("DATE", True)
|
||||
return data.getVar("SRCDATE_%s" % pn, d, True) or data.getVar("SRCDATE", d, True) or data.getVar("DATE", d, True)
|
||||
|
||||
return d.getVar("SRCDATE", True) or d.getVar("DATE", True)
|
||||
return data.getVar("SRCDATE", d, True) or data.getVar("DATE", d, True)
|
||||
|
||||
class FetchMethod(object):
|
||||
"""Base class for 'fetch'ing data"""
|
||||
@@ -697,13 +663,13 @@ class FetchMethod(object):
|
||||
|
||||
try:
|
||||
unpack = bb.utils.to_boolean(urldata.parm.get('unpack'), True)
|
||||
except ValueError as exc:
|
||||
except ValueError, exc:
|
||||
bb.fatal("Invalid value for 'unpack' parameter for %s: %s" %
|
||||
(file, urldata.parm.get('unpack')))
|
||||
|
||||
dots = file.split(".")
|
||||
if dots[-1] in ['gz', 'bz2', 'Z']:
|
||||
efile = os.path.join(data.getVar('WORKDIR', True),os.path.basename('.'.join(dots[0:-1])))
|
||||
efile = os.path.join(bb.data.getVar('WORKDIR', data, True),os.path.basename('.'.join(dots[0:-1])))
|
||||
else:
|
||||
efile = file
|
||||
cmd = None
|
||||
@@ -726,7 +692,7 @@ class FetchMethod(object):
|
||||
elif file.endswith('.zip') or file.endswith('.jar'):
|
||||
try:
|
||||
dos = bb.utils.to_boolean(urldata.parm.get('dos'), False)
|
||||
except ValueError as exc:
|
||||
except ValueError, exc:
|
||||
bb.fatal("Invalid value for 'dos' parameter for %s: %s" %
|
||||
(file, urldata.parm.get('dos')))
|
||||
cmd = 'unzip -q -o'
|
||||
@@ -747,7 +713,7 @@ class FetchMethod(object):
|
||||
dest = os.path.join(rootdir, os.path.basename(file))
|
||||
if (file != dest) and not (os.path.exists(dest) and os.path.samefile(file, dest)):
|
||||
if os.path.isdir(file):
|
||||
filesdir = os.path.realpath(data.getVar("FILESDIR", True))
|
||||
filesdir = os.path.realpath(bb.data.getVar("FILESDIR", data, True))
|
||||
destdir = "."
|
||||
if file[0:len(filesdir)] == filesdir:
|
||||
destdir = file[len(filesdir):file.rfind('/')]
|
||||
@@ -779,7 +745,7 @@ class FetchMethod(object):
|
||||
bb.utils.mkdirhier(newdir)
|
||||
os.chdir(newdir)
|
||||
|
||||
cmd = "PATH=\"%s\" %s" % (data.getVar('PATH', True), cmd)
|
||||
cmd = "PATH=\"%s\" %s" % (bb.data.getVar('PATH', data, True), cmd)
|
||||
bb.note("Unpacking %s to %s/" % (file, os.getcwd()))
|
||||
ret = subprocess.call(cmd, preexec_fn=subprocess_setup, shell=True)
|
||||
|
||||
@@ -824,10 +790,10 @@ class FetchMethod(object):
|
||||
|
||||
localcount = None
|
||||
if name != '':
|
||||
pn = d.getVar("PN", True)
|
||||
localcount = d.getVar("LOCALCOUNT_" + name, True)
|
||||
pn = data.getVar("PN", d, True)
|
||||
localcount = data.getVar("LOCALCOUNT_" + name, d, True)
|
||||
if not localcount:
|
||||
localcount = d.getVar("LOCALCOUNT", True)
|
||||
localcount = data.getVar("LOCALCOUNT", d, True)
|
||||
return localcount
|
||||
|
||||
localcount_internal_helper = staticmethod(localcount_internal_helper)
|
||||
@@ -839,13 +805,15 @@ class FetchMethod(object):
|
||||
if not hasattr(self, "_latest_revision"):
|
||||
raise ParameterError("The fetcher for this URL does not support _latest_revision", url)
|
||||
|
||||
revs = bb.persist_data.persist('BB_URI_HEADREVS', d)
|
||||
pd = persist_data.persist(d)
|
||||
revs = pd['BB_URI_HEADREVS']
|
||||
key = self.generate_revision_key(url, ud, d, name)
|
||||
try:
|
||||
return revs[key]
|
||||
except KeyError:
|
||||
revs[key] = rev = self._latest_revision(url, ud, d, name)
|
||||
return rev
|
||||
rev = revs[key]
|
||||
if rev != None:
|
||||
return str(rev)
|
||||
|
||||
revs[key] = rev = self._latest_revision(url, ud, d, name)
|
||||
return rev
|
||||
|
||||
def sortable_revision(self, url, ud, d, name):
|
||||
"""
|
||||
@@ -854,17 +822,18 @@ class FetchMethod(object):
|
||||
if hasattr(self, "_sortable_revision"):
|
||||
return self._sortable_revision(url, ud, d)
|
||||
|
||||
localcounts = bb.persist_data.persist('BB_URI_LOCALCOUNT', d)
|
||||
pd = persist_data.persist(d)
|
||||
localcounts = pd['BB_URI_LOCALCOUNT']
|
||||
key = self.generate_revision_key(url, ud, d, name)
|
||||
|
||||
latest_rev = self._build_revision(url, ud, d, name)
|
||||
last_rev = localcounts.get(key + '_rev')
|
||||
uselocalcount = d.getVar("BB_LOCALCOUNT_OVERRIDE", True) or False
|
||||
last_rev = localcounts[key + '_rev']
|
||||
uselocalcount = bb.data.getVar("BB_LOCALCOUNT_OVERRIDE", d, True) or False
|
||||
count = None
|
||||
if uselocalcount:
|
||||
count = FetchMethod.localcount_internal_helper(ud, d, name)
|
||||
if count is None:
|
||||
count = localcounts.get(key + '_count') or "0"
|
||||
count = localcounts[key + '_count'] or "0"
|
||||
|
||||
if last_rev == latest_rev:
|
||||
return str(count + "+" + latest_rev)
|
||||
@@ -887,7 +856,7 @@ class FetchMethod(object):
|
||||
|
||||
def generate_revision_key(self, url, ud, d, name):
|
||||
key = self._revision_key(url, ud, d, name)
|
||||
return "%s-%s" % (key, d.getVar("PN", True) or "")
|
||||
return "%s-%s" % (key, bb.data.getVar("PN", d, True) or "")
|
||||
|
||||
class Fetch(object):
|
||||
def __init__(self, urls, d, cache = True):
|
||||
@@ -897,7 +866,7 @@ class Fetch(object):
|
||||
self.d = d
|
||||
self.ud = {}
|
||||
|
||||
fn = d.getVar('FILE', True)
|
||||
fn = bb.data.getVar('FILE', d, True)
|
||||
if cache and fn in urldata_cache:
|
||||
self.ud = urldata_cache[fn]
|
||||
|
||||
@@ -913,7 +882,7 @@ class Fetch(object):
|
||||
self.ud[url] = FetchData(url, self.d)
|
||||
|
||||
self.ud[url].setup_localpath(self.d)
|
||||
return self.d.expand(self.ud[url].localpath)
|
||||
return bb.data.expand(self.ud[url].localpath, self.d)
|
||||
|
||||
def localpaths(self):
|
||||
"""
|
||||
@@ -935,8 +904,8 @@ class Fetch(object):
|
||||
if len(urls) == 0:
|
||||
urls = self.urls
|
||||
|
||||
network = self.d.getVar("BB_NO_NETWORK", True)
|
||||
premirroronly = (self.d.getVar("BB_FETCH_PREMIRRORONLY", True) == "1")
|
||||
network = bb.data.getVar("BB_NO_NETWORK", self.d, True)
|
||||
premirroronly = (bb.data.getVar("BB_FETCH_PREMIRRORONLY", self.d, True) == "1")
|
||||
|
||||
for u in urls:
|
||||
ud = self.ud[u]
|
||||
@@ -947,17 +916,17 @@ class Fetch(object):
|
||||
lf = bb.utils.lockfile(ud.lockfile)
|
||||
|
||||
try:
|
||||
self.d.setVar("BB_NO_NETWORK", network)
|
||||
bb.data.setVar("BB_NO_NETWORK", network, self.d)
|
||||
|
||||
if not m.need_update(u, ud, self.d):
|
||||
localpath = ud.localpath
|
||||
elif m.try_premirror(u, ud, self.d):
|
||||
logger.debug(1, "Trying PREMIRRORS")
|
||||
mirrors = mirror_from_string(self.d.getVar('PREMIRRORS', True))
|
||||
mirrors = mirror_from_string(bb.data.getVar('PREMIRRORS', self.d, True))
|
||||
localpath = try_mirrors(self.d, ud, mirrors, False)
|
||||
|
||||
if premirroronly:
|
||||
self.d.setVar("BB_NO_NETWORK", "1")
|
||||
bb.data.setVar("BB_NO_NETWORK", "1", self.d)
|
||||
|
||||
if not localpath and m.need_update(u, ud, self.d):
|
||||
try:
|
||||
@@ -966,26 +935,33 @@ class Fetch(object):
|
||||
if hasattr(m, "build_mirror_data"):
|
||||
m.build_mirror_data(u, ud, self.d)
|
||||
localpath = ud.localpath
|
||||
# early checksum verify, so that if checksum mismatched,
|
||||
# fetcher still have chance to fetch from mirror
|
||||
update_stamp(u, ud, self.d)
|
||||
|
||||
except bb.fetch2.NetworkAccess:
|
||||
raise
|
||||
|
||||
except BBFetchException as e:
|
||||
logger.warn(str(e))
|
||||
logger.debug(1, str(e))
|
||||
# Remove any incomplete fetch
|
||||
if os.path.isfile(ud.localpath):
|
||||
bb.utils.remove(ud.localpath)
|
||||
logger.debug(1, "Trying MIRRORS")
|
||||
mirrors = mirror_from_string(self.d.getVar('MIRRORS', True))
|
||||
mirrors = mirror_from_string(bb.data.getVar('MIRRORS', self.d, True))
|
||||
localpath = try_mirrors (self.d, ud, mirrors)
|
||||
|
||||
if not localpath or ((not os.path.exists(localpath)) and localpath.find("*") == -1):
|
||||
raise FetchError("Unable to fetch URL %s from any source." % u, u)
|
||||
|
||||
update_stamp(u, ud, self.d)
|
||||
if os.path.exists(ud.donestamp):
|
||||
# Touch the done stamp file to show active use of the download
|
||||
try:
|
||||
os.utime(ud.donestamp, None)
|
||||
except:
|
||||
# Errors aren't fatal here
|
||||
pass
|
||||
else:
|
||||
# Only check the checksums if we've not seen this item before, then create the stamp
|
||||
verify_checksum(u, ud, self.d)
|
||||
open(ud.donestamp, 'w').close()
|
||||
|
||||
finally:
|
||||
bb.utils.unlockfile(lf)
|
||||
@@ -1004,7 +980,7 @@ class Fetch(object):
|
||||
m = ud.method
|
||||
logger.debug(1, "Testing URL %s", u)
|
||||
# First try checking uri, u, from PREMIRRORS
|
||||
mirrors = mirror_from_string(self.d.getVar('PREMIRRORS', True))
|
||||
mirrors = mirror_from_string(bb.data.getVar('PREMIRRORS', self.d, True))
|
||||
ret = try_mirrors(self.d, ud, mirrors, True)
|
||||
if not ret:
|
||||
# Next try checking from the original uri, u
|
||||
@@ -1012,7 +988,7 @@ class Fetch(object):
|
||||
ret = m.checkstatus(u, ud, self.d)
|
||||
except:
|
||||
# Finally, try checking uri, u, from MIRRORS
|
||||
mirrors = mirror_from_string(self.d.getVar('MIRRORS', True))
|
||||
mirrors = mirror_from_string(bb.data.getVar('MIRRORS', self.d, True))
|
||||
ret = try_mirrors (self.d, ud, mirrors, True)
|
||||
|
||||
if not ret:
|
||||
@@ -1030,7 +1006,7 @@ class Fetch(object):
|
||||
ud = self.ud[u]
|
||||
ud.setup_localpath(self.d)
|
||||
|
||||
if self.d.expand(self.localpath) is None:
|
||||
if bb.data.expand(self.localpath, self.d) is None:
|
||||
continue
|
||||
|
||||
if ud.lockfile:
|
||||
|
||||
@@ -66,15 +66,15 @@ class Bzr(FetchMethod):
|
||||
|
||||
options = []
|
||||
|
||||
if command == "revno":
|
||||
if command is "revno":
|
||||
bzrcmd = "%s revno %s %s://%s" % (basecmd, " ".join(options), proto, bzrroot)
|
||||
else:
|
||||
if ud.revision:
|
||||
options.append("-r %s" % ud.revision)
|
||||
|
||||
if command == "fetch":
|
||||
if command is "fetch":
|
||||
bzrcmd = "%s co %s %s://%s" % (basecmd, " ".join(options), proto, bzrroot)
|
||||
elif command == "update":
|
||||
elif command is "update":
|
||||
bzrcmd = "%s pull %s --overwrite" % (basecmd, " ".join(options))
|
||||
else:
|
||||
raise FetchError("Invalid bzr command %s" % command, ud.url)
|
||||
|
||||
@@ -3,41 +3,6 @@
|
||||
"""
|
||||
BitBake 'Fetch' git implementation
|
||||
|
||||
git fetcher support the SRC_URI with format of:
|
||||
SRC_URI = "git://some.host/somepath;OptionA=xxx;OptionB=xxx;..."
|
||||
|
||||
Supported SRC_URI options are:
|
||||
|
||||
- branch
|
||||
The git branch to retrieve from. The default is "master"
|
||||
|
||||
this option also support multiple branches fetching, branches
|
||||
are seperated by comma. in multiple branches case, the name option
|
||||
must have the same number of names to match the branches, which is
|
||||
used to specify the SRC_REV for the branch
|
||||
e.g:
|
||||
SRC_URI="git://some.host/somepath;branch=branchX,branchY;name=nameX,nameY"
|
||||
SRCREV_nameX = "xxxxxxxxxxxxxxxxxxxx"
|
||||
SRCREV_nameY = "YYYYYYYYYYYYYYYYYYYY"
|
||||
|
||||
- tag
|
||||
The git tag to retrieve. The default is "master"
|
||||
|
||||
- protocol
|
||||
The method to use to access the repository. Common options are "git",
|
||||
"http", "file" and "rsync". The default is "git"
|
||||
|
||||
- rebaseable
|
||||
rebaseable indicates that the upstream git repo may rebase in the future,
|
||||
and current revision may disappear from upstream repo. This option will
|
||||
reminder fetcher to preserve local cache carefully for future use.
|
||||
The default value is "0", set rebaseable=1 for rebaseable git repo
|
||||
|
||||
- nocheckout
|
||||
Don't checkout source code when unpacking. set this option for the recipe
|
||||
who has its own routine to checkout code.
|
||||
The default is "0", set nocheckout=1 if needed.
|
||||
|
||||
"""
|
||||
|
||||
#Copyright (C) 2005 Richard Purdie
|
||||
@@ -68,7 +33,7 @@ class Git(FetchMethod):
|
||||
#
|
||||
# Only enable _sortable revision if the key is set
|
||||
#
|
||||
if d.getVar("BB_GIT_CLONE_FOR_SRCREV", True):
|
||||
if bb.data.getVar("BB_GIT_CLONE_FOR_SRCREV", d, True):
|
||||
self._sortable_buildindex = self._sortable_buildindex_disabled
|
||||
def supports(self, url, ud, d):
|
||||
"""
|
||||
@@ -86,14 +51,11 @@ class Git(FetchMethod):
|
||||
elif not ud.host:
|
||||
ud.proto = 'file'
|
||||
else:
|
||||
ud.proto = "git"
|
||||
ud.proto = "rsync"
|
||||
|
||||
if not ud.proto in ('git', 'file', 'ssh', 'http', 'https', 'rsync'):
|
||||
raise bb.fetch2.ParameterError("Invalid protocol type", ud.url)
|
||||
|
||||
ud.nocheckout = ud.parm.get("nocheckout","0") == "1"
|
||||
|
||||
ud.rebaseable = ud.parm.get("rebaseable","0") == "1"
|
||||
ud.nocheckout = False
|
||||
if 'nocheckout' in ud.parm:
|
||||
ud.nocheckout = True
|
||||
|
||||
branches = ud.parm.get("branch", "master").split(',')
|
||||
if len(branches) != len(ud.names):
|
||||
@@ -103,9 +65,16 @@ class Git(FetchMethod):
|
||||
branch = branches[ud.names.index(name)]
|
||||
ud.branches[name] = branch
|
||||
|
||||
gitsrcname = '%s%s' % (ud.host, ud.path.replace('/', '.'))
|
||||
ud.mirrortarball = 'git2_%s.tar.gz' % (gitsrcname)
|
||||
ud.fullmirror = os.path.join(data.getVar("DL_DIR", d, True), ud.mirrortarball)
|
||||
ud.clonedir = os.path.join(data.expand('${GITDIR}', d), gitsrcname)
|
||||
|
||||
ud.basecmd = data.getVar("FETCHCMD_git", d, True) or "git"
|
||||
|
||||
ud.write_tarballs = ((data.getVar("BB_GENERATE_MIRROR_TARBALLS", d, True) or "0") != "0") or ud.rebaseable
|
||||
ud.write_tarballs = (data.getVar("BB_GENERATE_MIRROR_TARBALLS", d, True) or "0") != "0"
|
||||
|
||||
ud.localfile = ud.clonedir
|
||||
|
||||
ud.setup_revisons(d)
|
||||
|
||||
@@ -115,20 +84,6 @@ class Git(FetchMethod):
|
||||
ud.branches[name] = ud.revisions[name]
|
||||
ud.revisions[name] = self.latest_revision(ud.url, ud, d, name)
|
||||
|
||||
gitsrcname = '%s%s' % (ud.host, ud.path.replace('/', '.'))
|
||||
# for rebaseable git repo, it is necessary to keep mirror tar ball
|
||||
# per revision, so that even the revision disappears from the
|
||||
# upstream repo in the future, the mirror will remain intact and still
|
||||
# contains the revision
|
||||
if ud.rebaseable:
|
||||
for name in ud.names:
|
||||
gitsrcname = gitsrcname + '_' + ud.revisions[name]
|
||||
ud.mirrortarball = 'git2_%s.tar.gz' % (gitsrcname)
|
||||
ud.fullmirror = os.path.join(data.getVar("DL_DIR", d, True), ud.mirrortarball)
|
||||
ud.clonedir = os.path.join(data.expand('${GITDIR}', d), gitsrcname)
|
||||
|
||||
ud.localfile = ud.clonedir
|
||||
|
||||
def localpath(self, url, ud, d):
|
||||
return ud.clonedir
|
||||
|
||||
@@ -146,7 +101,7 @@ class Git(FetchMethod):
|
||||
def try_premirror(self, u, ud, d):
|
||||
# If we don't do this, updating an existing checkout with only premirrors
|
||||
# is not possible
|
||||
if d.getVar("BB_FETCH_PREMIRRORONLY", True) is not None:
|
||||
if bb.data.getVar("BB_FETCH_PREMIRRORONLY", d, True) is not None:
|
||||
return True
|
||||
if os.path.exists(ud.clonedir):
|
||||
return False
|
||||
@@ -168,13 +123,10 @@ class Git(FetchMethod):
|
||||
os.chdir(ud.clonedir)
|
||||
runfetchcmd("tar -xzf %s" % (ud.fullmirror), d)
|
||||
|
||||
repourl = "%s://%s%s%s" % (ud.proto, username, ud.host, ud.path)
|
||||
|
||||
# If the repo still doesn't exist, fallback to cloning it
|
||||
if not os.path.exists(ud.clonedir):
|
||||
clone_cmd = "%s clone --bare --mirror %s %s" % (ud.basecmd, repourl, ud.clonedir)
|
||||
bb.fetch2.check_network_access(d, clone_cmd)
|
||||
runfetchcmd(clone_cmd, d)
|
||||
bb.fetch2.check_network_access(d, "git clone --bare %s%s" % (ud.host, ud.path))
|
||||
runfetchcmd("%s clone --bare %s://%s%s%s %s" % (ud.basecmd, ud.proto, username, ud.host, ud.path, ud.clonedir), d)
|
||||
|
||||
os.chdir(ud.clonedir)
|
||||
# Update the checkout if needed
|
||||
@@ -183,16 +135,15 @@ class Git(FetchMethod):
|
||||
if not self._contains_ref(ud.revisions[name], d):
|
||||
needupdate = True
|
||||
if needupdate:
|
||||
bb.fetch2.check_network_access(d, "git fetch %s%s" % (ud.host, ud.path), ud.url)
|
||||
try:
|
||||
runfetchcmd("%s remote prune origin" % ud.basecmd, d)
|
||||
runfetchcmd("%s remote rm origin" % ud.basecmd, d)
|
||||
except bb.fetch2.FetchError:
|
||||
logger.debug(1, "No Origin")
|
||||
|
||||
runfetchcmd("%s remote add --mirror=fetch origin %s" % (ud.basecmd, repourl), d)
|
||||
fetch_cmd = "%s fetch -f --prune %s refs/*:refs/*" % (ud.basecmd, repourl)
|
||||
bb.fetch2.check_network_access(d, fetch_cmd, ud.url)
|
||||
runfetchcmd(fetch_cmd, d)
|
||||
|
||||
runfetchcmd("%s remote add origin %s://%s%s%s" % (ud.basecmd, ud.proto, username, ud.host, ud.path), d)
|
||||
runfetchcmd("%s fetch --all -t" % ud.basecmd, d)
|
||||
runfetchcmd("%s prune-packed" % ud.basecmd, d)
|
||||
runfetchcmd("%s pack-redundant --all | xargs -r rm" % ud.basecmd, d)
|
||||
ud.repochanged = True
|
||||
@@ -210,24 +161,18 @@ class Git(FetchMethod):
|
||||
subdir = ud.parm.get("subpath", "")
|
||||
if subdir != "":
|
||||
readpathspec = ":%s" % (subdir)
|
||||
def_destsuffix = "%s/" % os.path.basename(subdir)
|
||||
else:
|
||||
readpathspec = ""
|
||||
def_destsuffix = "git/"
|
||||
|
||||
destsuffix = ud.parm.get("destsuffix", def_destsuffix)
|
||||
destdir = os.path.join(destdir, destsuffix)
|
||||
destdir = os.path.join(destdir, "git/")
|
||||
if os.path.exists(destdir):
|
||||
bb.utils.prunedir(destdir)
|
||||
|
||||
runfetchcmd("git clone -s -n %s %s" % (ud.clonedir, destdir), d)
|
||||
if not ud.nocheckout:
|
||||
os.chdir(destdir)
|
||||
if subdir != "":
|
||||
runfetchcmd("%s read-tree %s%s" % (ud.basecmd, ud.revisions[ud.names[0]], readpathspec), d)
|
||||
runfetchcmd("%s checkout-index -q -f -a" % ud.basecmd, d)
|
||||
else:
|
||||
runfetchcmd("%s checkout %s" % (ud.basecmd, ud.revisions[ud.names[0]]), d)
|
||||
runfetchcmd("%s read-tree %s%s" % (ud.basecmd, ud.revisions[ud.names[0]], readpathspec), d)
|
||||
runfetchcmd("%s checkout-index -q -f -a" % ud.basecmd, d)
|
||||
return True
|
||||
|
||||
def clean(self, ud, d):
|
||||
@@ -241,10 +186,7 @@ class Git(FetchMethod):
|
||||
|
||||
def _contains_ref(self, tag, d):
|
||||
basecmd = data.getVar("FETCHCMD_git", d, True) or "git"
|
||||
cmd = "%s log --pretty=oneline -n 1 %s -- 2> /dev/null | wc -l" % (basecmd, tag)
|
||||
output = runfetchcmd(cmd, d, quiet=True)
|
||||
if len(output.split()) > 1:
|
||||
raise bb.fetch2.FetchError("The command '%s' gave output with more then 1 line unexpectedly, output: '%s'" % (cmd, output))
|
||||
output = runfetchcmd("%s log --pretty=oneline -n 1 %s -- 2> /dev/null | wc -l" % (basecmd, tag), d, quiet=True)
|
||||
return output.split()[0] != "0"
|
||||
|
||||
def _revision_key(self, url, ud, d, name):
|
||||
@@ -262,10 +204,9 @@ class Git(FetchMethod):
|
||||
else:
|
||||
username = ""
|
||||
|
||||
bb.fetch2.check_network_access(d, "git ls-remote %s%s %s" % (ud.host, ud.path, ud.branches[name]))
|
||||
basecmd = data.getVar("FETCHCMD_git", d, True) or "git"
|
||||
cmd = "%s ls-remote %s://%s%s%s %s" % \
|
||||
(basecmd, ud.proto, username, ud.host, ud.path, ud.branches[name])
|
||||
bb.fetch2.check_network_access(d, cmd)
|
||||
cmd = "%s ls-remote %s://%s%s%s %s" % (basecmd, ud.proto, username, ud.host, ud.path, ud.branches[name])
|
||||
output = runfetchcmd(cmd, d, True)
|
||||
if not output:
|
||||
raise bb.fetch2.FetchError("The command %s gave empty output unexpectedly" % cmd, url)
|
||||
@@ -285,13 +226,10 @@ class Git(FetchMethod):
|
||||
# Check if we have the rev already
|
||||
|
||||
if not os.path.exists(ud.clonedir):
|
||||
logger.debug(1, "GIT repository for %s does not exist in %s. \
|
||||
Downloading.", url, ud.clonedir)
|
||||
print("no repo")
|
||||
self.download(None, ud, d)
|
||||
if not os.path.exists(ud.clonedir):
|
||||
logger.error("GIT repository for %s does not exist in %s after \
|
||||
download. Cannot get sortable buildnumber, using \
|
||||
old value", url, ud.clonedir)
|
||||
logger.error("GIT repository for %s doesn't exist in %s, cannot get sortable buildnumber, using old value", url, ud.clonedir)
|
||||
return None
|
||||
|
||||
|
||||
@@ -305,11 +243,3 @@ class Git(FetchMethod):
|
||||
buildindex = "%s" % output.split()[0]
|
||||
logger.debug(1, "GIT repository for %s in %s is returning %s revisions in rev-list before %s", url, ud.clonedir, buildindex, rev)
|
||||
return buildindex
|
||||
|
||||
def checkstatus(self, uri, ud, d):
|
||||
fetchcmd = "%s ls-remote %s" % (ud.basecmd, uri)
|
||||
try:
|
||||
runfetchcmd(fetchcmd, d, quiet=True)
|
||||
return True
|
||||
except FetchError:
|
||||
return False
|
||||
|
||||
@@ -94,21 +94,21 @@ class Hg(FetchMethod):
|
||||
else:
|
||||
hgroot = ud.user + "@" + host + ud.path
|
||||
|
||||
if command == "info":
|
||||
if command is "info":
|
||||
return "%s identify -i %s://%s/%s" % (basecmd, proto, hgroot, ud.module)
|
||||
|
||||
options = [];
|
||||
if ud.revision:
|
||||
options.append("-r %s" % ud.revision)
|
||||
|
||||
if command == "fetch":
|
||||
if command is "fetch":
|
||||
cmd = "%s clone %s %s://%s/%s %s" % (basecmd, " ".join(options), proto, hgroot, ud.module, ud.module)
|
||||
elif command == "pull":
|
||||
elif command is "pull":
|
||||
# do not pass options list; limiting pull to rev causes the local
|
||||
# repo not to contain it and immediately following "update" command
|
||||
# will crash
|
||||
cmd = "%s pull" % (basecmd)
|
||||
elif command == "update":
|
||||
elif command is "update":
|
||||
cmd = "%s update -C %s" % (basecmd, " ".join(options))
|
||||
else:
|
||||
raise FetchError("Invalid hg command %s" % command, ud.url)
|
||||
@@ -166,7 +166,7 @@ class Hg(FetchMethod):
|
||||
output = runfetchcmd(self._buildhgcommand(ud, d, "info"), d)
|
||||
return output.strip()
|
||||
|
||||
def _build_revision(self, url, ud, d, name):
|
||||
def _build_revision(self, url, ud, d):
|
||||
return ud.revision
|
||||
|
||||
def _revision_key(self, url, ud, d, name):
|
||||
|
||||
@@ -50,6 +50,9 @@ class Local(FetchMethod):
|
||||
path = url.split("://")[1]
|
||||
path = path.split(";")[0]
|
||||
newpath = path
|
||||
dldirfile = os.path.join(data.getVar("DL_DIR", d, True), os.path.basename(path))
|
||||
if os.path.exists(dldirfile):
|
||||
return dldirfile
|
||||
if path[0] != "/":
|
||||
filespath = data.getVar('FILESPATH', d, True)
|
||||
if filespath:
|
||||
@@ -59,7 +62,6 @@ class Local(FetchMethod):
|
||||
if filesdir:
|
||||
newpath = os.path.join(filesdir, path)
|
||||
if not os.path.exists(newpath) and path.find("*") == -1:
|
||||
dldirfile = os.path.join(data.getVar("DL_DIR", d, True), os.path.basename(path))
|
||||
return dldirfile
|
||||
return newpath
|
||||
|
||||
|
||||
@@ -68,9 +68,9 @@ class Osc(FetchMethod):
|
||||
|
||||
coroot = self._strip_leading_slashes(ud.path)
|
||||
|
||||
if command == "fetch":
|
||||
if command is "fetch":
|
||||
osccmd = "%s %s co %s/%s %s" % (basecmd, config, coroot, ud.module, " ".join(options))
|
||||
elif command == "update":
|
||||
elif command is "update":
|
||||
osccmd = "%s %s up %s" % (basecmd, config, " ".join(options))
|
||||
else:
|
||||
raise FetchError("Invalid osc command %s" % command, ud.url)
|
||||
|
||||
@@ -87,7 +87,7 @@ class Svn(FetchMethod):
|
||||
if ud.pswd:
|
||||
options.append("--password %s" % ud.pswd)
|
||||
|
||||
if command == "info":
|
||||
if command is "info":
|
||||
svncmd = "%s info %s %s://%s/%s/" % (basecmd, " ".join(options), proto, svnroot, ud.module)
|
||||
else:
|
||||
suffix = ""
|
||||
@@ -95,9 +95,9 @@ class Svn(FetchMethod):
|
||||
options.append("-r %s" % ud.revision)
|
||||
suffix = "@%s" % (ud.revision)
|
||||
|
||||
if command == "fetch":
|
||||
if command is "fetch":
|
||||
svncmd = "%s co %s %s://%s/%s%s %s" % (basecmd, " ".join(options), proto, svnroot, ud.module, suffix, ud.module)
|
||||
elif command == "update":
|
||||
elif command is "update":
|
||||
svncmd = "%s update %s" % (basecmd, " ".join(options))
|
||||
else:
|
||||
raise FetchError("Invalid svn command %s" % command, ud.url)
|
||||
|
||||
@@ -69,11 +69,10 @@ class Wget(FetchMethod):
|
||||
|
||||
fetchcmd = fetchcmd.replace("${URI}", uri.split(";")[0])
|
||||
fetchcmd = fetchcmd.replace("${FILE}", ud.basename)
|
||||
if not checkonly:
|
||||
logger.info("fetch " + uri)
|
||||
logger.debug(2, "executing " + fetchcmd)
|
||||
logger.info("fetch " + uri)
|
||||
logger.debug(2, "executing " + fetchcmd)
|
||||
bb.fetch2.check_network_access(d, fetchcmd)
|
||||
runfetchcmd(fetchcmd, d, quiet=checkonly)
|
||||
runfetchcmd(fetchcmd, d)
|
||||
|
||||
# Sanity check since wget can pretend it succeed when it didn't
|
||||
# Also, this used to happen if sourceforge sent us to the mirror page
|
||||
|
||||
@@ -65,79 +65,136 @@ class BBLogFormatter(logging.Formatter):
|
||||
def format(self, record):
|
||||
record.levelname = self.getLevelName(record.levelno)
|
||||
if record.levelno == self.PLAIN:
|
||||
msg = record.getMessage()
|
||||
return record.getMessage()
|
||||
else:
|
||||
msg = logging.Formatter.format(self, record)
|
||||
return logging.Formatter.format(self, record)
|
||||
|
||||
if hasattr(record, 'bb_exc_info'):
|
||||
etype, value, tb = record.bb_exc_info
|
||||
formatted = bb.exceptions.format_exception(etype, value, tb, limit=5)
|
||||
msg += '\n' + ''.join(formatted)
|
||||
return msg
|
||||
class Loggers(dict):
|
||||
def __getitem__(self, key):
|
||||
if key in self:
|
||||
return dict.__getitem__(self, key)
|
||||
else:
|
||||
log = logging.getLogger("BitBake.%s" % domain._fields[key])
|
||||
dict.__setitem__(self, key, log)
|
||||
return log
|
||||
|
||||
class BBLogFilter(object):
|
||||
def __init__(self, handler, level, debug_domains):
|
||||
self.stdlevel = level
|
||||
self.debug_domains = debug_domains
|
||||
loglevel = level
|
||||
for domain in debug_domains:
|
||||
if debug_domains[domain] < loglevel:
|
||||
loglevel = debug_domains[domain]
|
||||
handler.setLevel(loglevel)
|
||||
handler.addFilter(self)
|
||||
|
||||
def filter(self, record):
|
||||
if record.levelno >= self.stdlevel:
|
||||
return True
|
||||
if record.name in self.debug_domains and record.levelno >= self.debug_domains[record.name]:
|
||||
return True
|
||||
return False
|
||||
class DebugLevel(dict):
|
||||
def __getitem__(self, key):
|
||||
if key == "default":
|
||||
key = domain.Default
|
||||
return get_debug_level(key)
|
||||
|
||||
def _NamedTuple(name, fields):
|
||||
Tuple = collections.namedtuple(name, " ".join(fields))
|
||||
return Tuple(*range(len(fields)))
|
||||
|
||||
domain = _NamedTuple("Domain", (
|
||||
"Default",
|
||||
"Build",
|
||||
"Cache",
|
||||
"Collection",
|
||||
"Data",
|
||||
"Depends",
|
||||
"Fetcher",
|
||||
"Parsing",
|
||||
"PersistData",
|
||||
"Provider",
|
||||
"RunQueue",
|
||||
"TaskData",
|
||||
"Util"))
|
||||
logger = logging.getLogger("BitBake")
|
||||
loggers = Loggers()
|
||||
debug_level = DebugLevel()
|
||||
|
||||
# Message control functions
|
||||
#
|
||||
|
||||
loggerDefaultDebugLevel = 0
|
||||
loggerDefaultVerbose = False
|
||||
loggerDefaultDomains = []
|
||||
def set_debug_level(level):
|
||||
for log in loggers.itervalues():
|
||||
log.setLevel(logging.NOTSET)
|
||||
|
||||
def init_msgconfig(verbose, debug, debug_domains = []):
|
||||
"""
|
||||
Set default verbosity and debug levels config the logger
|
||||
"""
|
||||
bb.msg.loggerDefaultDebugLevel = debug
|
||||
bb.msg.loggerDefaultVerbose = verbose
|
||||
bb.msg.loggerDefaultDomains = debug_domains
|
||||
|
||||
def addDefaultlogFilter(handler):
|
||||
|
||||
debug = loggerDefaultDebugLevel
|
||||
verbose = loggerDefaultVerbose
|
||||
domains = loggerDefaultDomains
|
||||
|
||||
if debug:
|
||||
level = BBLogFormatter.DEBUG - debug + 1
|
||||
elif verbose:
|
||||
level = BBLogFormatter.VERBOSE
|
||||
if level:
|
||||
logger.setLevel(logging.DEBUG - level + 1)
|
||||
else:
|
||||
level = BBLogFormatter.NOTE
|
||||
logger.setLevel(logging.INFO)
|
||||
|
||||
debug_domains = {}
|
||||
for (domainarg, iterator) in groupby(domains):
|
||||
dlevel = len(tuple(iterator))
|
||||
debug_domains["BitBake.%s" % domainarg] = logging.DEBUG - dlevel + 1
|
||||
def get_debug_level(msgdomain = domain.Default):
|
||||
if not msgdomain:
|
||||
level = logger.getEffectiveLevel()
|
||||
else:
|
||||
level = loggers[msgdomain].getEffectiveLevel()
|
||||
return max(0, logging.DEBUG - level + 1)
|
||||
|
||||
BBLogFilter(handler, level, debug_domains)
|
||||
def set_verbose(level):
|
||||
if level:
|
||||
logger.setLevel(BBLogFormatter.VERBOSE)
|
||||
else:
|
||||
logger.setLevel(BBLogFormatter.INFO)
|
||||
|
||||
def set_debug_domains(domainargs):
|
||||
for (domainarg, iterator) in groupby(domainargs):
|
||||
for index, msgdomain in enumerate(domain._fields):
|
||||
if msgdomain == domainarg:
|
||||
level = len(tuple(iterator))
|
||||
if level:
|
||||
loggers[index].setLevel(logging.DEBUG - level + 1)
|
||||
break
|
||||
else:
|
||||
warn(None, "Logging domain %s is not valid, ignoring" % domainarg)
|
||||
|
||||
#
|
||||
# Message handling functions
|
||||
#
|
||||
|
||||
def fatal(msgdomain, msg):
|
||||
if msgdomain:
|
||||
logger = logging.getLogger("BitBake.%s" % msgdomain)
|
||||
def debug(level, msgdomain, msg):
|
||||
warnings.warn("bb.msg.debug will soon be deprecated in favor of the python 'logging' module",
|
||||
PendingDeprecationWarning, stacklevel=2)
|
||||
level = logging.DEBUG - (level - 1)
|
||||
if not msgdomain:
|
||||
logger.debug(level, msg)
|
||||
else:
|
||||
logger = logging.getLogger("BitBake")
|
||||
logger.critical(msg)
|
||||
loggers[msgdomain].debug(level, msg)
|
||||
|
||||
def plain(msg):
|
||||
warnings.warn("bb.msg.plain will soon be deprecated in favor of the python 'logging' module",
|
||||
PendingDeprecationWarning, stacklevel=2)
|
||||
logger.plain(msg)
|
||||
|
||||
def note(level, msgdomain, msg):
|
||||
warnings.warn("bb.msg.note will soon be deprecated in favor of the python 'logging' module",
|
||||
PendingDeprecationWarning, stacklevel=2)
|
||||
if level > 1:
|
||||
if msgdomain:
|
||||
logger.verbose(msg)
|
||||
else:
|
||||
loggers[msgdomain].verbose(msg)
|
||||
else:
|
||||
if msgdomain:
|
||||
logger.info(msg)
|
||||
else:
|
||||
loggers[msgdomain].info(msg)
|
||||
|
||||
def warn(msgdomain, msg):
|
||||
warnings.warn("bb.msg.warn will soon be deprecated in favor of the python 'logging' module",
|
||||
PendingDeprecationWarning, stacklevel=2)
|
||||
if not msgdomain:
|
||||
logger.warn(msg)
|
||||
else:
|
||||
loggers[msgdomain].warn(msg)
|
||||
|
||||
def error(msgdomain, msg):
|
||||
warnings.warn("bb.msg.error will soon be deprecated in favor of the python 'logging' module",
|
||||
PendingDeprecationWarning, stacklevel=2)
|
||||
if not msgdomain:
|
||||
logger.error(msg)
|
||||
else:
|
||||
loggers[msgdomain].error(msg)
|
||||
|
||||
def fatal(msgdomain, msg):
|
||||
warnings.warn("bb.msg.fatal will soon be deprecated in favor of raising appropriate exceptions",
|
||||
PendingDeprecationWarning, stacklevel=2)
|
||||
if not msgdomain:
|
||||
logger.critical(msg)
|
||||
else:
|
||||
loggers[msgdomain].critical(msg)
|
||||
sys.exit(1)
|
||||
|
||||
@@ -1,255 +0,0 @@
|
||||
# http://code.activestate.com/recipes/577629-namedtupleabc-abstract-base-class-mix-in-for-named/
|
||||
#!/usr/bin/env python
|
||||
# Copyright (c) 2011 Jan Kaliszewski (zuo). Available under the MIT License.
|
||||
|
||||
"""
|
||||
namedtuple_with_abc.py:
|
||||
* named tuple mix-in + ABC (abstract base class) recipe,
|
||||
* works under Python 2.6, 2.7 as well as 3.x.
|
||||
|
||||
Import this module to patch collections.namedtuple() factory function
|
||||
-- enriching it with the 'abc' attribute (an abstract base class + mix-in
|
||||
for named tuples) and decorating it with a wrapper that registers each
|
||||
newly created named tuple as a subclass of namedtuple.abc.
|
||||
|
||||
How to import:
|
||||
import collections, namedtuple_with_abc
|
||||
or:
|
||||
import namedtuple_with_abc
|
||||
from collections import namedtuple
|
||||
# ^ in this variant you must import namedtuple function
|
||||
# *after* importing namedtuple_with_abc module
|
||||
or simply:
|
||||
from namedtuple_with_abc import namedtuple
|
||||
|
||||
Simple usage example:
|
||||
class Credentials(namedtuple.abc):
|
||||
_fields = 'username password'
|
||||
def __str__(self):
|
||||
return ('{0.__class__.__name__}'
|
||||
'(username={0.username}, password=...)'.format(self))
|
||||
print(Credentials("alice", "Alice's password"))
|
||||
|
||||
For more advanced examples -- see below the "if __name__ == '__main__':".
|
||||
"""
|
||||
|
||||
import collections
|
||||
from abc import ABCMeta, abstractproperty
|
||||
from functools import wraps
|
||||
from sys import version_info
|
||||
|
||||
__all__ = ('namedtuple',)
|
||||
_namedtuple = collections.namedtuple
|
||||
|
||||
|
||||
class _NamedTupleABCMeta(ABCMeta):
|
||||
'''The metaclass for the abstract base class + mix-in for named tuples.'''
|
||||
def __new__(mcls, name, bases, namespace):
|
||||
fields = namespace.get('_fields')
|
||||
for base in bases:
|
||||
if fields is not None:
|
||||
break
|
||||
fields = getattr(base, '_fields', None)
|
||||
if not isinstance(fields, abstractproperty):
|
||||
basetuple = _namedtuple(name, fields)
|
||||
bases = (basetuple,) + bases
|
||||
namespace.pop('_fields', None)
|
||||
namespace.setdefault('__doc__', basetuple.__doc__)
|
||||
namespace.setdefault('__slots__', ())
|
||||
return ABCMeta.__new__(mcls, name, bases, namespace)
|
||||
|
||||
|
||||
exec(
|
||||
# Python 2.x metaclass declaration syntax
|
||||
"""class _NamedTupleABC(object):
|
||||
'''The abstract base class + mix-in for named tuples.'''
|
||||
__metaclass__ = _NamedTupleABCMeta
|
||||
_fields = abstractproperty()""" if version_info[0] < 3 else
|
||||
# Python 3.x metaclass declaration syntax
|
||||
"""class _NamedTupleABC(metaclass=_NamedTupleABCMeta):
|
||||
'''The abstract base class + mix-in for named tuples.'''
|
||||
_fields = abstractproperty()"""
|
||||
)
|
||||
|
||||
|
||||
_namedtuple.abc = _NamedTupleABC
|
||||
#_NamedTupleABC.register(type(version_info)) # (and similar, in the future...)
|
||||
|
||||
@wraps(_namedtuple)
|
||||
def namedtuple(*args, **kwargs):
|
||||
'''Named tuple factory with namedtuple.abc subclass registration.'''
|
||||
cls = _namedtuple(*args, **kwargs)
|
||||
_NamedTupleABC.register(cls)
|
||||
return cls
|
||||
|
||||
collections.namedtuple = namedtuple
|
||||
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
'''Examples and explanations'''
|
||||
|
||||
# Simple usage
|
||||
|
||||
class MyRecord(namedtuple.abc):
|
||||
_fields = 'x y z' # such form will be transformed into ('x', 'y', 'z')
|
||||
def _my_custom_method(self):
|
||||
return list(self._asdict().items())
|
||||
# (the '_fields' attribute belongs to the named tuple public API anyway)
|
||||
|
||||
rec = MyRecord(1, 2, 3)
|
||||
print(rec)
|
||||
print(rec._my_custom_method())
|
||||
print(rec._replace(y=222))
|
||||
print(rec._replace(y=222)._my_custom_method())
|
||||
|
||||
# Custom abstract classes...
|
||||
|
||||
class MyAbstractRecord(namedtuple.abc):
|
||||
def _my_custom_method(self):
|
||||
return list(self._asdict().items())
|
||||
|
||||
try:
|
||||
MyAbstractRecord() # (abstract classes cannot be instantiated)
|
||||
except TypeError as exc:
|
||||
print(exc)
|
||||
|
||||
class AnotherAbstractRecord(MyAbstractRecord):
|
||||
def __str__(self):
|
||||
return '<<<{0}>>>'.format(super(AnotherAbstractRecord,
|
||||
self).__str__())
|
||||
|
||||
# ...and their non-abstract subclasses
|
||||
|
||||
class MyRecord2(MyAbstractRecord):
|
||||
_fields = 'a, b'
|
||||
|
||||
class MyRecord3(AnotherAbstractRecord):
|
||||
_fields = 'p', 'q', 'r'
|
||||
|
||||
rec2 = MyRecord2('foo', 'bar')
|
||||
print(rec2)
|
||||
print(rec2._my_custom_method())
|
||||
print(rec2._replace(b=222))
|
||||
print(rec2._replace(b=222)._my_custom_method())
|
||||
|
||||
rec3 = MyRecord3('foo', 'bar', 'baz')
|
||||
print(rec3)
|
||||
print(rec3._my_custom_method())
|
||||
print(rec3._replace(q=222))
|
||||
print(rec3._replace(q=222)._my_custom_method())
|
||||
|
||||
# You can also subclass non-abstract ones...
|
||||
|
||||
class MyRecord33(MyRecord3):
|
||||
def __str__(self):
|
||||
return '< {0!r}, ..., {0!r} >'.format(self.p, self.r)
|
||||
|
||||
rec33 = MyRecord33('foo', 'bar', 'baz')
|
||||
print(rec33)
|
||||
print(rec33._my_custom_method())
|
||||
print(rec33._replace(q=222))
|
||||
print(rec33._replace(q=222)._my_custom_method())
|
||||
|
||||
# ...and even override the magic '_fields' attribute again
|
||||
|
||||
class MyRecord345(MyRecord3):
|
||||
_fields = 'e f g h i j k'
|
||||
|
||||
rec345 = MyRecord345(1, 2, 3, 4, 3, 2, 1)
|
||||
print(rec345)
|
||||
print(rec345._my_custom_method())
|
||||
print(rec345._replace(f=222))
|
||||
print(rec345._replace(f=222)._my_custom_method())
|
||||
|
||||
# Mixing-in some other classes is also possible:
|
||||
|
||||
class MyMixIn(object):
|
||||
def method(self):
|
||||
return "MyMixIn.method() called"
|
||||
def _my_custom_method(self):
|
||||
return "MyMixIn._my_custom_method() called"
|
||||
def count(self, item):
|
||||
return "MyMixIn.count({0}) called".format(item)
|
||||
def _asdict(self): # (cannot override a namedtuple method, see below)
|
||||
return "MyMixIn._asdict() called"
|
||||
|
||||
class MyRecord4(MyRecord33, MyMixIn): # mix-in on the right
|
||||
_fields = 'j k l x'
|
||||
|
||||
class MyRecord5(MyMixIn, MyRecord33): # mix-in on the left
|
||||
_fields = 'j k l x y'
|
||||
|
||||
rec4 = MyRecord4(1, 2, 3, 2)
|
||||
print(rec4)
|
||||
print(rec4.method())
|
||||
print(rec4._my_custom_method()) # MyRecord33's
|
||||
print(rec4.count(2)) # tuple's
|
||||
print(rec4._replace(k=222))
|
||||
print(rec4._replace(k=222).method())
|
||||
print(rec4._replace(k=222)._my_custom_method()) # MyRecord33's
|
||||
print(rec4._replace(k=222).count(8)) # tuple's
|
||||
|
||||
rec5 = MyRecord5(1, 2, 3, 2, 1)
|
||||
print(rec5)
|
||||
print(rec5.method())
|
||||
print(rec5._my_custom_method()) # MyMixIn's
|
||||
print(rec5.count(2)) # MyMixIn's
|
||||
print(rec5._replace(k=222))
|
||||
print(rec5._replace(k=222).method())
|
||||
print(rec5._replace(k=222)._my_custom_method()) # MyMixIn's
|
||||
print(rec5._replace(k=222).count(2)) # MyMixIn's
|
||||
|
||||
# None that behavior: the standard namedtuple methods cannot be
|
||||
# overriden by a foreign mix-in -- even if the mix-in is declared
|
||||
# as the leftmost base class (but, obviously, you can override them
|
||||
# in the defined class or its subclasses):
|
||||
|
||||
print(rec4._asdict()) # (returns a dict, not "MyMixIn._asdict() called")
|
||||
print(rec5._asdict()) # (returns a dict, not "MyMixIn._asdict() called")
|
||||
|
||||
class MyRecord6(MyRecord33):
|
||||
_fields = 'j k l x y z'
|
||||
def _asdict(self):
|
||||
return "MyRecord6._asdict() called"
|
||||
rec6 = MyRecord6(1, 2, 3, 1, 2, 3)
|
||||
print(rec6._asdict()) # (this returns "MyRecord6._asdict() called")
|
||||
|
||||
# All that record classes are real subclasses of namedtuple.abc:
|
||||
|
||||
assert issubclass(MyRecord, namedtuple.abc)
|
||||
assert issubclass(MyAbstractRecord, namedtuple.abc)
|
||||
assert issubclass(AnotherAbstractRecord, namedtuple.abc)
|
||||
assert issubclass(MyRecord2, namedtuple.abc)
|
||||
assert issubclass(MyRecord3, namedtuple.abc)
|
||||
assert issubclass(MyRecord33, namedtuple.abc)
|
||||
assert issubclass(MyRecord345, namedtuple.abc)
|
||||
assert issubclass(MyRecord4, namedtuple.abc)
|
||||
assert issubclass(MyRecord5, namedtuple.abc)
|
||||
assert issubclass(MyRecord6, namedtuple.abc)
|
||||
|
||||
# ...but abstract ones are not subclasses of tuple
|
||||
# (and this is what you probably want):
|
||||
|
||||
assert not issubclass(MyAbstractRecord, tuple)
|
||||
assert not issubclass(AnotherAbstractRecord, tuple)
|
||||
|
||||
assert issubclass(MyRecord, tuple)
|
||||
assert issubclass(MyRecord2, tuple)
|
||||
assert issubclass(MyRecord3, tuple)
|
||||
assert issubclass(MyRecord33, tuple)
|
||||
assert issubclass(MyRecord345, tuple)
|
||||
assert issubclass(MyRecord4, tuple)
|
||||
assert issubclass(MyRecord5, tuple)
|
||||
assert issubclass(MyRecord6, tuple)
|
||||
|
||||
# Named tuple classes created with namedtuple() factory function
|
||||
# (in the "traditional" way) are registered as "virtual" subclasses
|
||||
# of namedtuple.abc:
|
||||
|
||||
MyTuple = namedtuple('MyTuple', 'a b c')
|
||||
mt = MyTuple(1, 2, 3)
|
||||
assert issubclass(MyTuple, namedtuple.abc)
|
||||
assert isinstance(mt, namedtuple.abc)
|
||||
@@ -62,9 +62,9 @@ def update_mtime(f):
|
||||
def mark_dependency(d, f):
|
||||
if f.startswith('./'):
|
||||
f = "%s/%s" % (os.getcwd(), f[2:])
|
||||
deps = d.getVar('__depends') or set()
|
||||
deps = bb.data.getVar('__depends', d) or set()
|
||||
deps.update([(f, cached_mtime(f))])
|
||||
d.setVar('__depends', deps)
|
||||
bb.data.setVar('__depends', deps, d)
|
||||
|
||||
def supports(fn, data):
|
||||
"""Returns true if we have a handler for this file, false otherwise"""
|
||||
@@ -90,7 +90,7 @@ def init_parser(d):
|
||||
|
||||
def resolve_file(fn, d):
|
||||
if not os.path.isabs(fn):
|
||||
bbpath = d.getVar("BBPATH", True)
|
||||
bbpath = bb.data.getVar("BBPATH", d, True)
|
||||
newfn = bb.utils.which(bbpath, fn)
|
||||
if not newfn:
|
||||
raise IOError("file %s not found in %s" % (fn, bbpath))
|
||||
|
||||
@@ -54,7 +54,7 @@ class IncludeNode(AstNode):
|
||||
"""
|
||||
Include the file and evaluate the statements
|
||||
"""
|
||||
s = data.expand(self.what_file)
|
||||
s = bb.data.expand(self.what_file, data)
|
||||
logger.debug(2, "CONF %s:%s: including %s", self.filename, self.lineno, s)
|
||||
|
||||
# TODO: Cache those includes... maybe not here though
|
||||
@@ -69,7 +69,7 @@ class ExportNode(AstNode):
|
||||
self.var = var
|
||||
|
||||
def eval(self, data):
|
||||
data.setVarFlag(self.var, "export", 1)
|
||||
bb.data.setVarFlag(self.var, "export", 1, data)
|
||||
|
||||
class DataNode(AstNode):
|
||||
"""
|
||||
@@ -84,15 +84,15 @@ class DataNode(AstNode):
|
||||
|
||||
def getFunc(self, key, data):
|
||||
if 'flag' in self.groupd and self.groupd['flag'] != None:
|
||||
return data.getVarFlag(key, self.groupd['flag'], noweakdefault=True)
|
||||
return bb.data.getVarFlag(key, self.groupd['flag'], data)
|
||||
else:
|
||||
return data.getVar(key, noweakdefault=True)
|
||||
return bb.data.getVar(key, data)
|
||||
|
||||
def eval(self, data):
|
||||
groupd = self.groupd
|
||||
key = groupd["var"]
|
||||
if "exp" in groupd and groupd["exp"] != None:
|
||||
data.setVarFlag(key, "export", 1)
|
||||
bb.data.setVarFlag(key, "export", 1, data)
|
||||
if "ques" in groupd and groupd["ques"] != None:
|
||||
val = self.getFunc(key, data)
|
||||
if val == None:
|
||||
@@ -100,7 +100,7 @@ class DataNode(AstNode):
|
||||
elif "colon" in groupd and groupd["colon"] != None:
|
||||
e = data.createCopy()
|
||||
bb.data.update_data(e)
|
||||
val = e.expand(groupd["value"], key + "[:=]")
|
||||
val = bb.data.expand(groupd["value"], e)
|
||||
elif "append" in groupd and groupd["append"] != None:
|
||||
val = "%s %s" % ((self.getFunc(key, data) or ""), groupd["value"])
|
||||
elif "prepend" in groupd and groupd["prepend"] != None:
|
||||
@@ -113,11 +113,11 @@ class DataNode(AstNode):
|
||||
val = groupd["value"]
|
||||
|
||||
if 'flag' in groupd and groupd['flag'] != None:
|
||||
data.setVarFlag(key, groupd['flag'], val)
|
||||
bb.data.setVarFlag(key, groupd['flag'], val, data)
|
||||
elif groupd["lazyques"]:
|
||||
data.setVarFlag(key, "defaultval", val)
|
||||
bb.data.setVarFlag(key, "defaultval", val, data)
|
||||
else:
|
||||
data.setVar(key, val)
|
||||
bb.data.setVar(key, val, data)
|
||||
|
||||
class MethodNode(AstNode):
|
||||
def __init__(self, filename, lineno, func_name, body):
|
||||
@@ -131,12 +131,12 @@ class MethodNode(AstNode):
|
||||
if not funcname in bb.methodpool._parsed_fns:
|
||||
text = "def %s(d):\n" % (funcname) + '\n'.join(self.body)
|
||||
bb.methodpool.insert_method(funcname, text, self.filename)
|
||||
anonfuncs = data.getVar('__BBANONFUNCS') or []
|
||||
anonfuncs = bb.data.getVar('__BBANONFUNCS', data) or []
|
||||
anonfuncs.append(funcname)
|
||||
data.setVar('__BBANONFUNCS', anonfuncs)
|
||||
bb.data.setVar('__BBANONFUNCS', anonfuncs, data)
|
||||
else:
|
||||
data.setVarFlag(self.func_name, "func", 1)
|
||||
data.setVar(self.func_name, '\n'.join(self.body))
|
||||
bb.data.setVarFlag(self.func_name, "func", 1, data)
|
||||
bb.data.setVar(self.func_name, '\n'.join(self.body), data)
|
||||
|
||||
class PythonMethodNode(AstNode):
|
||||
def __init__(self, filename, lineno, function, define, body):
|
||||
@@ -152,9 +152,9 @@ class PythonMethodNode(AstNode):
|
||||
text = '\n'.join(self.body)
|
||||
if not bb.methodpool.parsed_module(self.define):
|
||||
bb.methodpool.insert_method(self.define, text, self.filename)
|
||||
data.setVarFlag(self.function, "func", 1)
|
||||
data.setVarFlag(self.function, "python", 1)
|
||||
data.setVar(self.function, text)
|
||||
bb.data.setVarFlag(self.function, "func", 1, data)
|
||||
bb.data.setVarFlag(self.function, "python", 1, data)
|
||||
bb.data.setVar(self.function, text, data)
|
||||
|
||||
class MethodFlagsNode(AstNode):
|
||||
def __init__(self, filename, lineno, key, m):
|
||||
@@ -163,19 +163,19 @@ class MethodFlagsNode(AstNode):
|
||||
self.m = m
|
||||
|
||||
def eval(self, data):
|
||||
if data.getVar(self.key):
|
||||
if bb.data.getVar(self.key, data):
|
||||
# clean up old version of this piece of metadata, as its
|
||||
# flags could cause problems
|
||||
data.setVarFlag(self.key, 'python', None)
|
||||
data.setVarFlag(self.key, 'fakeroot', None)
|
||||
bb.data.setVarFlag(self.key, 'python', None, data)
|
||||
bb.data.setVarFlag(self.key, 'fakeroot', None, data)
|
||||
if self.m.group("py") is not None:
|
||||
data.setVarFlag(self.key, "python", "1")
|
||||
bb.data.setVarFlag(self.key, "python", "1", data)
|
||||
else:
|
||||
data.delVarFlag(self.key, "python")
|
||||
bb.data.delVarFlag(self.key, "python", data)
|
||||
if self.m.group("fr") is not None:
|
||||
data.setVarFlag(self.key, "fakeroot", "1")
|
||||
bb.data.setVarFlag(self.key, "fakeroot", "1", data)
|
||||
else:
|
||||
data.delVarFlag(self.key, "fakeroot")
|
||||
bb.data.delVarFlag(self.key, "fakeroot", data)
|
||||
|
||||
class ExportFuncsNode(AstNode):
|
||||
def __init__(self, filename, lineno, fns, classes):
|
||||
@@ -197,25 +197,25 @@ class ExportFuncsNode(AstNode):
|
||||
vars.append([allvars[0], allvars[2]])
|
||||
|
||||
for (var, calledvar) in vars:
|
||||
if data.getVar(var) and not data.getVarFlag(var, 'export_func'):
|
||||
if bb.data.getVar(var, data) and not bb.data.getVarFlag(var, 'export_func', data):
|
||||
continue
|
||||
|
||||
if data.getVar(var):
|
||||
data.setVarFlag(var, 'python', None)
|
||||
data.setVarFlag(var, 'func', None)
|
||||
if bb.data.getVar(var, data):
|
||||
bb.data.setVarFlag(var, 'python', None, data)
|
||||
bb.data.setVarFlag(var, 'func', None, data)
|
||||
|
||||
for flag in [ "func", "python" ]:
|
||||
if data.getVarFlag(calledvar, flag):
|
||||
data.setVarFlag(var, flag, data.getVarFlag(calledvar, flag))
|
||||
if bb.data.getVarFlag(calledvar, flag, data):
|
||||
bb.data.setVarFlag(var, flag, bb.data.getVarFlag(calledvar, flag, data), data)
|
||||
for flag in [ "dirs" ]:
|
||||
if data.getVarFlag(var, flag):
|
||||
data.setVarFlag(calledvar, flag, data.getVarFlag(var, flag))
|
||||
if bb.data.getVarFlag(var, flag, data):
|
||||
bb.data.setVarFlag(calledvar, flag, bb.data.getVarFlag(var, flag, data), data)
|
||||
|
||||
if data.getVarFlag(calledvar, "python"):
|
||||
data.setVar(var, "\tbb.build.exec_func('" + calledvar + "', d)\n")
|
||||
if bb.data.getVarFlag(calledvar, "python", data):
|
||||
bb.data.setVar(var, "\tbb.build.exec_func('" + calledvar + "', d)\n", data)
|
||||
else:
|
||||
data.setVar(var, "\t" + calledvar + "\n")
|
||||
data.setVarFlag(var, 'export_func', '1')
|
||||
bb.data.setVar(var, "\t" + calledvar + "\n", data)
|
||||
bb.data.setVarFlag(var, 'export_func', '1', data)
|
||||
|
||||
class AddTaskNode(AstNode):
|
||||
def __init__(self, filename, lineno, func, before, after):
|
||||
@@ -229,25 +229,25 @@ class AddTaskNode(AstNode):
|
||||
if self.func[:3] != "do_":
|
||||
var = "do_" + self.func
|
||||
|
||||
data.setVarFlag(var, "task", 1)
|
||||
bbtasks = data.getVar('__BBTASKS') or []
|
||||
bb.data.setVarFlag(var, "task", 1, data)
|
||||
bbtasks = bb.data.getVar('__BBTASKS', data) or []
|
||||
if not var in bbtasks:
|
||||
bbtasks.append(var)
|
||||
data.setVar('__BBTASKS', bbtasks)
|
||||
bb.data.setVar('__BBTASKS', bbtasks, data)
|
||||
|
||||
existing = data.getVarFlag(var, "deps") or []
|
||||
existing = bb.data.getVarFlag(var, "deps", data) or []
|
||||
if self.after is not None:
|
||||
# set up deps for function
|
||||
for entry in self.after.split():
|
||||
if entry not in existing:
|
||||
existing.append(entry)
|
||||
data.setVarFlag(var, "deps", existing)
|
||||
bb.data.setVarFlag(var, "deps", existing, data)
|
||||
if self.before is not None:
|
||||
# set up things that depend on this func
|
||||
for entry in self.before.split():
|
||||
existing = data.getVarFlag(entry, "deps") or []
|
||||
existing = bb.data.getVarFlag(entry, "deps", data) or []
|
||||
if var not in existing:
|
||||
data.setVarFlag(entry, "deps", [var] + existing)
|
||||
bb.data.setVarFlag(entry, "deps", [var] + existing, data)
|
||||
|
||||
class BBHandlerNode(AstNode):
|
||||
def __init__(self, filename, lineno, fns):
|
||||
@@ -255,11 +255,11 @@ class BBHandlerNode(AstNode):
|
||||
self.hs = fns.split()
|
||||
|
||||
def eval(self, data):
|
||||
bbhands = data.getVar('__BBHANDLERS') or []
|
||||
bbhands = bb.data.getVar('__BBHANDLERS', data) or []
|
||||
for h in self.hs:
|
||||
bbhands.append(h)
|
||||
data.setVarFlag(h, "handler", 1)
|
||||
data.setVar('__BBHANDLERS', bbhands)
|
||||
bb.data.setVarFlag(h, "handler", 1, data)
|
||||
bb.data.setVar('__BBHANDLERS', bbhands, data)
|
||||
|
||||
class InheritNode(AstNode):
|
||||
def __init__(self, filename, lineno, classes):
|
||||
@@ -307,23 +307,21 @@ def handleInherit(statements, filename, lineno, m):
|
||||
statements.append(InheritNode(filename, lineno, classes.split()))
|
||||
|
||||
def finalize(fn, d, variant = None):
|
||||
all_handlers = {}
|
||||
for var in d.getVar('__BBHANDLERS') or []:
|
||||
# try to add the handler
|
||||
handler = d.getVar(var)
|
||||
bb.event.register(var, handler)
|
||||
|
||||
bb.event.fire(bb.event.RecipePreFinalise(fn), d)
|
||||
|
||||
bb.data.expandKeys(d)
|
||||
bb.data.update_data(d)
|
||||
code = []
|
||||
for funcname in d.getVar("__BBANONFUNCS") or []:
|
||||
for funcname in bb.data.getVar("__BBANONFUNCS", d) or []:
|
||||
code.append("%s(d)" % funcname)
|
||||
bb.utils.simple_exec("\n".join(code), {"d": d})
|
||||
bb.data.update_data(d)
|
||||
|
||||
tasklist = d.getVar('__BBTASKS') or []
|
||||
all_handlers = {}
|
||||
for var in bb.data.getVar('__BBHANDLERS', d) or []:
|
||||
# try to add the handler
|
||||
handler = bb.data.getVar(var, d)
|
||||
bb.event.register(var, handler)
|
||||
|
||||
tasklist = bb.data.getVar('__BBTASKS', d) or []
|
||||
bb.build.add_tasks(tasklist, d)
|
||||
|
||||
bb.parse.siggen.finalise(fn, d, variant)
|
||||
@@ -371,14 +369,12 @@ def multi_finalize(fn, d):
|
||||
logger.debug(2, "Appending .bbappend file %s to %s", append, fn)
|
||||
bb.parse.BBHandler.handle(append, d, True)
|
||||
|
||||
onlyfinalise = d.getVar("__ONLYFINALISE", False)
|
||||
|
||||
safe_d = d
|
||||
d = bb.data.createCopy(safe_d)
|
||||
try:
|
||||
finalize(fn, d)
|
||||
except bb.parse.SkipPackage as e:
|
||||
d.setVar("__SKIPPED", e.args[0])
|
||||
except bb.parse.SkipPackage:
|
||||
bb.data.setVar("__SKIPPED", True, d)
|
||||
datastores = {"": safe_d}
|
||||
|
||||
versions = (d.getVar("BBVERSIONS", True) or "").split()
|
||||
@@ -420,48 +416,27 @@ def multi_finalize(fn, d):
|
||||
verfunc(pv, d, safe_d)
|
||||
try:
|
||||
finalize(fn, d)
|
||||
except bb.parse.SkipPackage as e:
|
||||
d.setVar("__SKIPPED", e.args[0])
|
||||
except bb.parse.SkipPackage:
|
||||
bb.data.setVar("__SKIPPED", True, d)
|
||||
|
||||
_create_variants(datastores, versions, verfunc)
|
||||
|
||||
extended = d.getVar("BBCLASSEXTEND", True) or ""
|
||||
if extended:
|
||||
# the following is to support bbextends with arguments, for e.g. multilib
|
||||
# an example is as follows:
|
||||
# BBCLASSEXTEND = "multilib:lib32"
|
||||
# it will create foo-lib32, inheriting multilib.bbclass and set
|
||||
# BBEXTENDCURR to "multilib" and BBEXTENDVARIANT to "lib32"
|
||||
extendedmap = {}
|
||||
variantmap = {}
|
||||
|
||||
for ext in extended.split():
|
||||
eext = ext.split(':', 2)
|
||||
if len(eext) > 1:
|
||||
extendedmap[ext] = eext[0]
|
||||
variantmap[ext] = eext[1]
|
||||
else:
|
||||
extendedmap[ext] = ext
|
||||
|
||||
pn = d.getVar("PN", True)
|
||||
def extendfunc(name, d):
|
||||
if name != extendedmap[name]:
|
||||
d.setVar("BBEXTENDCURR", extendedmap[name])
|
||||
d.setVar("BBEXTENDVARIANT", variantmap[name])
|
||||
else:
|
||||
d.setVar("PN", "%s-%s" % (pn, name))
|
||||
bb.parse.BBHandler.inherit([extendedmap[name]], d)
|
||||
d.setVar("PN", "%s-%s" % (pn, name))
|
||||
bb.parse.BBHandler.inherit([name], d)
|
||||
|
||||
safe_d.setVar("BBCLASSEXTEND", extended)
|
||||
_create_variants(datastores, extendedmap.keys(), extendfunc)
|
||||
_create_variants(datastores, extended.split(), extendfunc)
|
||||
|
||||
for variant, variant_d in datastores.iteritems():
|
||||
if variant:
|
||||
try:
|
||||
if not onlyfinalise or variant in onlyfinalise:
|
||||
finalize(fn, variant_d, variant)
|
||||
except bb.parse.SkipPackage as e:
|
||||
variant_d.setVar("__SKIPPED", e.args[0])
|
||||
finalize(fn, variant_d, variant)
|
||||
except bb.parse.SkipPackage:
|
||||
bb.data.setVar("__SKIPPED", True, variant_d)
|
||||
|
||||
if len(datastores) > 1:
|
||||
variants = filter(None, datastores.iterkeys())
|
||||
|
||||
@@ -148,7 +148,7 @@ def handle(fn, d, include):
|
||||
|
||||
# DONE WITH PARSING... time to evaluate
|
||||
if ext != ".bbclass":
|
||||
data.setVar('FILE', abs_fn, d)
|
||||
data.setVar('FILE', fn, d)
|
||||
|
||||
statements.eval(d)
|
||||
|
||||
@@ -159,7 +159,7 @@ def handle(fn, d, include):
|
||||
return ast.multi_finalize(fn, d)
|
||||
|
||||
if oldfile:
|
||||
d.setVar("FILE", oldfile)
|
||||
bb.data.setVar("FILE", oldfile, d)
|
||||
|
||||
# we have parsed the bb class now
|
||||
if ext == ".bbclass" or ext == ".inc":
|
||||
@@ -193,21 +193,22 @@ def feeder(lineno, s, fn, root, statements):
|
||||
if lineno == IN_PYTHON_EOF:
|
||||
return
|
||||
|
||||
if s and s[0] == '#':
|
||||
|
||||
# Skip empty lines
|
||||
if s == '':
|
||||
return
|
||||
|
||||
if s[0] == '#':
|
||||
if len(__residue__) != 0 and __residue__[0][0] != "#":
|
||||
bb.error("There is a comment on line %s of file %s (%s) which is in the middle of a multiline expression.\nBitbake used to ignore these but no longer does so, please fix your metadata as errors are likely as a result of this change." % (lineno, fn, s))
|
||||
|
||||
if s and s[-1] == '\\':
|
||||
if s[-1] == '\\':
|
||||
__residue__.append(s[:-1])
|
||||
return
|
||||
|
||||
s = "".join(__residue__) + s
|
||||
__residue__ = []
|
||||
|
||||
# Skip empty lines
|
||||
if s == '':
|
||||
return
|
||||
|
||||
# Skip comments
|
||||
if s[0] == '#':
|
||||
return
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
# with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
import re, os
|
||||
import re, bb.data, os
|
||||
import logging
|
||||
import bb.utils
|
||||
from bb.parse import ParseError, resolve_file, ast, logger
|
||||
@@ -36,9 +36,9 @@ __require_regexp__ = re.compile( r"require\s+(.+)" )
|
||||
__export_regexp__ = re.compile( r"export\s+(.+)" )
|
||||
|
||||
def init(data):
|
||||
topdir = data.getVar('TOPDIR')
|
||||
topdir = bb.data.getVar('TOPDIR', data)
|
||||
if not topdir:
|
||||
data.setVar('TOPDIR', os.getcwd())
|
||||
bb.data.setVar('TOPDIR', os.getcwd(), data)
|
||||
|
||||
|
||||
def supports(fn, d):
|
||||
@@ -53,12 +53,12 @@ def include(oldfn, fn, data, error_out):
|
||||
return None
|
||||
|
||||
import bb
|
||||
fn = data.expand(fn)
|
||||
oldfn = data.expand(oldfn)
|
||||
fn = bb.data.expand(fn, data)
|
||||
oldfn = bb.data.expand(oldfn, data)
|
||||
|
||||
if not os.path.isabs(fn):
|
||||
dname = os.path.dirname(oldfn)
|
||||
bbpath = "%s:%s" % (dname, data.getVar("BBPATH", 1))
|
||||
bbpath = "%s:%s" % (dname, bb.data.getVar("BBPATH", data, 1))
|
||||
abs_fn = bb.utils.which(bbpath, fn)
|
||||
if abs_fn:
|
||||
fn = abs_fn
|
||||
@@ -77,7 +77,7 @@ def handle(fn, data, include):
|
||||
if include == 0:
|
||||
oldfile = None
|
||||
else:
|
||||
oldfile = data.getVar('FILE')
|
||||
oldfile = bb.data.getVar('FILE', data)
|
||||
|
||||
abs_fn = resolve_file(fn, data)
|
||||
f = open(abs_fn, 'r')
|
||||
@@ -96,16 +96,16 @@ def handle(fn, data, include):
|
||||
s = s.rstrip()
|
||||
if s[0] == '#': continue # skip comments
|
||||
while s[-1] == '\\':
|
||||
s2 = f.readline().strip()
|
||||
s2 = f.readline()[:-1].strip()
|
||||
lineno = lineno + 1
|
||||
s = s[:-1] + s2
|
||||
feeder(lineno, s, fn, statements)
|
||||
|
||||
# DONE WITH PARSING... time to evaluate
|
||||
data.setVar('FILE', abs_fn)
|
||||
bb.data.setVar('FILE', fn, data)
|
||||
statements.eval(data)
|
||||
if oldfile:
|
||||
data.setVar('FILE', oldfile)
|
||||
bb.data.setVar('FILE', oldfile, data)
|
||||
|
||||
return data
|
||||
|
||||
|
||||
@@ -26,8 +26,7 @@ import logging
|
||||
import os.path
|
||||
import sys
|
||||
import warnings
|
||||
from bb.compat import total_ordering
|
||||
from collections import Mapping
|
||||
import bb.msg, bb.data, bb.utils
|
||||
|
||||
try:
|
||||
import sqlite3
|
||||
@@ -40,11 +39,8 @@ if sqlversion[0] < 3 or (sqlversion[0] == 3 and sqlversion[1] < 3):
|
||||
|
||||
|
||||
logger = logging.getLogger("BitBake.PersistData")
|
||||
if hasattr(sqlite3, 'enable_shared_cache'):
|
||||
sqlite3.enable_shared_cache(True)
|
||||
|
||||
|
||||
@total_ordering
|
||||
class SQLTable(collections.MutableMapping):
|
||||
"""Object representing a table/domain in the database"""
|
||||
def __init__(self, cursor, table):
|
||||
@@ -66,31 +62,16 @@ class SQLTable(collections.MutableMapping):
|
||||
continue
|
||||
raise
|
||||
|
||||
def __enter__(self):
|
||||
self.cursor.__enter__()
|
||||
return self
|
||||
|
||||
def __exit__(self, *excinfo):
|
||||
self.cursor.__exit__(*excinfo)
|
||||
|
||||
def __getitem__(self, key):
|
||||
data = self._execute("SELECT * from %s where key=?;" %
|
||||
self.table, [key])
|
||||
for row in data:
|
||||
return row[1]
|
||||
raise KeyError(key)
|
||||
|
||||
def __delitem__(self, key):
|
||||
if key not in self:
|
||||
raise KeyError(key)
|
||||
self._execute("DELETE from %s where key=?;" % self.table, [key])
|
||||
|
||||
def __setitem__(self, key, value):
|
||||
if not isinstance(key, basestring):
|
||||
raise TypeError('Only string keys are supported')
|
||||
elif not isinstance(value, basestring):
|
||||
raise TypeError('Only string values are supported')
|
||||
|
||||
data = self._execute("SELECT * from %s where key=?;" %
|
||||
self.table, [key])
|
||||
exists = len(list(data))
|
||||
@@ -111,40 +92,53 @@ class SQLTable(collections.MutableMapping):
|
||||
|
||||
def __iter__(self):
|
||||
data = self._execute("SELECT key FROM %s;" % self.table)
|
||||
return (row[0] for row in data)
|
||||
for row in data:
|
||||
yield row[0]
|
||||
|
||||
def __lt__(self, other):
|
||||
if not isinstance(other, Mapping):
|
||||
raise NotImplemented
|
||||
|
||||
return len(self) < len(other)
|
||||
|
||||
def values(self):
|
||||
return list(self.itervalues())
|
||||
def iteritems(self):
|
||||
data = self._execute("SELECT * FROM %s;" % self.table)
|
||||
for row in data:
|
||||
yield row[0], row[1]
|
||||
|
||||
def itervalues(self):
|
||||
data = self._execute("SELECT value FROM %s;" % self.table)
|
||||
return (row[0] for row in data)
|
||||
for row in data:
|
||||
yield row[0]
|
||||
|
||||
def items(self):
|
||||
return list(self.iteritems())
|
||||
|
||||
def iteritems(self):
|
||||
return self._execute("SELECT * FROM %s;" % self.table)
|
||||
class SQLData(object):
|
||||
"""Object representing the persistent data"""
|
||||
def __init__(self, filename):
|
||||
bb.utils.mkdirhier(os.path.dirname(filename))
|
||||
|
||||
def clear(self):
|
||||
self._execute("DELETE FROM %s;" % self.table)
|
||||
self.filename = filename
|
||||
self.connection = sqlite3.connect(filename, timeout=30,
|
||||
isolation_level=None)
|
||||
self.cursor = self.connection.cursor()
|
||||
self._tables = {}
|
||||
|
||||
def has_key(self, key):
|
||||
return key in self
|
||||
def __getitem__(self, table):
|
||||
if not isinstance(table, basestring):
|
||||
raise TypeError("table argument must be a string, not '%s'" %
|
||||
type(table))
|
||||
|
||||
if table in self._tables:
|
||||
return self._tables[table]
|
||||
else:
|
||||
tableobj = self._tables[table] = SQLTable(self.cursor, table)
|
||||
return tableobj
|
||||
|
||||
def __delitem__(self, table):
|
||||
if table in self._tables:
|
||||
del self._tables[table]
|
||||
self.cursor.execute("DROP TABLE IF EXISTS %s;" % table)
|
||||
|
||||
|
||||
class PersistData(object):
|
||||
"""Deprecated representation of the bitbake persistent data store"""
|
||||
def __init__(self, d):
|
||||
warnings.warn("Use of PersistData is deprecated. Please use "
|
||||
"persist(domain, d) instead.",
|
||||
category=DeprecationWarning,
|
||||
warnings.warn("Use of PersistData will be deprecated in the future",
|
||||
category=PendingDeprecationWarning,
|
||||
stacklevel=2)
|
||||
|
||||
self.data = persist(d)
|
||||
@@ -187,19 +181,14 @@ class PersistData(object):
|
||||
"""
|
||||
del self.data[domain][key]
|
||||
|
||||
def connect(database):
|
||||
return sqlite3.connect(database, timeout=30, isolation_level=None)
|
||||
|
||||
def persist(domain, d):
|
||||
"""Convenience factory for SQLTable objects based upon metadata"""
|
||||
import bb.utils
|
||||
cachedir = (d.getVar("PERSISTENT_DIR", True) or
|
||||
d.getVar("CACHE", True))
|
||||
def persist(d):
|
||||
"""Convenience factory for construction of SQLData based upon metadata"""
|
||||
cachedir = (bb.data.getVar("PERSISTENT_DIR", d, True) or
|
||||
bb.data.getVar("CACHE", d, True))
|
||||
if not cachedir:
|
||||
logger.critical("Please set the 'PERSISTENT_DIR' or 'CACHE' variable")
|
||||
sys.exit(1)
|
||||
|
||||
bb.utils.mkdirhier(cachedir)
|
||||
cachefile = os.path.join(cachedir, "bb_persist_data.sqlite3")
|
||||
connection = connect(cachefile)
|
||||
return SQLTable(connection, domain)
|
||||
return SQLData(cachefile)
|
||||
|
||||
@@ -93,7 +93,7 @@ def run(cmd, input=None, log=None, **options):
|
||||
|
||||
try:
|
||||
pipe = Popen(cmd, **options)
|
||||
except OSError as exc:
|
||||
except OSError, exc:
|
||||
if exc.errno == 2:
|
||||
raise NotFoundError(cmd)
|
||||
else:
|
||||
|
||||
@@ -84,10 +84,10 @@ def findPreferredProvider(pn, cfgData, dataCache, pkg_pn = None, item = None):
|
||||
preferred_ver = None
|
||||
|
||||
localdata = data.createCopy(cfgData)
|
||||
localdata.setVar('OVERRIDES', "%s:pn-%s:%s" % (data.getVar('OVERRIDES', localdata), pn, pn))
|
||||
bb.data.setVar('OVERRIDES', "pn-%s:%s:%s" % (pn, pn, data.getVar('OVERRIDES', localdata)), localdata)
|
||||
bb.data.update_data(localdata)
|
||||
|
||||
preferred_v = localdata.getVar('PREFERRED_VERSION', True)
|
||||
preferred_v = bb.data.getVar('PREFERRED_VERSION_%s' % pn, localdata, True)
|
||||
if preferred_v:
|
||||
m = re.match('(\d+:)*(.*)(_.*)*', preferred_v)
|
||||
if m:
|
||||
@@ -124,18 +124,6 @@ def findPreferredProvider(pn, cfgData, dataCache, pkg_pn = None, item = None):
|
||||
itemstr = " (for item %s)" % item
|
||||
if preferred_file is None:
|
||||
logger.info("preferred version %s of %s not available%s", pv_str, pn, itemstr)
|
||||
available_vers = []
|
||||
for file_set in pkg_pn:
|
||||
for f in file_set:
|
||||
pe, pv, pr = dataCache.pkg_pepvpr[f]
|
||||
ver_str = pv
|
||||
if pe:
|
||||
ver_str = "%s:%s" % (pe, ver_str)
|
||||
if not ver_str in available_vers:
|
||||
available_vers.append(ver_str)
|
||||
if available_vers:
|
||||
available_vers.sort()
|
||||
logger.info("versions of %s available: %s", pn, ' '.join(available_vers))
|
||||
else:
|
||||
logger.debug(1, "selecting %s as PREFERRED_VERSION %s of package %s%s", preferred_file, pv_str, pn, itemstr)
|
||||
|
||||
@@ -248,7 +236,7 @@ def filterProviders(providers, item, cfgData, dataCache):
|
||||
|
||||
eligible = _filterProviders(providers, item, cfgData, dataCache)
|
||||
|
||||
prefervar = cfgData.getVar('PREFERRED_PROVIDER_%s' % item, 1)
|
||||
prefervar = bb.data.getVar('PREFERRED_PROVIDER_%s' % item, cfgData, 1)
|
||||
if prefervar:
|
||||
dataCache.preferred[item] = prefervar
|
||||
|
||||
@@ -286,8 +274,8 @@ def filterProvidersRunTime(providers, item, cfgData, dataCache):
|
||||
pn = dataCache.pkg_fn[p]
|
||||
provides = dataCache.pn_provides[pn]
|
||||
for provide in provides:
|
||||
prefervar = cfgData.getVar('PREFERRED_PROVIDER_%s' % provide, 1)
|
||||
logger.debug(1, "checking PREFERRED_PROVIDER_%s (value %s) against %s", provide, prefervar, pns.keys())
|
||||
prefervar = bb.data.getVar('PREFERRED_PROVIDER_%s' % provide, cfgData, 1)
|
||||
logger.verbose("checking PREFERRED_PROVIDER_%s (value %s) against %s", provide, prefervar, pns.keys())
|
||||
if prefervar in pns and pns[prefervar] not in preferred:
|
||||
var = "PREFERRED_PROVIDER_%s = %s" % (provide, prefervar)
|
||||
logger.verbose("selecting %s to satisfy runtime %s due to %s", prefervar, item, var)
|
||||
|
||||
@@ -151,7 +151,7 @@ def builtin_trap(name, args, interp, env, stdin, stdout, stderr, debugflags):
|
||||
for sig in args[1:]:
|
||||
try:
|
||||
env.traps[sig] = action
|
||||
except Exception as e:
|
||||
except Exception, e:
|
||||
stderr.write('trap: %s\n' % str(e))
|
||||
return 0
|
||||
|
||||
@@ -214,7 +214,7 @@ def utility_cat(name, args, interp, env, stdin, stdout, stderr, debugflags):
|
||||
data = f.read()
|
||||
finally:
|
||||
f.close()
|
||||
except IOError as e:
|
||||
except IOError, e:
|
||||
if e.errno != errno.ENOENT:
|
||||
raise
|
||||
status = 1
|
||||
@@ -433,7 +433,7 @@ def utility_mkdir(name, args, interp, env, stdin, stdout, stderr, debugflags):
|
||||
if option.has_p:
|
||||
try:
|
||||
os.makedirs(path)
|
||||
except IOError as e:
|
||||
except IOError, e:
|
||||
if e.errno != errno.EEXIST:
|
||||
raise
|
||||
else:
|
||||
@@ -561,7 +561,7 @@ def utility_sort(name, args, interp, env, stdin, stdout, stderr, debugflags):
|
||||
lines = f.readlines()
|
||||
finally:
|
||||
f.close()
|
||||
except IOError as e:
|
||||
except IOError, e:
|
||||
stderr.write(str(e) + '\n')
|
||||
return 1
|
||||
|
||||
@@ -679,7 +679,7 @@ def run_command(name, args, interp, env, stdin, stdout,
|
||||
p = subprocess.Popen([name] + args, cwd=env['PWD'], env=exec_env,
|
||||
stdin=stdin, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||
out, err = p.communicate()
|
||||
except WindowsError as e:
|
||||
except WindowsError, e:
|
||||
raise UtilityError(str(e))
|
||||
|
||||
if not unixoutput:
|
||||
|
||||
@@ -248,7 +248,7 @@ class Redirections:
|
||||
raise NotImplementedError('cannot open absolute path %s' % repr(filename))
|
||||
else:
|
||||
f = file(filename, mode+'b')
|
||||
except IOError as e:
|
||||
except IOError, e:
|
||||
raise RedirectionError(str(e))
|
||||
|
||||
wrapper = None
|
||||
@@ -368,7 +368,7 @@ def resolve_shebang(path, ignoreshell=False):
|
||||
if arg is None:
|
||||
return [cmd, win32_to_unix_path(path)]
|
||||
return [cmd, arg, win32_to_unix_path(path)]
|
||||
except IOError as e:
|
||||
except IOError, e:
|
||||
if e.errno!=errno.ENOENT and \
|
||||
(e.errno!=errno.EPERM and not os.path.isdir(path)): # Opening a directory raises EPERM
|
||||
raise
|
||||
@@ -747,7 +747,7 @@ class Interpreter:
|
||||
for cmd in cmds:
|
||||
try:
|
||||
status = self.execute(cmd)
|
||||
except ExitSignal as e:
|
||||
except ExitSignal, e:
|
||||
if sourced:
|
||||
raise
|
||||
status = int(e.args[0])
|
||||
@@ -758,13 +758,13 @@ class Interpreter:
|
||||
if 'debug-utility' in self._debugflags or 'debug-cmd' in self._debugflags:
|
||||
self.log('returncode ' + str(status)+ '\n')
|
||||
return status
|
||||
except CommandNotFound as e:
|
||||
except CommandNotFound, e:
|
||||
print >>self._redirs.stderr, str(e)
|
||||
self._redirs.stderr.flush()
|
||||
# Command not found by non-interactive shell
|
||||
# return 127
|
||||
raise
|
||||
except RedirectionError as e:
|
||||
except RedirectionError, e:
|
||||
# TODO: should be handled depending on the utility status
|
||||
print >>self._redirs.stderr, str(e)
|
||||
self._redirs.stderr.flush()
|
||||
@@ -948,7 +948,7 @@ class Interpreter:
|
||||
status = self.execute(func, redirs)
|
||||
finally:
|
||||
redirs.close()
|
||||
except ReturnSignal as e:
|
||||
except ReturnSignal, e:
|
||||
status = int(e.args[0])
|
||||
env['?'] = status
|
||||
return status
|
||||
@@ -1044,7 +1044,7 @@ class Interpreter:
|
||||
|
||||
except ReturnSignal:
|
||||
raise
|
||||
except ShellError as e:
|
||||
except ShellError, e:
|
||||
if is_special or isinstance(e, (ExitSignal,
|
||||
ShellSyntaxError, ExpansionError)):
|
||||
raise e
|
||||
|
||||
@@ -105,11 +105,6 @@ class RunQueueScheduler(object):
|
||||
if self.rq.runq_running[taskid] == 1:
|
||||
continue
|
||||
if self.rq.runq_buildable[taskid] == 1:
|
||||
fn = self.rqdata.taskData.fn_index[self.rqdata.runq_fnid[taskid]]
|
||||
taskname = self.rqdata.runq_task[taskid]
|
||||
stamp = bb.build.stampfile(taskname, self.rqdata.dataCache, fn)
|
||||
if stamp in self.rq.build_stamps.values():
|
||||
continue
|
||||
return taskid
|
||||
|
||||
def next(self):
|
||||
@@ -188,8 +183,8 @@ class RunQueueData:
|
||||
self.targets = targets
|
||||
self.rq = rq
|
||||
|
||||
self.stampwhitelist = cfgData.getVar("BB_STAMP_WHITELIST", 1) or ""
|
||||
self.multi_provider_whitelist = (cfgData.getVar("MULTI_PROVIDER_WHITELIST", 1) or "").split()
|
||||
self.stampwhitelist = bb.data.getVar("BB_STAMP_WHITELIST", cfgData, 1) or ""
|
||||
self.multi_provider_whitelist = (bb.data.getVar("MULTI_PROVIDER_WHITELIST", cfgData, 1) or "").split()
|
||||
|
||||
self.reset()
|
||||
|
||||
@@ -362,7 +357,7 @@ class RunQueueData:
|
||||
message = "\n"
|
||||
for msg in msgs:
|
||||
message = message + msg
|
||||
bb.msg.fatal("RunQueue", message)
|
||||
bb.msg.fatal(bb.msg.domain.RunQueue, message)
|
||||
|
||||
return weight
|
||||
|
||||
@@ -470,7 +465,7 @@ class RunQueueData:
|
||||
dep = taskData.fn_index[depdata]
|
||||
taskid = taskData.gettask_id(dep, idependtask, False)
|
||||
if taskid is None:
|
||||
bb.msg.fatal("RunQueue", "Task %s in %s depends upon nonexistant task %s in %s" % (taskData.tasks_name[task], fn, idependtask, dep))
|
||||
bb.msg.fatal(bb.msg.domain.RunQueue, "Task %s in %s depends upon nonexistant task %s in %s" % (taskData.tasks_name[task], fn, idependtask, dep))
|
||||
depends.append(taskid)
|
||||
if depdata != fnid:
|
||||
tdepends_fnid[fnid].add(taskid)
|
||||
@@ -587,7 +582,7 @@ class RunQueueData:
|
||||
continue
|
||||
|
||||
if target[1] not in taskData.tasks_lookup[fnid]:
|
||||
bb.msg.fatal("RunQueue", "Task %s does not exist for target %s" % (target[1], target[0]))
|
||||
bb.msg.fatal(bb.msg.domain.RunQueue, "Task %s does not exist for target %s" % (target[1], target[0]))
|
||||
|
||||
listid = taskData.tasks_lookup[fnid][target[1]]
|
||||
|
||||
@@ -619,9 +614,9 @@ class RunQueueData:
|
||||
# Check to make sure we still have tasks to run
|
||||
if len(self.runq_fnid) == 0:
|
||||
if not taskData.abort:
|
||||
bb.msg.fatal("RunQueue", "All buildable tasks have been run but the build is incomplete (--continue mode). Errors for the tasks that failed will have been printed above.")
|
||||
bb.msg.fatal(bb.msg.domain.RunQueue, "All buildable tasks have been run but the build is incomplete (--continue mode). Errors for the tasks that failed will have been printed above.")
|
||||
else:
|
||||
bb.msg.fatal("RunQueue", "No active tasks and not in --continue mode?! Please report this bug.")
|
||||
bb.msg.fatal(bb.msg.domain.RunQueue, "No active tasks and not in --continue mode?! Please report this bug.")
|
||||
|
||||
logger.verbose("Pruned %s inactive tasks, %s left", delcount, len(self.runq_fnid))
|
||||
|
||||
@@ -632,7 +627,7 @@ class RunQueueData:
|
||||
origdeps = self.runq_depends[listid]
|
||||
for origdep in origdeps:
|
||||
if maps[origdep] == -1:
|
||||
bb.msg.fatal("RunQueue", "Invalid mapping - Should never happen!")
|
||||
bb.msg.fatal(bb.msg.domain.RunQueue, "Invalid mapping - Should never happen!")
|
||||
newdeps.append(maps[origdep])
|
||||
self.runq_depends[listid] = set(newdeps)
|
||||
|
||||
@@ -653,7 +648,7 @@ class RunQueueData:
|
||||
for dep in revdeps:
|
||||
if dep in self.runq_depends[listid]:
|
||||
#self.dump_data(taskData)
|
||||
bb.msg.fatal("RunQueue", "Task %s (%s) has circular dependency on %s (%s)" % (taskData.fn_index[self.runq_fnid[dep]], self.runq_task[dep], taskData.fn_index[self.runq_fnid[listid]], self.runq_task[listid]))
|
||||
bb.msg.fatal(bb.msg.domain.RunQueue, "Task %s (%s) has circular dependency on %s (%s)" % (taskData.fn_index[self.runq_fnid[dep]], self.runq_task[dep], taskData.fn_index[self.runq_fnid[listid]], self.runq_task[listid]))
|
||||
|
||||
logger.verbose("Compute totals (have %s endpoint(s))", len(endpoints))
|
||||
|
||||
@@ -758,6 +753,7 @@ class RunQueueData:
|
||||
self.rqdata.runq_depends[task],
|
||||
self.rqdata.runq_revdeps[task])
|
||||
|
||||
|
||||
class RunQueue:
|
||||
def __init__(self, cooker, cfgData, dataCache, taskData, targets):
|
||||
|
||||
@@ -765,9 +761,8 @@ class RunQueue:
|
||||
self.cfgData = cfgData
|
||||
self.rqdata = RunQueueData(self, cooker, cfgData, dataCache, taskData, targets)
|
||||
|
||||
self.stamppolicy = cfgData.getVar("BB_STAMP_POLICY", True) or "perfile"
|
||||
self.hashvalidate = cfgData.getVar("BB_HASHCHECK_FUNCTION", True) or None
|
||||
self.setsceneverify = cfgData.getVar("BB_SETSCENE_VERIFY_FUNCTION", True) or None
|
||||
self.stamppolicy = bb.data.getVar("BB_STAMP_POLICY", cfgData, True) or "perfile"
|
||||
self.hashvalidate = bb.data.getVar("BB_HASHCHECK_FUNCTION", cfgData, True) or None
|
||||
|
||||
self.state = runQueuePrepare
|
||||
|
||||
@@ -862,7 +857,7 @@ class RunQueue:
|
||||
#print "Not current: %s" % notcurrent
|
||||
|
||||
if len(unchecked) > 0:
|
||||
bb.msg.fatal("RunQueue", "check_stamps fatal internal error")
|
||||
bb.msg.fatal(bb.msg.domain.RunQueue, "check_stamps fatal internal error")
|
||||
return current
|
||||
|
||||
def check_stamp_task(self, task, taskname = None):
|
||||
@@ -934,7 +929,7 @@ class RunQueue:
|
||||
|
||||
if self.state is runQueuePrepare:
|
||||
self.rqexe = RunQueueExecuteDummy(self)
|
||||
if self.rqdata.prepare() == 0:
|
||||
if self.rqdata.prepare() is 0:
|
||||
self.state = runQueueComplete
|
||||
else:
|
||||
self.state = runQueueSceneInit
|
||||
@@ -1007,15 +1002,14 @@ class RunQueueExecute:
|
||||
self.cfgData = rq.cfgData
|
||||
self.rqdata = rq.rqdata
|
||||
|
||||
self.number_tasks = int(self.cfgData.getVar("BB_NUMBER_THREADS", 1) or 1)
|
||||
self.scheduler = self.cfgData.getVar("BB_SCHEDULER", 1) or "speed"
|
||||
self.number_tasks = int(bb.data.getVar("BB_NUMBER_THREADS", self.cfgData, 1) or 1)
|
||||
self.scheduler = bb.data.getVar("BB_SCHEDULER", self.cfgData, 1) or "speed"
|
||||
|
||||
self.runq_buildable = []
|
||||
self.runq_running = []
|
||||
self.runq_complete = []
|
||||
self.build_pids = {}
|
||||
self.build_pipes = {}
|
||||
self.build_stamps = {}
|
||||
self.failed_fnids = []
|
||||
|
||||
def runqueue_process_waitpid(self):
|
||||
@@ -1024,15 +1018,12 @@ class RunQueueExecute:
|
||||
collect the process exit codes and close the information pipe.
|
||||
"""
|
||||
result = os.waitpid(-1, os.WNOHANG)
|
||||
if result[0] == 0 and result[1] == 0:
|
||||
if result[0] is 0 and result[1] is 0:
|
||||
return None
|
||||
task = self.build_pids[result[0]]
|
||||
del self.build_pids[result[0]]
|
||||
self.build_pipes[result[0]].close()
|
||||
del self.build_pipes[result[0]]
|
||||
# self.build_stamps[result[0]] may not exist when use shared work directory.
|
||||
if result[0] in self.build_stamps.keys():
|
||||
del self.build_stamps[result[0]]
|
||||
if result[1] != 0:
|
||||
self.task_fail(task, result[1]>>8)
|
||||
else:
|
||||
@@ -1069,40 +1060,23 @@ class RunQueueExecute:
|
||||
return
|
||||
|
||||
def fork_off_task(self, fn, task, taskname, quieterrors=False):
|
||||
# We need to setup the environment BEFORE the fork, since
|
||||
# a fork() or exec*() activates PSEUDO...
|
||||
|
||||
envbackup = {}
|
||||
fakeenv = {}
|
||||
umask = None
|
||||
envbackup = os.environ.copy()
|
||||
env = {}
|
||||
|
||||
taskdep = self.rqdata.dataCache.task_deps[fn]
|
||||
if 'umask' in taskdep and taskname in taskdep['umask']:
|
||||
# umask might come in as a number or text string..
|
||||
try:
|
||||
umask = int(taskdep['umask'][taskname],8)
|
||||
except TypeError:
|
||||
umask = taskdep['umask'][taskname]
|
||||
|
||||
if 'fakeroot' in taskdep and taskname in taskdep['fakeroot']:
|
||||
envvars = (self.rqdata.dataCache.fakerootenv[fn] or "").split()
|
||||
for key, value in (var.split('=') for var in envvars):
|
||||
envbackup[key] = os.environ.get(key)
|
||||
os.environ[key] = value
|
||||
fakeenv[key] = value
|
||||
for var in envvars:
|
||||
comps = var.split("=")
|
||||
env[comps[0]] = comps[1]
|
||||
|
||||
fakedirs = (self.rqdata.dataCache.fakerootdirs[fn] or "").split()
|
||||
for p in fakedirs:
|
||||
bb.utils.mkdirhier(p)
|
||||
|
||||
logger.debug(2, 'Running %s:%s under fakeroot, fakedirs: %s' %
|
||||
(fn, taskname, ', '.join(fakedirs)))
|
||||
else:
|
||||
envvars = (self.rqdata.dataCache.fakerootnoenv[fn] or "").split()
|
||||
for key, value in (var.split('=') for var in envvars):
|
||||
envbackup[key] = os.environ.get(key)
|
||||
os.environ[key] = value
|
||||
fakeenv[key] = value
|
||||
bb.mkdirhier(p)
|
||||
logger.debug(2, "Running %s:%s under fakeroot, state dir is %s" % (fn, taskname, fakedirs))
|
||||
for e in env:
|
||||
os.putenv(e, env[e])
|
||||
|
||||
sys.stdout.flush()
|
||||
sys.stderr.flush()
|
||||
@@ -1112,8 +1086,7 @@ class RunQueueExecute:
|
||||
pipeout = os.fdopen(pipeout, 'wb', 0)
|
||||
pid = os.fork()
|
||||
except OSError as e:
|
||||
bb.msg.fatal("RunQueue", "fork failed: %d (%s)" % (e.errno, e.strerror))
|
||||
|
||||
bb.msg.fatal(bb.msg.domain.RunQueue, "fork failed: %d (%s)" % (e.errno, e.strerror))
|
||||
if pid == 0:
|
||||
pipein.close()
|
||||
|
||||
@@ -1121,6 +1094,12 @@ class RunQueueExecute:
|
||||
# events
|
||||
bb.event.worker_pid = os.getpid()
|
||||
bb.event.worker_pipe = pipeout
|
||||
bb.event.useStdout = False
|
||||
|
||||
# Child processes should send their messages to the UI
|
||||
# process via the server process, not print them
|
||||
# themselves
|
||||
bblogger.handlers = [bb.event.LogHandler()]
|
||||
|
||||
self.rq.state = runQueueChildProcess
|
||||
# Make the child the process group leader
|
||||
@@ -1129,51 +1108,47 @@ class RunQueueExecute:
|
||||
newsi = os.open(os.devnull, os.O_RDWR)
|
||||
os.dup2(newsi, sys.stdin.fileno())
|
||||
|
||||
if umask:
|
||||
os.umask(umask)
|
||||
|
||||
self.cooker.configuration.data.setVar("BB_WORKERCONTEXT", "1")
|
||||
self.cooker.configuration.data.setVar("__RUNQUEUE_DO_NOT_USE_EXTERNALLY", self)
|
||||
self.cooker.configuration.data.setVar("__RUNQUEUE_DO_NOT_USE_EXTERNALLY2", fn)
|
||||
the_data = bb.cache.Cache.loadDataFull(fn, self.cooker.get_file_appends(fn), self.cooker.configuration.data)
|
||||
|
||||
env2 = bb.data.export_vars(the_data)
|
||||
env2 = bb.data.export_envvars(env2, the_data)
|
||||
|
||||
for e in os.environ:
|
||||
os.unsetenv(e)
|
||||
for e in env2:
|
||||
os.putenv(e, env2[e])
|
||||
for e in env:
|
||||
os.putenv(e, env[e])
|
||||
|
||||
if quieterrors:
|
||||
the_data.setVarFlag(taskname, "quieterrors", "1")
|
||||
|
||||
bb.data.setVar("__RUNQUEUE_DO_NOT_USE_EXTERNALLY", self, self.cooker.configuration.data)
|
||||
bb.data.setVar("__RUNQUEUE_DO_NOT_USE_EXTERNALLY2", fn, self.cooker.configuration.data)
|
||||
bb.data.setVar("BB_WORKERCONTEXT", "1", the_data)
|
||||
bb.parse.siggen.set_taskdata(self.rqdata.hashes, self.rqdata.hash_deps)
|
||||
|
||||
for h in self.rqdata.hashes:
|
||||
bb.data.setVar("BBHASH_%s" % h, self.rqdata.hashes[h], the_data)
|
||||
for h in self.rqdata.hash_deps:
|
||||
bb.data.setVar("BBHASHDEPS_%s" % h, self.rqdata.hash_deps[h], the_data)
|
||||
|
||||
bb.data.setVar("BB_TASKHASH", self.rqdata.runq_hash[task], the_data)
|
||||
|
||||
ret = 0
|
||||
try:
|
||||
the_data = bb.cache.Cache.loadDataFull(fn, self.cooker.get_file_appends(fn), self.cooker.configuration.data)
|
||||
the_data.setVar('BB_TASKHASH', self.rqdata.runq_hash[task])
|
||||
for h in self.rqdata.hashes:
|
||||
the_data.setVar("BBHASH_%s" % h, self.rqdata.hashes[h])
|
||||
for h in self.rqdata.hash_deps:
|
||||
the_data.setVar("BBHASHDEPS_%s" % h, self.rqdata.hash_deps[h])
|
||||
|
||||
# exported_vars() returns a generator which *cannot* be passed to os.environ.update()
|
||||
# successfully. We also need to unset anything from the environment which shouldn't be there
|
||||
exports = bb.data.exported_vars(the_data)
|
||||
bb.utils.empty_environment()
|
||||
for e, v in exports:
|
||||
os.environ[e] = v
|
||||
for e in fakeenv:
|
||||
os.environ[e] = fakeenv[e]
|
||||
the_data.setVar(e, fakeenv[e])
|
||||
|
||||
if quieterrors:
|
||||
the_data.setVarFlag(taskname, "quieterrors", "1")
|
||||
|
||||
except Exception as exc:
|
||||
if not quieterrors:
|
||||
logger.critical(str(exc))
|
||||
os._exit(1)
|
||||
try:
|
||||
if not self.cooker.configuration.dry_run:
|
||||
ret = bb.build.exec_task(fn, taskname, the_data)
|
||||
os._exit(ret)
|
||||
except:
|
||||
os._exit(1)
|
||||
else:
|
||||
for key, value in envbackup.iteritems():
|
||||
if value is None:
|
||||
del os.environ[key]
|
||||
else:
|
||||
os.environ[key] = value
|
||||
|
||||
for e in env:
|
||||
os.unsetenv(e)
|
||||
for e in envbackup:
|
||||
if e in env:
|
||||
os.putenv(e, envbackup[e])
|
||||
|
||||
return pid, pipein, pipeout
|
||||
|
||||
@@ -1210,33 +1185,33 @@ class RunQueueExecuteTasks(RunQueueExecute):
|
||||
if task in self.rq.scenequeue_covered:
|
||||
continue
|
||||
if len(self.rqdata.runq_revdeps[task]) > 0 and self.rqdata.runq_revdeps[task].issubset(self.rq.scenequeue_covered):
|
||||
ok = True
|
||||
for revdep in self.rqdata.runq_revdeps[task]:
|
||||
if self.rqdata.runq_fnid[task] != self.rqdata.runq_fnid[revdep]:
|
||||
ok = False
|
||||
break
|
||||
if ok:
|
||||
found = True
|
||||
self.rq.scenequeue_covered.add(task)
|
||||
self.rq.scenequeue_covered.add(task)
|
||||
found = True
|
||||
|
||||
logger.debug(1, 'Skip list (pre setsceneverify) %s', sorted(self.rq.scenequeue_covered))
|
||||
|
||||
# Allow the metadata to elect for setscene tasks to run anyway
|
||||
# Detect when the real task needs to be run anyway by looking to see
|
||||
# if any of its dependencies within the same package are scheduled
|
||||
# to be run.
|
||||
covered_remove = set()
|
||||
if self.rq.setsceneverify:
|
||||
call = self.rq.setsceneverify + "(covered, tasknames, fnids, fns, d)"
|
||||
locs = { "covered" : self.rq.scenequeue_covered, "tasknames" : self.rqdata.runq_task, "fnids" : self.rqdata.runq_fnid, "fns" : self.rqdata.taskData.fn_index, "d" : self.cooker.configuration.data }
|
||||
covered_remove = bb.utils.better_eval(call, locs)
|
||||
for task in self.rq.scenequeue_covered:
|
||||
task_fnid = self.rqdata.runq_fnid[task]
|
||||
for dep in self.rqdata.runq_depends[task]:
|
||||
if self.rqdata.runq_fnid[dep] == task_fnid:
|
||||
if dep not in self.rq.scenequeue_covered:
|
||||
covered_remove.add(task)
|
||||
break
|
||||
|
||||
for task in covered_remove:
|
||||
fn = self.rqdata.taskData.fn_index[self.rqdata.runq_fnid[task]]
|
||||
taskname = self.rqdata.runq_task[task] + '_setscene'
|
||||
bb.build.del_stamp(taskname, self.rqdata.dataCache, fn)
|
||||
logger.debug(1, 'Not skipping task %s due to setsceneverify', task)
|
||||
logger.debug(1, 'Not skipping task %s because it will have to be run anyway', task)
|
||||
self.rq.scenequeue_covered.remove(task)
|
||||
|
||||
logger.debug(1, 'Full skip list %s', self.rq.scenequeue_covered)
|
||||
|
||||
for task in self.rq.scenequeue_covered:
|
||||
self.task_skip(task)
|
||||
|
||||
event.fire(bb.event.StampUpdate(self.rqdata.target_pairs, self.rqdata.dataCache.stamp), self.cfgData)
|
||||
|
||||
schedulers = self.get_schedulers()
|
||||
@@ -1255,7 +1230,7 @@ class RunQueueExecuteTasks(RunQueueExecute):
|
||||
if type(obj) is type and
|
||||
issubclass(obj, RunQueueScheduler))
|
||||
|
||||
user_schedulers = self.cfgData.getVar("BB_SCHEDULERS", True)
|
||||
user_schedulers = bb.data.getVar("BB_SCHEDULERS", self.cfgData, True)
|
||||
if user_schedulers:
|
||||
for sched in user_schedulers.split():
|
||||
if not "." in sched:
|
||||
@@ -1265,7 +1240,7 @@ class RunQueueExecuteTasks(RunQueueExecute):
|
||||
modname, name = sched.rsplit(".", 1)
|
||||
try:
|
||||
module = __import__(modname, fromlist=(name,))
|
||||
except ImportError as exc:
|
||||
except ImportError, exc:
|
||||
logger.critical("Unable to import scheduler '%s' from '%s': %s" % (name, modname, exc))
|
||||
raise SystemExit(1)
|
||||
else:
|
||||
@@ -1330,14 +1305,8 @@ class RunQueueExecuteTasks(RunQueueExecute):
|
||||
task = self.sched.next()
|
||||
if task is not None:
|
||||
fn = self.rqdata.taskData.fn_index[self.rqdata.runq_fnid[task]]
|
||||
|
||||
taskname = self.rqdata.runq_task[task]
|
||||
|
||||
if task in self.rq.scenequeue_covered:
|
||||
logger.debug(2, "Setscene covered task %s (%s)", task,
|
||||
self.rqdata.get_user_idstring(task))
|
||||
self.task_skip(task)
|
||||
return True
|
||||
|
||||
if self.rq.check_stamp_task(task, taskname):
|
||||
logger.debug(2, "Stamp current task %s (%s)", task,
|
||||
self.rqdata.get_user_idstring(task))
|
||||
@@ -1362,7 +1331,6 @@ class RunQueueExecuteTasks(RunQueueExecute):
|
||||
|
||||
self.build_pids[pid] = task
|
||||
self.build_pipes[pid] = runQueuePipe(pipein, pipeout, self.cfgData)
|
||||
self.build_stamps[pid] = bb.build.stampfile(taskname, self.rqdata.dataCache, fn)
|
||||
self.runq_running[task] = 1
|
||||
self.stats.taskActive()
|
||||
if self.stats.active < self.number_tasks:
|
||||
@@ -1459,7 +1427,7 @@ class RunQueueExecuteScenequeue(RunQueueExecute):
|
||||
deps.add(self.rqdata.runq_setscene.index(dep))
|
||||
sq_revdeps_squash.append(deps)
|
||||
elif len(sq_revdeps_new[task]) != 0:
|
||||
bb.msg.fatal("RunQueue", "Something went badly wrong during scenequeue generation, aborting. Please report this problem.")
|
||||
bb.msg.fatal(bb.msg.domain.RunQueue, "Something went badly wrong during scenequeue generation, aborting. Please report this problem.")
|
||||
|
||||
#for task in xrange(len(sq_revdeps_squash)):
|
||||
# print "Task %s: %s.%s is %s " % (task, self.taskData.fn_index[self.runq_fnid[self.runq_setscene[task]]], self.runq_task[self.runq_setscene[task]] + "_setscene", sq_revdeps_squash[task])
|
||||
@@ -1485,25 +1453,16 @@ class RunQueueExecuteScenequeue(RunQueueExecute):
|
||||
sq_taskname = []
|
||||
sq_task = []
|
||||
noexec = []
|
||||
stamppresent = []
|
||||
for task in xrange(len(self.sq_revdeps)):
|
||||
realtask = self.rqdata.runq_setscene[task]
|
||||
fn = self.rqdata.taskData.fn_index[self.rqdata.runq_fnid[realtask]]
|
||||
taskname = self.rqdata.runq_task[realtask]
|
||||
taskdep = self.rqdata.dataCache.task_deps[fn]
|
||||
|
||||
if 'noexec' in taskdep and taskname in taskdep['noexec']:
|
||||
noexec.append(task)
|
||||
self.task_skip(task)
|
||||
bb.build.make_stamp(taskname + "_setscene", self.rqdata.dataCache, fn)
|
||||
continue
|
||||
|
||||
if self.rq.check_stamp_task(realtask, taskname + "_setscene"):
|
||||
logger.debug(2, 'Setscene stamp current for task %s(%s)', task, self.rqdata.get_user_idstring(realtask))
|
||||
stamppresent.append(task)
|
||||
self.task_skip(task)
|
||||
continue
|
||||
|
||||
sq_fn.append(fn)
|
||||
sq_hashfn.append(self.rqdata.dataCache.hashfn[fn])
|
||||
sq_hash.append(self.rqdata.runq_hash[realtask])
|
||||
@@ -1513,15 +1472,14 @@ class RunQueueExecuteScenequeue(RunQueueExecute):
|
||||
locs = { "sq_fn" : sq_fn, "sq_task" : sq_taskname, "sq_hash" : sq_hash, "sq_hashfn" : sq_hashfn, "d" : self.cooker.configuration.data }
|
||||
valid = bb.utils.better_eval(call, locs)
|
||||
|
||||
valid_new = stamppresent
|
||||
valid_new = []
|
||||
for v in valid:
|
||||
valid_new.append(sq_task[v])
|
||||
|
||||
for task in xrange(len(self.sq_revdeps)):
|
||||
if task not in valid_new and task not in noexec:
|
||||
realtask = self.rqdata.runq_setscene[task]
|
||||
logger.debug(2, 'No package found, so skipping setscene task %s',
|
||||
self.rqdata.get_user_idstring(realtask))
|
||||
self.rqdata.get_user_idstring(task))
|
||||
self.task_failoutright(task)
|
||||
|
||||
logger.info('Executing SetScene Tasks')
|
||||
@@ -1594,7 +1552,7 @@ class RunQueueExecuteScenequeue(RunQueueExecute):
|
||||
taskname = self.rqdata.runq_task[realtask] + "_setscene"
|
||||
if self.rq.check_stamp_task(realtask, self.rqdata.runq_task[realtask]):
|
||||
logger.debug(2, 'Stamp for underlying task %s(%s) is current, so skipping setscene variant',
|
||||
task, self.rqdata.get_user_idstring(realtask))
|
||||
task, self.rqdata.get_user_idstring(task))
|
||||
self.task_failoutright(task)
|
||||
return True
|
||||
|
||||
@@ -1636,7 +1594,7 @@ class RunQueueExecuteScenequeue(RunQueueExecute):
|
||||
for task in oldcovered:
|
||||
self.rq.scenequeue_covered.add(self.rqdata.runq_setscene[task])
|
||||
|
||||
logger.debug(1, 'We can skip tasks %s', sorted(self.rq.scenequeue_covered))
|
||||
logger.debug(1, 'We can skip tasks %s', self.rq.scenequeue_covered)
|
||||
|
||||
self.rq.state = runQueueRunInit
|
||||
return True
|
||||
@@ -1702,8 +1660,8 @@ class runQueueTaskCompleted(runQueueEvent):
|
||||
"""
|
||||
|
||||
def check_stamp_fn(fn, taskname, d):
|
||||
rqexe = d.getVar("__RUNQUEUE_DO_NOT_USE_EXTERNALLY")
|
||||
fn = d.getVar("__RUNQUEUE_DO_NOT_USE_EXTERNALLY2")
|
||||
rqexe = bb.data.getVar("__RUNQUEUE_DO_NOT_USE_EXTERNALLY", d)
|
||||
fn = bb.data.getVar("__RUNQUEUE_DO_NOT_USE_EXTERNALLY2", d)
|
||||
fnid = rqexe.rqdata.taskData.getfn_id(fn)
|
||||
taskid = rqexe.rqdata.get_task_id(fnid, taskname)
|
||||
if taskid is not None:
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
|
||||
import time
|
||||
import bb
|
||||
import pickle
|
||||
import signal
|
||||
|
||||
DEBUG = False
|
||||
@@ -35,7 +36,8 @@ DEBUG = False
|
||||
import inspect, select
|
||||
|
||||
class BitBakeServerCommands():
|
||||
def __init__(self, server):
|
||||
def __init__(self, server, cooker):
|
||||
self.cooker = cooker
|
||||
self.server = server
|
||||
|
||||
def runCommand(self, command):
|
||||
@@ -67,7 +69,7 @@ class BBUIEventQueue:
|
||||
self.parent = parent
|
||||
@staticmethod
|
||||
def send(event):
|
||||
bb.server.none.eventQueue.append(event)
|
||||
bb.server.none.eventQueue.append(pickle.loads(event))
|
||||
@staticmethod
|
||||
def quit():
|
||||
return
|
||||
@@ -104,17 +106,13 @@ class BBUIEventQueue:
|
||||
def chldhandler(signum, stackframe):
|
||||
pass
|
||||
|
||||
class BitBakeNoneServer():
|
||||
class BitBakeServer():
|
||||
# remove this when you're done with debugging
|
||||
# allow_reuse_address = True
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self, cooker):
|
||||
self._idlefuns = {}
|
||||
self.commands = BitBakeServerCommands(self)
|
||||
|
||||
def addcooker(self, cooker):
|
||||
self.cooker = cooker
|
||||
self.commands.cooker = cooker
|
||||
self.commands = BitBakeServerCommands(self, cooker)
|
||||
|
||||
def register_idle_function(self, function, data):
|
||||
"""Register a function to be called while the server is idle"""
|
||||
@@ -159,10 +157,25 @@ class BitBakeNoneServer():
|
||||
except:
|
||||
pass
|
||||
|
||||
class BitBakeServerConnection():
|
||||
class BitbakeServerInfo():
|
||||
def __init__(self, server):
|
||||
self.server = server.server
|
||||
self.connection = self.server.commands
|
||||
self.server = server
|
||||
self.commands = server.commands
|
||||
|
||||
class BitBakeServerFork():
|
||||
def __init__(self, cooker, server, serverinfo, logfile):
|
||||
serverinfo.logfile = logfile
|
||||
serverinfo.cooker = cooker
|
||||
serverinfo.server = server
|
||||
|
||||
class BitbakeUILauch():
|
||||
def launch(self, serverinfo, uifunc, *args):
|
||||
return bb.cooker.server_main(serverinfo.cooker, uifunc, *args)
|
||||
|
||||
class BitBakeServerConnection():
|
||||
def __init__(self, serverinfo):
|
||||
self.server = serverinfo.server
|
||||
self.connection = serverinfo.commands
|
||||
self.events = bb.server.none.BBUIEventQueue(self.server)
|
||||
for event in bb.event.ui_queue:
|
||||
self.events.queue_event(event)
|
||||
@@ -176,28 +189,3 @@ class BitBakeServerConnection():
|
||||
self.connection.terminateServer()
|
||||
except:
|
||||
pass
|
||||
|
||||
class BitBakeServer(object):
|
||||
def initServer(self):
|
||||
self.server = BitBakeNoneServer()
|
||||
|
||||
def addcooker(self, cooker):
|
||||
self.cooker = cooker
|
||||
self.server.addcooker(cooker)
|
||||
|
||||
def getServerIdleCB(self):
|
||||
return self.server.register_idle_function
|
||||
|
||||
def saveConnectionDetails(self):
|
||||
return
|
||||
|
||||
def detach(self, cooker_logfile):
|
||||
self.logfile = cooker_logfile
|
||||
|
||||
def establishConnection(self):
|
||||
self.connection = BitBakeServerConnection(self)
|
||||
return self.connection
|
||||
|
||||
def launchUI(self, uifunc, *args):
|
||||
return bb.cooker.server_main(self.cooker, uifunc, *args)
|
||||
|
||||
|
||||
@@ -1,270 +0,0 @@
|
||||
#
|
||||
# BitBake Process based server.
|
||||
#
|
||||
# Copyright (C) 2010 Bob Foerster <robert@erafx.com>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License version 2 as
|
||||
# published by the Free Software Foundation.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along
|
||||
# with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
"""
|
||||
This module implements a multiprocessing.Process based server for bitbake.
|
||||
"""
|
||||
|
||||
import bb
|
||||
import bb.event
|
||||
import itertools
|
||||
import logging
|
||||
import multiprocessing
|
||||
import os
|
||||
import signal
|
||||
import sys
|
||||
import time
|
||||
from Queue import Empty
|
||||
from multiprocessing import Event, Process, util, Queue, Pipe, queues
|
||||
|
||||
logger = logging.getLogger('BitBake')
|
||||
|
||||
class ServerCommunicator():
|
||||
def __init__(self, connection):
|
||||
self.connection = connection
|
||||
|
||||
def runCommand(self, command):
|
||||
# @todo try/except
|
||||
self.connection.send(command)
|
||||
|
||||
while True:
|
||||
# don't let the user ctrl-c while we're waiting for a response
|
||||
try:
|
||||
if self.connection.poll(.5):
|
||||
return self.connection.recv()
|
||||
else:
|
||||
return None
|
||||
except KeyboardInterrupt:
|
||||
pass
|
||||
|
||||
|
||||
class EventAdapter():
|
||||
"""
|
||||
Adapter to wrap our event queue since the caller (bb.event) expects to
|
||||
call a send() method, but our actual queue only has put()
|
||||
"""
|
||||
def __init__(self, queue):
|
||||
self.queue = queue
|
||||
|
||||
def send(self, event):
|
||||
try:
|
||||
self.queue.put(event)
|
||||
except Exception as err:
|
||||
print("EventAdapter puked: %s" % str(err))
|
||||
|
||||
|
||||
class ProcessServer(Process):
|
||||
profile_filename = "profile.log"
|
||||
profile_processed_filename = "profile.log.processed"
|
||||
|
||||
def __init__(self, command_channel, event_queue):
|
||||
Process.__init__(self)
|
||||
self.command_channel = command_channel
|
||||
self.event_queue = event_queue
|
||||
self.event = EventAdapter(event_queue)
|
||||
self._idlefunctions = {}
|
||||
self.quit = False
|
||||
|
||||
self.keep_running = Event()
|
||||
self.keep_running.set()
|
||||
|
||||
def register_idle_function(self, function, data):
|
||||
"""Register a function to be called while the server is idle"""
|
||||
assert hasattr(function, '__call__')
|
||||
self._idlefunctions[function] = data
|
||||
|
||||
def run(self):
|
||||
for event in bb.event.ui_queue:
|
||||
self.event_queue.put(event)
|
||||
self.event_handle = bb.event.register_UIHhandler(self)
|
||||
bb.cooker.server_main(self.cooker, self.main)
|
||||
|
||||
def main(self):
|
||||
# Ignore SIGINT within the server, as all SIGINT handling is done by
|
||||
# the UI and communicated to us
|
||||
signal.signal(signal.SIGINT, signal.SIG_IGN)
|
||||
while self.keep_running.is_set():
|
||||
try:
|
||||
if self.command_channel.poll():
|
||||
command = self.command_channel.recv()
|
||||
self.runCommand(command)
|
||||
|
||||
self.idle_commands(.1)
|
||||
except Exception:
|
||||
logger.exception('Running command %s', command)
|
||||
|
||||
self.event_queue.cancel_join_thread()
|
||||
bb.event.unregister_UIHhandler(self.event_handle)
|
||||
self.command_channel.close()
|
||||
self.cooker.stop()
|
||||
self.idle_commands(.1)
|
||||
|
||||
def idle_commands(self, delay):
|
||||
nextsleep = delay
|
||||
|
||||
for function, data in self._idlefunctions.items():
|
||||
try:
|
||||
retval = function(self, data, False)
|
||||
if retval is False:
|
||||
del self._idlefunctions[function]
|
||||
elif retval is True:
|
||||
nextsleep = None
|
||||
elif nextsleep is None:
|
||||
continue
|
||||
elif retval < nextsleep:
|
||||
nextsleep = retval
|
||||
except SystemExit:
|
||||
raise
|
||||
except Exception:
|
||||
logger.exception('Running idle function')
|
||||
|
||||
if nextsleep is not None:
|
||||
time.sleep(nextsleep)
|
||||
|
||||
def runCommand(self, command):
|
||||
"""
|
||||
Run a cooker command on the server
|
||||
"""
|
||||
self.command_channel.send(self.cooker.command.runCommand(command))
|
||||
|
||||
def stop(self):
|
||||
self.keep_running.clear()
|
||||
|
||||
def bootstrap_2_6_6(self):
|
||||
"""Pulled from python 2.6.6. Needed to ensure we have the fix from
|
||||
http://bugs.python.org/issue5313 when running on python version 2.6.2
|
||||
or lower."""
|
||||
|
||||
try:
|
||||
self._children = set()
|
||||
self._counter = itertools.count(1)
|
||||
try:
|
||||
sys.stdin.close()
|
||||
sys.stdin = open(os.devnull)
|
||||
except (OSError, ValueError):
|
||||
pass
|
||||
multiprocessing._current_process = self
|
||||
util._finalizer_registry.clear()
|
||||
util._run_after_forkers()
|
||||
util.info('child process calling self.run()')
|
||||
try:
|
||||
self.run()
|
||||
exitcode = 0
|
||||
finally:
|
||||
util._exit_function()
|
||||
except SystemExit as e:
|
||||
if not e.args:
|
||||
exitcode = 1
|
||||
elif type(e.args[0]) is int:
|
||||
exitcode = e.args[0]
|
||||
else:
|
||||
sys.stderr.write(e.args[0] + '\n')
|
||||
sys.stderr.flush()
|
||||
exitcode = 1
|
||||
except:
|
||||
exitcode = 1
|
||||
import traceback
|
||||
sys.stderr.write('Process %s:\n' % self.name)
|
||||
sys.stderr.flush()
|
||||
traceback.print_exc()
|
||||
|
||||
util.info('process exiting with exitcode %d' % exitcode)
|
||||
return exitcode
|
||||
|
||||
# Python versions 2.6.0 through 2.6.2 suffer from a multiprocessing bug
|
||||
# which can result in a bitbake server hang during the parsing process
|
||||
if (2, 6, 0) <= sys.version_info < (2, 6, 3):
|
||||
_bootstrap = bootstrap_2_6_6
|
||||
|
||||
class BitBakeServerConnection():
|
||||
def __init__(self, server):
|
||||
self.server = server
|
||||
self.procserver = server.server
|
||||
self.connection = ServerCommunicator(server.ui_channel)
|
||||
self.events = server.event_queue
|
||||
|
||||
def terminate(self, force = False):
|
||||
signal.signal(signal.SIGINT, signal.SIG_IGN)
|
||||
self.procserver.stop()
|
||||
if force:
|
||||
self.procserver.join(0.5)
|
||||
if self.procserver.is_alive():
|
||||
self.procserver.terminate()
|
||||
self.procserver.join()
|
||||
else:
|
||||
self.procserver.join()
|
||||
while True:
|
||||
try:
|
||||
event = self.server.event_queue.get(block=False)
|
||||
except (Empty, IOError):
|
||||
break
|
||||
if isinstance(event, logging.LogRecord):
|
||||
logger.handle(event)
|
||||
self.server.ui_channel.close()
|
||||
self.server.event_queue.close()
|
||||
if force:
|
||||
sys.exit(1)
|
||||
|
||||
# Wrap Queue to provide API which isn't server implementation specific
|
||||
class ProcessEventQueue(multiprocessing.queues.Queue):
|
||||
def waitEvent(self, timeout):
|
||||
try:
|
||||
return self.get(True, timeout)
|
||||
except Empty:
|
||||
return None
|
||||
|
||||
def getEvent(self):
|
||||
try:
|
||||
return self.get(False)
|
||||
except Empty:
|
||||
return None
|
||||
|
||||
|
||||
class BitBakeServer(object):
|
||||
def initServer(self):
|
||||
# establish communication channels. We use bidirectional pipes for
|
||||
# ui <--> server command/response pairs
|
||||
# and a queue for server -> ui event notifications
|
||||
#
|
||||
self.ui_channel, self.server_channel = Pipe()
|
||||
self.event_queue = ProcessEventQueue(0)
|
||||
|
||||
self.server = ProcessServer(self.server_channel, self.event_queue)
|
||||
|
||||
def addcooker(self, cooker):
|
||||
self.cooker = cooker
|
||||
self.server.cooker = cooker
|
||||
|
||||
def getServerIdleCB(self):
|
||||
return self.server.register_idle_function
|
||||
|
||||
def saveConnectionDetails(self):
|
||||
return
|
||||
|
||||
def detach(self, cooker_logfile):
|
||||
self.server.start()
|
||||
return
|
||||
|
||||
def establishConnection(self):
|
||||
self.connection = BitBakeServerConnection(self)
|
||||
signal.signal(signal.SIGTERM, lambda i, s: self.connection.terminate(force=True))
|
||||
return self.connection
|
||||
|
||||
def launchUI(self, uifunc, *args):
|
||||
return bb.cooker.server_main(self.cooker, uifunc, *args)
|
||||
|
||||
@@ -122,7 +122,8 @@ def _create_server(host, port):
|
||||
return s
|
||||
|
||||
class BitBakeServerCommands():
|
||||
def __init__(self, server):
|
||||
def __init__(self, server, cooker):
|
||||
self.cooker = cooker
|
||||
self.server = server
|
||||
|
||||
def registerEventHandler(self, host, port):
|
||||
@@ -150,7 +151,7 @@ class BitBakeServerCommands():
|
||||
Trigger the server to quit
|
||||
"""
|
||||
self.server.quit = True
|
||||
print("Server (cooker) exiting")
|
||||
print("Server (cooker) exitting")
|
||||
return
|
||||
|
||||
def ping(self):
|
||||
@@ -159,11 +160,11 @@ class BitBakeServerCommands():
|
||||
"""
|
||||
return True
|
||||
|
||||
class BitBakeXMLRPCServer(SimpleXMLRPCServer):
|
||||
class BitBakeServer(SimpleXMLRPCServer):
|
||||
# remove this when you're done with debugging
|
||||
# allow_reuse_address = True
|
||||
|
||||
def __init__(self, interface = ("localhost", 0)):
|
||||
def __init__(self, cooker, interface = ("localhost", 0)):
|
||||
"""
|
||||
Constructor
|
||||
"""
|
||||
@@ -173,12 +174,9 @@ class BitBakeXMLRPCServer(SimpleXMLRPCServer):
|
||||
self._idlefuns = {}
|
||||
self.host, self.port = self.socket.getsockname()
|
||||
#self.register_introspection_functions()
|
||||
self.commands = BitBakeServerCommands(self)
|
||||
self.autoregister_all_functions(self.commands, "")
|
||||
|
||||
def addcooker(self, cooker):
|
||||
commands = BitBakeServerCommands(self, cooker)
|
||||
self.autoregister_all_functions(commands, "")
|
||||
self.cooker = cooker
|
||||
self.commands.cooker = cooker
|
||||
|
||||
def autoregister_all_functions(self, context, prefix):
|
||||
"""
|
||||
@@ -246,6 +244,14 @@ class BitbakeServerInfo():
|
||||
self.host = server.host
|
||||
self.port = server.port
|
||||
|
||||
class BitBakeServerFork():
|
||||
def __init__(self, cooker, server, serverinfo, logfile):
|
||||
daemonize.createDaemon(server.serve_forever, logfile)
|
||||
|
||||
class BitbakeUILauch():
|
||||
def launch(self, serverinfo, uifunc, *args):
|
||||
return uifunc(*args)
|
||||
|
||||
class BitBakeServerConnection():
|
||||
def __init__(self, serverinfo):
|
||||
self.connection = _create_server(serverinfo.host, serverinfo.port)
|
||||
@@ -265,31 +271,3 @@ class BitBakeServerConnection():
|
||||
self.connection.terminateServer()
|
||||
except:
|
||||
pass
|
||||
|
||||
class BitBakeServer(object):
|
||||
def initServer(self):
|
||||
self.server = BitBakeXMLRPCServer()
|
||||
|
||||
def addcooker(self, cooker):
|
||||
self.cooker = cooker
|
||||
self.server.addcooker(cooker)
|
||||
|
||||
def getServerIdleCB(self):
|
||||
return self.server.register_idle_function
|
||||
|
||||
def saveConnectionDetails(self):
|
||||
self.serverinfo = BitbakeServerInfo(self.server)
|
||||
|
||||
def detach(self, cooker_logfile):
|
||||
daemonize.createDaemon(self.server.serve_forever, cooker_logfile)
|
||||
del self.cooker
|
||||
del self.server
|
||||
|
||||
def establishConnection(self):
|
||||
self.connection = BitBakeServerConnection(self.serverinfo)
|
||||
return self.connection
|
||||
|
||||
def launchUI(self, uifunc, *args):
|
||||
return uifunc(*args)
|
||||
|
||||
|
||||
|
||||
@@ -407,7 +407,7 @@ SRC_URI = ""
|
||||
|
||||
def parse( self, params ):
|
||||
"""(Re-)parse .bb files and calculate the dependency graph"""
|
||||
cooker.status = cache.CacheData(cooker.caches_array)
|
||||
cooker.status = cache.CacheData()
|
||||
ignore = data.getVar("ASSUME_PROVIDED", cooker.configuration.data, 1) or ""
|
||||
cooker.status.ignored_dependencies = set( ignore.split() )
|
||||
cooker.handleCollections( data.getVar("BBFILE_COLLECTIONS", cooker.configuration.data, 1) )
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import hashlib
|
||||
import logging
|
||||
import os
|
||||
import re
|
||||
import bb.data
|
||||
|
||||
@@ -16,7 +15,7 @@ def init(d):
|
||||
siggens = [obj for obj in globals().itervalues()
|
||||
if type(obj) is type and issubclass(obj, SignatureGenerator)]
|
||||
|
||||
desired = d.getVar("BB_SIGNATURE_HANDLER", True) or "noop"
|
||||
desired = bb.data.getVar("BB_SIGNATURE_HANDLER", d, True) or "noop"
|
||||
for sg in siggens:
|
||||
if desired == sg.name:
|
||||
return sg(d)
|
||||
@@ -39,7 +38,7 @@ class SignatureGenerator(object):
|
||||
return
|
||||
|
||||
def get_taskhash(self, fn, task, deps, dataCache):
|
||||
return "0"
|
||||
return 0
|
||||
|
||||
def set_taskdata(self, hashes, deps):
|
||||
return
|
||||
@@ -47,9 +46,6 @@ class SignatureGenerator(object):
|
||||
def stampfile(self, stampbase, file_name, taskname, extrainfo):
|
||||
return ("%s.%s.%s" % (stampbase, taskname, extrainfo)).rstrip('.')
|
||||
|
||||
def dump_sigtask(self, fn, task, stampbase, runtime):
|
||||
return
|
||||
|
||||
class SignatureGeneratorBasic(SignatureGenerator):
|
||||
"""
|
||||
"""
|
||||
@@ -72,19 +68,16 @@ class SignatureGeneratorBasic(SignatureGenerator):
|
||||
|
||||
def _build_data(self, fn, d):
|
||||
|
||||
tasklist, gendeps, lookupcache = bb.data.generate_dependencies(d)
|
||||
tasklist, gendeps = bb.data.generate_dependencies(d)
|
||||
|
||||
taskdeps = {}
|
||||
basehash = {}
|
||||
lookupcache = {}
|
||||
|
||||
for task in tasklist:
|
||||
data = d.getVar(task, False)
|
||||
lookupcache[task] = data
|
||||
|
||||
if data is None:
|
||||
bb.error("Task %s from %s seems to be empty?!" % (task, fn))
|
||||
data = ''
|
||||
|
||||
newdeps = gendeps[task]
|
||||
seen = set()
|
||||
while newdeps:
|
||||
@@ -100,14 +93,15 @@ class SignatureGeneratorBasic(SignatureGenerator):
|
||||
alldeps = seen - self.basewhitelist
|
||||
|
||||
for dep in sorted(alldeps):
|
||||
data = data + dep
|
||||
if dep in lookupcache:
|
||||
var = lookupcache[dep]
|
||||
else:
|
||||
var = d.getVar(dep, False)
|
||||
lookupcache[dep] = var
|
||||
if var:
|
||||
data = data + str(var)
|
||||
data = data + var
|
||||
if data is None:
|
||||
bb.error("Task %s from %s seems to be empty?!" % (task, fn))
|
||||
self.basehash[fn + "." + task] = hashlib.md5(data).hexdigest()
|
||||
taskdeps[task] = sorted(alldeps)
|
||||
|
||||
@@ -135,7 +129,7 @@ class SignatureGeneratorBasic(SignatureGenerator):
|
||||
k = fn + "." + task
|
||||
data = dataCache.basetaskhash[k]
|
||||
self.runtaskdeps[k] = []
|
||||
for dep in sorted(deps, key=clean_basepath):
|
||||
for dep in sorted(deps):
|
||||
# We only manipulate the dependencies for packages not in the whitelist
|
||||
if self.twl and not self.twl.search(dataCache.pkg_fn[fn]):
|
||||
# then process the actual dependencies
|
||||
@@ -159,7 +153,7 @@ class SignatureGeneratorBasic(SignatureGenerator):
|
||||
k = fn + "." + task
|
||||
if runtime == "customfile":
|
||||
sigfile = stampbase
|
||||
elif runtime and k in self.taskhash:
|
||||
elif runtime:
|
||||
sigfile = stampbase + "." + task + ".sigdata" + "." + self.taskhash[k]
|
||||
else:
|
||||
sigfile = stampbase + "." + task + ".sigbasedata" + "." + self.basehash[k]
|
||||
@@ -180,7 +174,7 @@ class SignatureGeneratorBasic(SignatureGenerator):
|
||||
data['gendeps'][dep] = self.gendeps[fn][dep]
|
||||
data['varvals'][dep] = self.lookupcache[fn][dep]
|
||||
|
||||
if runtime and k in self.taskhash:
|
||||
if runtime:
|
||||
data['runtaskdeps'] = self.runtaskdeps[k]
|
||||
data['runtaskhashes'] = {}
|
||||
for dep in data['runtaskdeps']:
|
||||
@@ -217,32 +211,19 @@ def dump_this_task(outfile, d):
|
||||
task = "do_" + d.getVar("BB_CURRENTTASK", True)
|
||||
bb.parse.siggen.dump_sigtask(fn, task, outfile, "customfile")
|
||||
|
||||
def clean_basepath(a):
|
||||
if a.startswith("virtual:"):
|
||||
b = a.rsplit(":", 1)[0] + a.rsplit("/", 1)[1]
|
||||
else:
|
||||
b = a.rsplit("/", 1)[1]
|
||||
return b
|
||||
|
||||
def clean_basepaths(a):
|
||||
b = {}
|
||||
for x in a:
|
||||
b[clean_basepath(x)] = a[x]
|
||||
return b
|
||||
|
||||
def compare_sigfiles(a, b):
|
||||
p1 = pickle.Unpickler(file(a, "rb"))
|
||||
a_data = p1.load()
|
||||
p2 = pickle.Unpickler(file(b, "rb"))
|
||||
b_data = p2.load()
|
||||
|
||||
def dict_diff(a, b, whitelist=set()):
|
||||
def dict_diff(a, b):
|
||||
sa = set(a.keys())
|
||||
sb = set(b.keys())
|
||||
common = sa & sb
|
||||
changed = set()
|
||||
for i in common:
|
||||
if a[i] != b[i] and i not in whitelist:
|
||||
if a[i] != b[i]:
|
||||
changed.add(i)
|
||||
added = sa - sb
|
||||
removed = sb - sa
|
||||
@@ -250,23 +231,20 @@ def compare_sigfiles(a, b):
|
||||
|
||||
if 'basewhitelist' in a_data and a_data['basewhitelist'] != b_data['basewhitelist']:
|
||||
print "basewhitelist changed from %s to %s" % (a_data['basewhitelist'], b_data['basewhitelist'])
|
||||
print "changed items: %s" % a_data['basewhitelist'].symmetric_difference(b_data['basewhitelist'])
|
||||
|
||||
if 'taskwhitelist' in a_data and a_data['taskwhitelist'] != b_data['taskwhitelist']:
|
||||
print "taskwhitelist changed from %s to %s" % (a_data['taskwhitelist'], b_data['taskwhitelist'])
|
||||
print "changed items: %s" % a_data['taskwhitelist'].symmetric_difference(b_data['taskwhitelist'])
|
||||
|
||||
if a_data['taskdeps'] != b_data['taskdeps']:
|
||||
print "Task dependencies changed from:\n%s\nto:\n%s" % (sorted(a_data['taskdeps']), sorted(b_data['taskdeps']))
|
||||
print "Task dependencies changed from %s to %s" % (sorted(a_data['taskdeps']), sorted(b_data['taskdeps']))
|
||||
|
||||
if a_data['basehash'] != b_data['basehash']:
|
||||
print "basehash changed from %s to %s" % (a_data['basehash'], b_data['basehash'])
|
||||
|
||||
changed, added, removed = dict_diff(a_data['gendeps'], b_data['gendeps'], a_data['basewhitelist'] & b_data['basewhitelist'])
|
||||
changed, added, removed = dict_diff(a_data['gendeps'], b_data['gendeps'])
|
||||
if changed:
|
||||
for dep in changed:
|
||||
print "List of dependencies for variable %s changed from %s to %s" % (dep, a_data['gendeps'][dep], b_data['gendeps'][dep])
|
||||
print "changed items: %s" % a_data['gendeps'][dep].symmetric_difference(b_data['gendeps'][dep])
|
||||
if added:
|
||||
for dep in added:
|
||||
print "Dependency on variable %s was added" % (dep)
|
||||
@@ -281,9 +259,7 @@ def compare_sigfiles(a, b):
|
||||
print "Variable %s value changed from %s to %s" % (dep, a_data['varvals'][dep], b_data['varvals'][dep])
|
||||
|
||||
if 'runtaskhashes' in a_data and 'runtaskhashes' in b_data:
|
||||
a = clean_basepaths(a_data['runtaskhashes'])
|
||||
b = clean_basepaths(b_data['runtaskhashes'])
|
||||
changed, added, removed = dict_diff(a, b)
|
||||
changed, added, removed = dict_diff(a_data['runtaskhashes'], b_data['runtaskhashes'])
|
||||
if added:
|
||||
for dep in added:
|
||||
print "Dependency on task %s was added" % (dep)
|
||||
@@ -292,10 +268,9 @@ def compare_sigfiles(a, b):
|
||||
print "Dependency on task %s was removed" % (dep)
|
||||
if changed:
|
||||
for dep in changed:
|
||||
print "Hash for dependent task %s changed from %s to %s" % (dep, a[dep], b[dep])
|
||||
print "Hash for dependent task %s changed from %s to %s" % (dep, a_data['runtaskhashes'][dep], b_data['runtaskhashes'][dep])
|
||||
elif 'runtaskdeps' in a_data and 'runtaskdeps' in b_data and sorted(a_data['runtaskdeps']) != sorted(b_data['runtaskdeps']):
|
||||
print "Tasks this task depends on changed from %s to %s" % (sorted(a_data['runtaskdeps']), sorted(b_data['runtaskdeps']))
|
||||
print "changed items: %s" % a_data['runtaskdeps'].symmetric_difference(b_data['runtaskdeps'])
|
||||
|
||||
def dump_sigfile(a):
|
||||
p1 = pickle.Unpickler(file(a, "rb"))
|
||||
|
||||
@@ -41,7 +41,7 @@ class TaskData:
|
||||
"""
|
||||
BitBake Task Data implementation
|
||||
"""
|
||||
def __init__(self, abort = True, tryaltconfigs = False, skiplist = None):
|
||||
def __init__(self, abort = True, tryaltconfigs = False):
|
||||
self.build_names_index = []
|
||||
self.run_names_index = []
|
||||
self.fn_index = []
|
||||
@@ -70,8 +70,6 @@ class TaskData:
|
||||
self.abort = abort
|
||||
self.tryaltconfigs = tryaltconfigs
|
||||
|
||||
self.skiplist = skiplist
|
||||
|
||||
def getbuild_id(self, name):
|
||||
"""
|
||||
Return an ID number for the build target name.
|
||||
@@ -153,7 +151,7 @@ class TaskData:
|
||||
fnid = self.getfn_id(fn)
|
||||
|
||||
if fnid in self.failed_fnids:
|
||||
bb.msg.fatal("TaskData", "Trying to re-add a failed file? Something is broken...")
|
||||
bb.msg.fatal(bb.msg.domain.TaskData, "Trying to re-add a failed file? Something is broken...")
|
||||
|
||||
# Check if we've already seen this fn
|
||||
if fnid in self.tasks_fnid:
|
||||
@@ -175,7 +173,7 @@ class TaskData:
|
||||
for dep in task_deps['depends'][task].split():
|
||||
if dep:
|
||||
if ":" not in dep:
|
||||
bb.msg.fatal("TaskData", "Error for %s, dependency %s does not contain ':' character\n. Task 'depends' should be specified in the form 'packagename:task'" % (fn, dep))
|
||||
bb.msg.fatal(bb.msg.domain.TaskData, "Error, dependency %s does not contain ':' character\n. Task 'depends' should be specified in the form 'packagename:task'" % (dep, fn))
|
||||
ids.append(((self.getbuild_id(dep.split(":")[0])), dep.split(":")[1]))
|
||||
self.tasks_idepends[taskid].extend(ids)
|
||||
|
||||
@@ -350,22 +348,6 @@ class TaskData:
|
||||
dependees.append(self.fn_index[fnid])
|
||||
return dependees
|
||||
|
||||
def get_reasons(self, item, runtime=False):
|
||||
"""
|
||||
Get the reason(s) for an item not being provided, if any
|
||||
"""
|
||||
reasons = []
|
||||
if self.skiplist:
|
||||
for fn in self.skiplist:
|
||||
skipitem = self.skiplist[fn]
|
||||
if skipitem.pn == item:
|
||||
reasons.append("%s was skipped: %s" % (skipitem.pn, skipitem.skipreason))
|
||||
elif runtime and item in skipitem.rprovides:
|
||||
reasons.append("%s RPROVIDES %s but was skipped: %s" % (skipitem.pn, item, skipitem.skipreason))
|
||||
elif not runtime and item in skipitem.provides:
|
||||
reasons.append("%s PROVIDES %s but was skipped: %s" % (skipitem.pn, item, skipitem.skipreason))
|
||||
return reasons
|
||||
|
||||
def add_provider(self, cfgData, dataCache, item):
|
||||
try:
|
||||
self.add_provider_internal(cfgData, dataCache, item)
|
||||
@@ -387,7 +369,7 @@ class TaskData:
|
||||
return
|
||||
|
||||
if not item in dataCache.providers:
|
||||
bb.event.fire(bb.event.NoProvider(item, dependees=self.get_dependees_str(item), reasons=self.get_reasons(item)), cfgData)
|
||||
bb.event.fire(bb.event.NoProvider(item, dependees=self.get_rdependees_str(item)), cfgData)
|
||||
raise bb.providers.NoProvider(item)
|
||||
|
||||
if self.have_build_target(item):
|
||||
@@ -399,7 +381,7 @@ class TaskData:
|
||||
eligible = [p for p in eligible if not self.getfn_id(p) in self.failed_fnids]
|
||||
|
||||
if not eligible:
|
||||
bb.event.fire(bb.event.NoProvider(item, dependees=self.get_dependees_str(item), reasons=["No eligible PROVIDERs exist for '%s'" % item]), cfgData)
|
||||
bb.event.fire(bb.event.NoProvider(item, dependees=self.get_dependees_str(item)), cfgData)
|
||||
raise bb.providers.NoProvider(item)
|
||||
|
||||
if len(eligible) > 1 and foundUnique == False:
|
||||
@@ -436,14 +418,14 @@ class TaskData:
|
||||
all_p = bb.providers.getRuntimeProviders(dataCache, item)
|
||||
|
||||
if not all_p:
|
||||
bb.event.fire(bb.event.NoProvider(item, runtime=True, dependees=self.get_rdependees_str(item), reasons=self.get_reasons(item, True)), cfgData)
|
||||
bb.event.fire(bb.event.NoProvider(item, runtime=True, dependees=self.get_rdependees_str(item)), cfgData)
|
||||
raise bb.providers.NoRProvider(item)
|
||||
|
||||
eligible, numberPreferred = bb.providers.filterProvidersRunTime(all_p, item, cfgData, dataCache)
|
||||
eligible = [p for p in eligible if not self.getfn_id(p) in self.failed_fnids]
|
||||
|
||||
if not eligible:
|
||||
bb.event.fire(bb.event.NoProvider(item, runtime=True, dependees=self.get_rdependees_str(item), reasons=["No eligible RPROVIDERs exist for '%s'" % item]), cfgData)
|
||||
bb.event.fire(bb.event.NoProvider(item, runtime=True, dependees=self.get_rdependees_str(item)), cfgData)
|
||||
raise bb.providers.NoRProvider(item)
|
||||
|
||||
if len(eligible) > 1 and numberPreferred == 0:
|
||||
|
||||
@@ -1,346 +0,0 @@
|
||||
#
|
||||
# BitBake Graphical GTK User Interface
|
||||
#
|
||||
# Copyright (C) 2011 Intel Corporation
|
||||
#
|
||||
# Authored by Joshua Lock <josh@linux.intel.com>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License version 2 as
|
||||
# published by the Free Software Foundation.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along
|
||||
# with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
import gobject
|
||||
import copy
|
||||
import re, os
|
||||
from bb import data
|
||||
|
||||
class Configurator(gobject.GObject):
|
||||
|
||||
"""
|
||||
A GObject to handle writing modified configuration values back
|
||||
to conf files.
|
||||
"""
|
||||
__gsignals__ = {
|
||||
"layers-loaded" : (gobject.SIGNAL_RUN_LAST,
|
||||
gobject.TYPE_NONE,
|
||||
()),
|
||||
"layers-changed" : (gobject.SIGNAL_RUN_LAST,
|
||||
gobject.TYPE_NONE,
|
||||
())
|
||||
}
|
||||
|
||||
def __init__(self):
|
||||
gobject.GObject.__init__(self)
|
||||
self.bblayers = None
|
||||
self.enabled_layers = {}
|
||||
self.loaded_layers = {}
|
||||
self.config = {}
|
||||
self.orig_config = {}
|
||||
self.preconf = None
|
||||
self.postconf = None
|
||||
|
||||
# NOTE: cribbed from the cooker...
|
||||
def _parse(self, f, data, include=False):
|
||||
try:
|
||||
return bb.parse.handle(f, data, include)
|
||||
except (IOError, bb.parse.ParseError) as exc:
|
||||
parselog.critical("Unable to parse %s: %s" % (f, exc))
|
||||
sys.exit(1)
|
||||
|
||||
def _loadConf(self, path):
|
||||
def getString(var):
|
||||
return data.getVar(var, True) or ""
|
||||
|
||||
if self.orig_config:
|
||||
del self.orig_config
|
||||
self.orig_config = {}
|
||||
|
||||
data = bb.data.init()
|
||||
data = self._parse(path, data)
|
||||
|
||||
# We only need to care about certain variables
|
||||
mach = getString('MACHINE')
|
||||
if mach and mach != self.config.get('MACHINE', ''):
|
||||
self.config['MACHINE'] = mach
|
||||
sdkmach = getString('SDKMACHINE')
|
||||
if sdkmach and sdkmach != self.config.get('SDKMACHINE', ''):
|
||||
self.config['SDKMACHINE'] = sdkmach
|
||||
distro = getString('DISTRO')
|
||||
if not distro:
|
||||
distro = "defaultsetup"
|
||||
if distro and distro != self.config.get('DISTRO', ''):
|
||||
self.config['DISTRO'] = distro
|
||||
bbnum = getString('BB_NUMBER_THREADS')
|
||||
if bbnum and bbnum != self.config.get('BB_NUMBER_THREADS', ''):
|
||||
self.config['BB_NUMBER_THREADS'] = bbnum
|
||||
pmake = getString('PARALLEL_MAKE')
|
||||
if pmake and pmake != self.config.get('PARALLEL_MAKE', ''):
|
||||
self.config['PARALLEL_MAKE'] = pmake
|
||||
pclass = getString('PACKAGE_CLASSES')
|
||||
if pclass and pclass != self.config.get('PACKAGE_CLASSES', ''):
|
||||
self.config['PACKAGE_CLASSES'] = pclass
|
||||
fstypes = getString('IMAGE_FSTYPES')
|
||||
if fstypes and fstypes != self.config.get('IMAGE_FSTYPES', ''):
|
||||
self.config['IMAGE_FSTYPES'] = fstypes
|
||||
|
||||
# Values which aren't always set in the conf must be explicitly
|
||||
# loaded as empty values for save to work
|
||||
incompat = getString('INCOMPATIBLE_LICENSE')
|
||||
if incompat and incompat != self.config.get('INCOMPATIBLE_LICENSE', ''):
|
||||
self.config['INCOMPATIBLE_LICENSE'] = incompat
|
||||
else:
|
||||
self.config['INCOMPATIBLE_LICENSE'] = ""
|
||||
|
||||
# Non-standard, namespaces, variables for GUI preferences
|
||||
toolchain = getString('HOB_BUILD_TOOLCHAIN')
|
||||
if toolchain and toolchain != self.config.get('HOB_BUILD_TOOLCHAIN', ''):
|
||||
self.config['HOB_BUILD_TOOLCHAIN'] = toolchain
|
||||
header = getString('HOB_BUILD_TOOLCHAIN_HEADERS')
|
||||
if header and header != self.config.get('HOB_BUILD_TOOLCHAIN_HEADERS', ''):
|
||||
self.config['HOB_BUILD_TOOLCHAIN_HEADERS'] = header
|
||||
|
||||
self.orig_config = copy.deepcopy(self.config)
|
||||
|
||||
def setConfVar(self, var, val):
|
||||
self.config[var] = val
|
||||
|
||||
def getConfVar(self, var):
|
||||
if var in self.config:
|
||||
return self.config[var]
|
||||
else:
|
||||
return ""
|
||||
|
||||
def _loadLayerConf(self, path):
|
||||
self.bblayers = path
|
||||
self.enabled_layers = {}
|
||||
self.loaded_layers = {}
|
||||
data = bb.data.init()
|
||||
data = self._parse(self.bblayers, data)
|
||||
layers = (data.getVar('BBLAYERS', True) or "").split()
|
||||
for layer in layers:
|
||||
# TODO: we may be better off calling the layer by its
|
||||
# BBFILE_COLLECTIONS value?
|
||||
name = self._getLayerName(layer)
|
||||
self.loaded_layers[name] = layer
|
||||
|
||||
self.enabled_layers = copy.deepcopy(self.loaded_layers)
|
||||
self.emit("layers-loaded")
|
||||
|
||||
def _addConfigFile(self, path):
|
||||
conffiles = ["local.conf", "hob-pre.conf", "hob-post.conf"]
|
||||
pref, sep, filename = path.rpartition("/")
|
||||
|
||||
if filename == "hob-pre.conf":
|
||||
self.preconf = path
|
||||
|
||||
if filename == "hob-post.conf":
|
||||
self.postconf = path
|
||||
|
||||
if filename in conffiles:
|
||||
self._loadConf(path)
|
||||
elif filename == "bblayers.conf":
|
||||
self._loadLayerConf(path)
|
||||
|
||||
def _splitLayer(self, path):
|
||||
# we only care about the path up to /conf/layer.conf
|
||||
layerpath, conf, end = path.rpartition("/conf/")
|
||||
return layerpath
|
||||
|
||||
def _getLayerName(self, path):
|
||||
# Should this be the collection name?
|
||||
layerpath, sep, name = path.rpartition("/")
|
||||
return name
|
||||
|
||||
def disableLayer(self, layer):
|
||||
if layer in self.enabled_layers:
|
||||
del self.enabled_layers[layer]
|
||||
|
||||
def addLayerConf(self, confpath):
|
||||
layerpath = self._splitLayer(confpath)
|
||||
name = self._getLayerName(layerpath)
|
||||
|
||||
if not layerpath or not name:
|
||||
return None, None
|
||||
elif name not in self.enabled_layers:
|
||||
self.addLayer(name, layerpath)
|
||||
return name, layerpath
|
||||
else:
|
||||
return name, None
|
||||
|
||||
def addLayer(self, name, path):
|
||||
self.enabled_layers[name] = path
|
||||
|
||||
def _isLayerConfDirty(self):
|
||||
# if a different number of layers enabled to what was
|
||||
# loaded, definitely different
|
||||
if len(self.enabled_layers) != len(self.loaded_layers):
|
||||
return True
|
||||
|
||||
for layer in self.loaded_layers:
|
||||
# if layer loaded but no longer present, definitely dirty
|
||||
if layer not in self.enabled_layers:
|
||||
return True
|
||||
|
||||
for layer in self.enabled_layers:
|
||||
# if this layer wasn't present at load, definitely dirty
|
||||
if layer not in self.loaded_layers:
|
||||
return True
|
||||
# if this layers path has changed, definitely dirty
|
||||
if self.enabled_layers[layer] != self.loaded_layers[layer]:
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
def _constructLayerEntry(self):
|
||||
"""
|
||||
Returns a string representing the new layer selection
|
||||
"""
|
||||
layers = self.enabled_layers.copy()
|
||||
# Construct BBLAYERS entry
|
||||
layer_entry = "BBLAYERS = \" \\\n"
|
||||
if 'meta' in layers:
|
||||
layer_entry = layer_entry + " %s \\\n" % layers['meta']
|
||||
del layers['meta']
|
||||
for layer in layers:
|
||||
layer_entry = layer_entry + " %s \\\n" % layers[layer]
|
||||
layer_entry = layer_entry + " \""
|
||||
|
||||
return "".join(layer_entry)
|
||||
|
||||
def writeConfFile(self, conffile, contents):
|
||||
"""
|
||||
Make a backup copy of conffile and write a new file in its stead with
|
||||
the lines in the contents list.
|
||||
"""
|
||||
# Create a backup of the conf file
|
||||
bkup = "%s~" % conffile
|
||||
os.rename(conffile, bkup)
|
||||
|
||||
# Write the contents list object to the conf file
|
||||
with open(conffile, "w") as new:
|
||||
new.write("".join(contents))
|
||||
|
||||
def updateConf(self, orig_lines, changed_values):
|
||||
new_config_lines = []
|
||||
for var in changed_values:
|
||||
# Convenience function for re.subn(). If the pattern matches
|
||||
# return a string which contains an assignment using the same
|
||||
# assignment operator as the old assignment.
|
||||
def replace_val(matchobj):
|
||||
var = matchobj.group(1) # config variable
|
||||
op = matchobj.group(2) # assignment operator
|
||||
val = changed_values[var] # new config value
|
||||
return "%s %s \"%s\"" % (var, op, val)
|
||||
|
||||
pattern = '^\s*(%s)\s*([+=?.]+)(.*)' % re.escape(var)
|
||||
p = re.compile(pattern)
|
||||
cnt = 0
|
||||
replaced = False
|
||||
|
||||
# Iterate over the local.conf lines and if they are a match
|
||||
# for the pattern comment out the line and append a new line
|
||||
# with the new VAR op "value" entry
|
||||
for line in orig_lines:
|
||||
new_line, replacements = p.subn(replace_val, line)
|
||||
if replacements:
|
||||
orig_lines[cnt] = "#%s" % line
|
||||
new_config_lines.append(new_line)
|
||||
replaced = True
|
||||
cnt = cnt + 1
|
||||
|
||||
if not replaced:
|
||||
new_config_lines.append("%s = \"%s\"\n" % (var, changed_values[var]))
|
||||
|
||||
# Add the modified variables
|
||||
orig_lines.extend(new_config_lines)
|
||||
return orig_lines
|
||||
|
||||
def writeConf(self):
|
||||
pre_vars = ["MACHINE", "SDKMACHINE", "DISTRO",
|
||||
"INCOMPATIBLE_LICENSE"]
|
||||
post_vars = ["BB_NUMBER_THREADS", "PARALLEL_MAKE", "PACKAGE_CLASSES",
|
||||
"IMAGE_FSTYPES", "HOB_BUILD_TOOLCHAIN",
|
||||
"HOB_BUILD_TOOLCHAIN_HEADERS"]
|
||||
pre_values = {}
|
||||
post_values = {}
|
||||
changed_values = {}
|
||||
pre_lines = None
|
||||
post_lines = None
|
||||
|
||||
for var in self.config:
|
||||
val = self.config[var]
|
||||
if self.orig_config.get(var, None) != val:
|
||||
changed_values[var] = val
|
||||
|
||||
if not len(changed_values):
|
||||
return
|
||||
|
||||
for var in changed_values:
|
||||
if var in pre_vars:
|
||||
pre_values[var] = changed_values[var]
|
||||
elif var in post_vars:
|
||||
post_values[var] = changed_values[var]
|
||||
|
||||
with open(self.preconf, 'r') as pre:
|
||||
pre_lines = pre.readlines()
|
||||
pre_lines = self.updateConf(pre_lines, pre_values)
|
||||
if len(pre_lines):
|
||||
self.writeConfFile(self.preconf, pre_lines)
|
||||
|
||||
with open(self.postconf, 'r') as post:
|
||||
post_lines = post.readlines()
|
||||
post_lines = self.updateConf(post_lines, post_values)
|
||||
if len(post_lines):
|
||||
self.writeConfFile(self.postconf, post_lines)
|
||||
|
||||
del self.orig_config
|
||||
self.orig_config = copy.deepcopy(self.config)
|
||||
|
||||
def insertTempBBPath(self, bbpath, bbfiles):
|
||||
# read the original conf into a list
|
||||
with open(self.postconf, 'r') as config:
|
||||
config_lines = config.readlines()
|
||||
|
||||
if bbpath:
|
||||
config_lines.append("BBPATH := \"${BBPATH}:%s\"\n" % bbpath)
|
||||
if bbfiles:
|
||||
config_lines.append("BBFILES := \"${BBFILES} %s\"\n" % bbfiles)
|
||||
|
||||
self.writeConfFile(self.postconf, config_lines)
|
||||
|
||||
def writeLayerConf(self):
|
||||
# If we've not added/removed new layers don't write
|
||||
if not self._isLayerConfDirty():
|
||||
return
|
||||
|
||||
# This pattern should find the existing BBLAYERS
|
||||
pattern = 'BBLAYERS\s=\s\".*\"'
|
||||
|
||||
replacement = self._constructLayerEntry()
|
||||
|
||||
with open(self.bblayers, "r") as f:
|
||||
contents = f.read()
|
||||
p = re.compile(pattern, re.DOTALL)
|
||||
new = p.sub(replacement, contents)
|
||||
|
||||
self.writeConfFile(self.bblayers, new)
|
||||
|
||||
# set loaded_layers for dirtiness tracking
|
||||
self.loaded_layers = copy.deepcopy(self.enabled_layers)
|
||||
|
||||
self.emit("layers-changed")
|
||||
|
||||
def configFound(self, handler, path):
|
||||
self._addConfigFile(path)
|
||||
|
||||
def loadConfig(self, path):
|
||||
self._addConfigFile(path)
|
||||
@@ -1,61 +0,0 @@
|
||||
#
|
||||
# BitBake Graphical GTK User Interface
|
||||
#
|
||||
# Copyright (C) 2011 Intel Corporation
|
||||
#
|
||||
# Authored by Joshua Lock <josh@linux.intel.com>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License version 2 as
|
||||
# published by the Free Software Foundation.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along
|
||||
# with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
import gobject
|
||||
import gtk
|
||||
"""
|
||||
The following are convenience classes for implementing GNOME HIG compliant
|
||||
BitBake GUI's
|
||||
In summary: spacing = 12px, border-width = 6px
|
||||
"""
|
||||
|
||||
class CrumbsDialog(gtk.Dialog):
|
||||
"""
|
||||
A GNOME HIG compliant dialog widget.
|
||||
Add buttons with gtk.Dialog.add_button or gtk.Dialog.add_buttons
|
||||
"""
|
||||
def __init__(self, parent=None, label="", icon=gtk.STOCK_INFO):
|
||||
gtk.Dialog.__init__(self, "", parent, gtk.DIALOG_DESTROY_WITH_PARENT)
|
||||
|
||||
#self.set_property("has-separator", False) # note: deprecated in 2.22
|
||||
|
||||
self.set_border_width(6)
|
||||
self.vbox.set_property("spacing", 12)
|
||||
self.action_area.set_property("spacing", 12)
|
||||
self.action_area.set_property("border-width", 6)
|
||||
|
||||
first_row = gtk.HBox(spacing=12)
|
||||
first_row.set_property("border-width", 6)
|
||||
first_row.show()
|
||||
self.vbox.add(first_row)
|
||||
|
||||
self.icon = gtk.Image()
|
||||
self.icon.set_from_stock(icon, gtk.ICON_SIZE_DIALOG)
|
||||
self.icon.set_property("yalign", 0.00)
|
||||
self.icon.show()
|
||||
first_row.add(self.icon)
|
||||
|
||||
self.label = gtk.Label()
|
||||
self.label.set_use_markup(True)
|
||||
self.label.set_line_wrap(True)
|
||||
self.label.set_markup(label)
|
||||
self.label.set_property("yalign", 0.00)
|
||||
self.label.show()
|
||||
first_row.add(self.label)
|
||||
@@ -19,9 +19,7 @@
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
import gobject
|
||||
import logging
|
||||
import tempfile
|
||||
import datetime
|
||||
from bb.ui.crumbs.progress import ProgressBar
|
||||
|
||||
progress_total = 0
|
||||
|
||||
@@ -31,130 +29,58 @@ class HobHandler(gobject.GObject):
|
||||
This object does BitBake event handling for the hob gui.
|
||||
"""
|
||||
__gsignals__ = {
|
||||
"machines-updated" : (gobject.SIGNAL_RUN_LAST,
|
||||
gobject.TYPE_NONE,
|
||||
(gobject.TYPE_PYOBJECT,)),
|
||||
"sdk-machines-updated": (gobject.SIGNAL_RUN_LAST,
|
||||
gobject.TYPE_NONE,
|
||||
(gobject.TYPE_PYOBJECT,)),
|
||||
"distros-updated" : (gobject.SIGNAL_RUN_LAST,
|
||||
gobject.TYPE_NONE,
|
||||
(gobject.TYPE_PYOBJECT,)),
|
||||
"package-formats-found" : (gobject.SIGNAL_RUN_LAST,
|
||||
gobject.TYPE_NONE,
|
||||
(gobject.TYPE_PYOBJECT,)),
|
||||
"config-found" : (gobject.SIGNAL_RUN_LAST,
|
||||
gobject.TYPE_NONE,
|
||||
(gobject.TYPE_STRING,)),
|
||||
"generating-data" : (gobject.SIGNAL_RUN_LAST,
|
||||
gobject.TYPE_NONE,
|
||||
()),
|
||||
"data-generated" : (gobject.SIGNAL_RUN_LAST,
|
||||
gobject.TYPE_NONE,
|
||||
()),
|
||||
"fatal-error" : (gobject.SIGNAL_RUN_LAST,
|
||||
gobject.TYPE_NONE,
|
||||
(gobject.TYPE_STRING,
|
||||
gobject.TYPE_STRING,)),
|
||||
"command-failed" : (gobject.SIGNAL_RUN_LAST,
|
||||
gobject.TYPE_NONE,
|
||||
(gobject.TYPE_STRING,)),
|
||||
"reload-triggered" : (gobject.SIGNAL_RUN_LAST,
|
||||
gobject.TYPE_NONE,
|
||||
(gobject.TYPE_STRING,
|
||||
gobject.TYPE_STRING,)),
|
||||
"machines-updated" : (gobject.SIGNAL_RUN_LAST,
|
||||
gobject.TYPE_NONE,
|
||||
(gobject.TYPE_PYOBJECT,)),
|
||||
"distros-updated" : (gobject.SIGNAL_RUN_LAST,
|
||||
gobject.TYPE_NONE,
|
||||
(gobject.TYPE_PYOBJECT,)),
|
||||
"generating-data" : (gobject.SIGNAL_RUN_LAST,
|
||||
gobject.TYPE_NONE,
|
||||
()),
|
||||
"data-generated" : (gobject.SIGNAL_RUN_LAST,
|
||||
gobject.TYPE_NONE,
|
||||
())
|
||||
}
|
||||
|
||||
(CFG_PATH_LOCAL, CFG_PATH_PRE, CFG_PATH_POST, CFG_PATH_LAYERS, CFG_FILES_DISTRO, CFG_FILES_MACH, CFG_FILES_SDK, FILES_MATCH_CLASS, GENERATE_TGTS, REPARSE_FILES, BUILD_IMAGE) = range(11)
|
||||
|
||||
def __init__(self, taskmodel, server):
|
||||
gobject.GObject.__init__(self)
|
||||
|
||||
self.current_command = None
|
||||
self.building = False
|
||||
self.build_toolchain = False
|
||||
self.build_toolchain_headers = False
|
||||
self.generating = False
|
||||
self.build_queue = []
|
||||
self.current_phase = None
|
||||
self.bbpath_ok = False
|
||||
self.bbfiles_ok = False
|
||||
self.build_type = "image"
|
||||
self.image_dir = os.path.join(tempfile.gettempdir(), 'hob-images')
|
||||
|
||||
self.model = taskmodel
|
||||
self.server = server
|
||||
self.current_command = None
|
||||
self.building = False
|
||||
|
||||
deploy_dir = self.server.runCommand(["getVariable", "DEPLOY_DIR"])
|
||||
self.image_out_dir = os.path.join(deploy_dir, "images")
|
||||
self.image_output_types = self.server.runCommand(["getVariable", "IMAGE_FSTYPES"]).split(" ")
|
||||
self.bbpath = self.server.runCommand(["getVariable", "BBPATH"])
|
||||
self.bbfiles = self.server.runCommand(["getVariable", "BBFILES"])
|
||||
self.command_map = {
|
||||
"findConfigFilesDistro" : ("findConfigFiles", "MACHINE", "findConfigFilesMachine"),
|
||||
"findConfigFilesMachine" : ("generateTargetsTree", "classes/image.bbclass", None),
|
||||
"generateTargetsTree" : (None, None, None),
|
||||
}
|
||||
|
||||
def run_next_command(self):
|
||||
if self.current_command and not self.generating:
|
||||
self.emit("generating-data")
|
||||
self.generating = True
|
||||
# FIXME: this is ugly and I *will* replace it
|
||||
if self.current_command:
|
||||
next_cmd = self.command_map[self.current_command]
|
||||
command = next_cmd[0]
|
||||
argument = next_cmd[1]
|
||||
self.current_command = next_cmd[2]
|
||||
if command == "generateTargetsTree":
|
||||
self.emit("generating-data")
|
||||
self.server.runCommand([command, argument])
|
||||
|
||||
if self.current_command == self.CFG_PATH_LOCAL:
|
||||
self.current_command = self.CFG_PATH_PRE
|
||||
self.server.runCommand(["findConfigFilePath", "hob-pre.conf"])
|
||||
elif self.current_command == self.CFG_PATH_PRE:
|
||||
self.current_command = self.CFG_PATH_POST
|
||||
self.server.runCommand(["findConfigFilePath", "hob-post.conf"])
|
||||
elif self.current_command == self.CFG_PATH_POST:
|
||||
self.current_command = self.CFG_PATH_LAYERS
|
||||
self.server.runCommand(["findConfigFilePath", "bblayers.conf"])
|
||||
elif self.current_command == self.CFG_PATH_LAYERS:
|
||||
self.current_command = self.CFG_FILES_DISTRO
|
||||
self.server.runCommand(["findConfigFiles", "DISTRO"])
|
||||
elif self.current_command == self.CFG_FILES_DISTRO:
|
||||
self.current_command = self.CFG_FILES_MACH
|
||||
self.server.runCommand(["findConfigFiles", "MACHINE"])
|
||||
elif self.current_command == self.CFG_FILES_MACH:
|
||||
self.current_command = self.CFG_FILES_SDK
|
||||
self.server.runCommand(["findConfigFiles", "MACHINE-SDK"])
|
||||
elif self.current_command == self.CFG_FILES_SDK:
|
||||
self.current_command = self.FILES_MATCH_CLASS
|
||||
self.server.runCommand(["findFilesMatchingInDir", "rootfs_", "classes"])
|
||||
elif self.current_command == self.FILES_MATCH_CLASS:
|
||||
self.current_command = self.GENERATE_TGTS
|
||||
self.server.runCommand(["generateTargetsTree", "classes/image.bbclass"])
|
||||
elif self.current_command == self.GENERATE_TGTS:
|
||||
if self.generating:
|
||||
self.emit("data-generated")
|
||||
self.generating = False
|
||||
self.current_command = None
|
||||
elif self.current_command == self.REPARSE_FILES:
|
||||
if self.build_queue:
|
||||
self.current_command = self.BUILD_IMAGE
|
||||
else:
|
||||
self.current_command = self.CFG_PATH_LAYERS
|
||||
self.server.runCommand(["resetCooker"])
|
||||
self.server.runCommand(["reparseFiles"])
|
||||
elif self.current_command == self.BUILD_IMAGE:
|
||||
if self.generating:
|
||||
self.emit("data-generated")
|
||||
self.generating = False
|
||||
self.building = True
|
||||
self.server.runCommand(["buildTargets", self.build_queue, "build"])
|
||||
self.build_queue = []
|
||||
self.current_command = None
|
||||
|
||||
def handle_event(self, event, running_build, pbar):
|
||||
def handle_event(self, event, running_build, pbar=None):
|
||||
if not event:
|
||||
return
|
||||
|
||||
# If we're running a build, use the RunningBuild event handler
|
||||
if self.building:
|
||||
self.current_phase = "building"
|
||||
running_build.handle_event(event)
|
||||
elif isinstance(event, bb.event.TargetsTreeGenerated):
|
||||
self.current_phase = "data generation"
|
||||
self.emit("data-generated")
|
||||
if event._model:
|
||||
self.model.populate(event._model)
|
||||
|
||||
elif isinstance(event, bb.event.ConfigFilesFound):
|
||||
self.current_phase = "configuration lookup"
|
||||
var = event._variable
|
||||
if var == "distro":
|
||||
distros = event._values
|
||||
@@ -164,58 +90,26 @@ class HobHandler(gobject.GObject):
|
||||
machines = event._values
|
||||
machines.sort()
|
||||
self.emit("machines-updated", machines)
|
||||
elif var == "machine-sdk":
|
||||
sdk_machines = event._values
|
||||
sdk_machines.sort()
|
||||
self.emit("sdk-machines-updated", sdk_machines)
|
||||
elif isinstance(event, bb.event.ConfigFilePathFound):
|
||||
self.current_phase = "configuration lookup"
|
||||
path = event._path
|
||||
self.emit("config-found", path)
|
||||
elif isinstance(event, bb.event.FilesMatchingFound):
|
||||
self.current_phase = "configuration lookup"
|
||||
# FIXME: hard coding, should at least be a variable shared between
|
||||
# here and the caller
|
||||
if event._pattern == "rootfs_":
|
||||
formats = []
|
||||
for match in event._matches:
|
||||
classname, sep, cls = match.rpartition(".")
|
||||
fs, sep, format = classname.rpartition("_")
|
||||
formats.append(format)
|
||||
formats.sort()
|
||||
self.emit("package-formats-found", formats)
|
||||
|
||||
elif isinstance(event, bb.command.CommandCompleted):
|
||||
self.current_phase = None
|
||||
self.run_next_command()
|
||||
elif isinstance(event, bb.command.CommandFailed):
|
||||
self.emit("command-failed", event.error)
|
||||
elif isinstance(event, bb.event.CacheLoadStarted):
|
||||
self.current_phase = "cache loading"
|
||||
elif isinstance(event, bb.event.CacheLoadStarted) and pbar:
|
||||
pbar.set_title("Loading cache")
|
||||
bb.ui.crumbs.hobeventhandler.progress_total = event.total
|
||||
pbar.set_text("Loading cache: %s/%s" % (0, bb.ui.crumbs.hobeventhandler.progress_total))
|
||||
elif isinstance(event, bb.event.CacheLoadProgress):
|
||||
self.current_phase = "cache loading"
|
||||
pbar.set_text("Loading cache: %s/%s" % (event.current, bb.ui.crumbs.hobeventhandler.progress_total))
|
||||
elif isinstance(event, bb.event.CacheLoadCompleted):
|
||||
self.current_phase = None
|
||||
pbar.set_text("Loading...")
|
||||
elif isinstance(event, bb.event.ParseStarted):
|
||||
self.current_phase = "recipe parsing"
|
||||
if event.total == 0:
|
||||
return
|
||||
pbar.update(0, bb.ui.crumbs.hobeventhandler.progress_total)
|
||||
elif isinstance(event, bb.event.CacheLoadProgress) and pbar:
|
||||
pbar.update(event.current, bb.ui.crumbs.hobeventhandler.progress_total)
|
||||
elif isinstance(event, bb.event.CacheLoadCompleted) and pbar:
|
||||
pbar.update(bb.ui.crumbs.hobeventhandler.progress_total, bb.ui.crumbs.hobeventhandler.progress_total)
|
||||
elif isinstance(event, bb.event.ParseStarted) and pbar:
|
||||
pbar.set_title("Processing recipes")
|
||||
bb.ui.crumbs.hobeventhandler.progress_total = event.total
|
||||
pbar.set_text("Processing recipes: %s/%s" % (0, bb.ui.crumbs.hobeventhandler.progress_total))
|
||||
elif isinstance(event, bb.event.ParseProgress):
|
||||
self.current_phase = "recipe parsing"
|
||||
pbar.set_text("Processing recipes: %s/%s" % (event.current, bb.ui.crumbs.hobeventhandler.progress_total))
|
||||
elif isinstance(event, bb.event.ParseCompleted):
|
||||
self.current_phase = None
|
||||
pbar.set_fraction(1.0)
|
||||
pbar.set_text("Loading...")
|
||||
elif isinstance(event, logging.LogRecord):
|
||||
format = bb.msg.BBLogFormatter("%(levelname)s: %(message)s")
|
||||
if event.levelno >= format.CRITICAL:
|
||||
self.emit("fatal-error", event.getMessage(), self.current_phase)
|
||||
pbar.update(0, bb.ui.crumbs.hobeventhandler.progress_total)
|
||||
elif isinstance(event, bb.event.ParseProgress) and pbar:
|
||||
pbar.update(event.current, bb.ui.crumbs.hobeventhandler.progress_total)
|
||||
elif isinstance(event, bb.event.ParseCompleted) and pbar:
|
||||
pbar.hide()
|
||||
|
||||
return
|
||||
|
||||
def event_handle_idle_func (self, eventHandler, running_build, pbar):
|
||||
@@ -228,116 +122,16 @@ class HobHandler(gobject.GObject):
|
||||
|
||||
def set_machine(self, machine):
|
||||
self.server.runCommand(["setVariable", "MACHINE", machine])
|
||||
|
||||
def set_sdk_machine(self, sdk_machine):
|
||||
self.server.runCommand(["setVariable", "SDKMACHINE", sdk_machine])
|
||||
self.current_command = "findConfigFilesMachine"
|
||||
self.run_next_command()
|
||||
|
||||
def set_distro(self, distro):
|
||||
self.server.runCommand(["setVariable", "DISTRO", distro])
|
||||
|
||||
def set_package_format(self, format):
|
||||
self.server.runCommand(["setVariable", "PACKAGE_CLASSES", "package_%s" % format])
|
||||
def run_build(self, targets):
|
||||
self.building = True
|
||||
self.server.runCommand(["buildTargets", targets, "build"])
|
||||
|
||||
def reload_data(self, config=None):
|
||||
img = self.model.selected_image
|
||||
selected_packages, _ = self.model.get_selected_packages()
|
||||
self.emit("reload-triggered", img, " ".join(selected_packages))
|
||||
self.current_command = self.REPARSE_FILES
|
||||
self.run_next_command()
|
||||
|
||||
def set_bbthreads(self, threads):
|
||||
self.server.runCommand(["setVariable", "BB_NUMBER_THREADS", threads])
|
||||
|
||||
def set_pmake(self, threads):
|
||||
pmake = "-j %s" % threads
|
||||
self.server.runCommand(["setVariable", "BB_NUMBER_THREADS", pmake])
|
||||
|
||||
def build_targets(self, tgts, configurator, build_type="image"):
|
||||
self.build_type = build_type
|
||||
targets = []
|
||||
nbbp = None
|
||||
nbbf = None
|
||||
targets.extend(tgts)
|
||||
if self.build_toolchain and self.build_toolchain_headers:
|
||||
targets.append("meta-toolchain-sdk")
|
||||
elif self.build_toolchain:
|
||||
targets.append("meta-toolchain")
|
||||
self.build_queue = targets
|
||||
|
||||
if not self.bbpath_ok:
|
||||
if self.image_dir in self.bbpath.split(":"):
|
||||
self.bbpath_ok = True
|
||||
else:
|
||||
nbbp = self.image_dir
|
||||
|
||||
if not self.bbfiles_ok:
|
||||
import re
|
||||
pattern = "%s/\*.bb" % self.image_dir
|
||||
|
||||
for files in self.bbfiles.split(" "):
|
||||
if re.match(pattern, files):
|
||||
self.bbfiles_ok = True
|
||||
|
||||
if not self.bbfiles_ok:
|
||||
nbbf = "%s/*.bb" % self.image_dir
|
||||
|
||||
if nbbp or nbbf:
|
||||
configurator.insertTempBBPath(nbbp, nbbf)
|
||||
self.bbpath_ok = True
|
||||
self.bbfiles_ok = True
|
||||
|
||||
self.current_command = self.REPARSE_FILES
|
||||
self.run_next_command()
|
||||
|
||||
def cancel_build(self, force=False):
|
||||
if force:
|
||||
# Force the cooker to stop as quickly as possible
|
||||
self.server.runCommand(["stateStop"])
|
||||
else:
|
||||
# Wait for tasks to complete before shutting down, this helps
|
||||
# leave the workdir in a usable state
|
||||
self.server.runCommand(["stateShutdown"])
|
||||
|
||||
def set_incompatible_license(self, incompatible):
|
||||
self.server.runCommand(["setVariable", "INCOMPATIBLE_LICENSE", incompatible])
|
||||
|
||||
def toggle_toolchain(self, enabled):
|
||||
if self.build_toolchain != enabled:
|
||||
self.build_toolchain = enabled
|
||||
|
||||
def toggle_toolchain_headers(self, enabled):
|
||||
if self.build_toolchain_headers != enabled:
|
||||
self.build_toolchain_headers = enabled
|
||||
|
||||
def set_fstypes(self, fstypes):
|
||||
self.server.runCommand(["setVariable", "IMAGE_FSTYPES", fstypes])
|
||||
|
||||
def add_image_output_type(self, output_type):
|
||||
if output_type not in self.image_output_types:
|
||||
self.image_output_types.append(output_type)
|
||||
fstypes = " ".join(self.image_output_types).lstrip(" ")
|
||||
self.set_fstypes(fstypes)
|
||||
return self.image_output_types
|
||||
|
||||
def remove_image_output_type(self, output_type):
|
||||
if output_type in self.image_output_types:
|
||||
ind = self.image_output_types.index(output_type)
|
||||
self.image_output_types.pop(ind)
|
||||
fstypes = " ".join(self.image_output_types).lstrip(" ")
|
||||
self.set_fstypes(fstypes)
|
||||
return self.image_output_types
|
||||
|
||||
def get_image_deploy_dir(self):
|
||||
return self.image_out_dir
|
||||
|
||||
def make_temp_dir(self):
|
||||
bb.utils.mkdirhier(self.image_dir)
|
||||
|
||||
def remove_temp_dir(self):
|
||||
bb.utils.remove(self.image_dir, True)
|
||||
|
||||
def get_temp_recipe_path(self, name):
|
||||
timestamp = datetime.date.today().isoformat()
|
||||
image_file = "hob-%s-variant-%s.bb" % (name, timestamp)
|
||||
recipepath = os.path.join(self.image_dir, image_file)
|
||||
return recipepath
|
||||
def cancel_build(self):
|
||||
# Note: this may not be the right way to stop an in-progress build
|
||||
self.server.runCommand(["stateStop"])
|
||||
|
||||
@@ -1,334 +0,0 @@
|
||||
#
|
||||
# BitBake Graphical GTK User Interface
|
||||
#
|
||||
# Copyright (C) 2011 Intel Corporation
|
||||
#
|
||||
# Authored by Joshua Lock <josh@linux.intel.com>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License version 2 as
|
||||
# published by the Free Software Foundation.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along
|
||||
# with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
import gtk
|
||||
import glib
|
||||
from bb.ui.crumbs.configurator import Configurator
|
||||
|
||||
class HobPrefs(gtk.Dialog):
|
||||
"""
|
||||
"""
|
||||
def empty_combo_text(self, combo_text):
|
||||
model = combo_text.get_model()
|
||||
if model:
|
||||
model.clear()
|
||||
|
||||
def output_type_toggled_cb(self, check, handler):
|
||||
ot = check.get_label()
|
||||
enabled = check.get_active()
|
||||
if enabled:
|
||||
self.selected_image_types = handler.add_image_output_type(ot)
|
||||
else:
|
||||
self.selected_image_types = handler.remove_image_output_type(ot)
|
||||
|
||||
self.configurator.setConfVar('IMAGE_FSTYPES', "%s" % " ".join(self.selected_image_types).lstrip(" "))
|
||||
|
||||
def sdk_machine_combo_changed_cb(self, combo, handler):
|
||||
sdk_mach = combo.get_active_text()
|
||||
if sdk_mach != self.curr_sdk_mach:
|
||||
self.curr_sdk_mach = sdk_mach
|
||||
self.configurator.setConfVar('SDKMACHINE', sdk_mach)
|
||||
handler.set_sdk_machine(sdk_mach)
|
||||
|
||||
def update_sdk_machines(self, handler, sdk_machines):
|
||||
active = 0
|
||||
# disconnect the signal handler before updating the combo model
|
||||
if self.sdk_machine_handler_id:
|
||||
self.sdk_machine_combo.disconnect(self.sdk_machine_handler_id)
|
||||
self.sdk_machine_handler_id = None
|
||||
|
||||
self.empty_combo_text(self.sdk_machine_combo)
|
||||
for sdk_machine in sdk_machines:
|
||||
self.sdk_machine_combo.append_text(sdk_machine)
|
||||
if sdk_machine == self.curr_sdk_mach:
|
||||
self.sdk_machine_combo.set_active(active)
|
||||
active = active + 1
|
||||
|
||||
self.sdk_machine_handler_id = self.sdk_machine_combo.connect("changed", self.sdk_machine_combo_changed_cb, handler)
|
||||
|
||||
def distro_combo_changed_cb(self, combo, handler):
|
||||
distro = combo.get_active_text()
|
||||
if distro != self.curr_distro:
|
||||
self.curr_distro = distro
|
||||
self.configurator.setConfVar('DISTRO', distro)
|
||||
handler.set_distro(distro)
|
||||
self.reload_required = True
|
||||
|
||||
def update_distros(self, handler, distros):
|
||||
active = 0
|
||||
# disconnect the signal handler before updating combo model
|
||||
if self.distro_handler_id:
|
||||
self.distro_combo.disconnect(self.distro_handler_id)
|
||||
self.distro_handler_id = None
|
||||
|
||||
self.empty_combo_text(self.distro_combo)
|
||||
for distro in distros:
|
||||
self.distro_combo.append_text(distro)
|
||||
if distro == self.curr_distro:
|
||||
self.distro_combo.set_active(active)
|
||||
active = active + 1
|
||||
|
||||
self.distro_handler_id = self.distro_combo.connect("changed", self.distro_combo_changed_cb, handler)
|
||||
|
||||
def package_format_combo_changed_cb(self, combo, handler):
|
||||
package_format = combo.get_active_text()
|
||||
if package_format != self.curr_package_format:
|
||||
self.curr_package_format = package_format
|
||||
self.configurator.setConfVar('PACKAGE_CLASSES', 'package_%s' % package_format)
|
||||
handler.set_package_format(package_format)
|
||||
self.reload_required = True
|
||||
|
||||
def update_package_formats(self, handler, formats):
|
||||
active = 0
|
||||
# disconnect the signal handler before updating the model
|
||||
if self.package_handler_id:
|
||||
self.package_combo.disconnect(self.package_handler_id)
|
||||
self.package_handler_id = None
|
||||
|
||||
self.empty_combo_text(self.package_combo)
|
||||
for format in formats:
|
||||
self.package_combo.append_text(format)
|
||||
if format == self.curr_package_format:
|
||||
self.package_combo.set_active(active)
|
||||
active = active + 1
|
||||
|
||||
self.package_handler_id = self.package_combo.connect("changed", self.package_format_combo_changed_cb, handler)
|
||||
|
||||
def include_gplv3_cb(self, toggle):
|
||||
excluded = toggle.get_active()
|
||||
orig_incompatible = self.configurator.getConfVar('INCOMPATIBLE_LICENSE')
|
||||
new_incompatible = ""
|
||||
if excluded:
|
||||
if not orig_incompatible:
|
||||
new_incompatible = "GPLv3"
|
||||
elif not orig_incompatible.find('GPLv3'):
|
||||
new_incompatible = "%s GPLv3" % orig_incompatible
|
||||
else:
|
||||
new_incompatible = orig_incompatible.replace('GPLv3', '')
|
||||
|
||||
if new_incompatible != orig_incompatible:
|
||||
self.handler.set_incompatible_license(new_incompatible)
|
||||
self.configurator.setConfVar('INCOMPATIBLE_LICENSE', new_incompatible)
|
||||
self.reload_required = True
|
||||
|
||||
def change_bb_threads_cb(self, spinner):
|
||||
val = spinner.get_value_as_int()
|
||||
self.handler.set_bbthreads(val)
|
||||
self.configurator.setConfVar('BB_NUMBER_THREADS', val)
|
||||
|
||||
def change_make_threads_cb(self, spinner):
|
||||
val = spinner.get_value_as_int()
|
||||
self.handler.set_pmake(val)
|
||||
self.configurator.setConfVar('PARALLEL_MAKE', "-j %s" % val)
|
||||
|
||||
def toggle_toolchain_cb(self, check):
|
||||
enabled = check.get_active()
|
||||
toolchain = '0'
|
||||
if enabled:
|
||||
toolchain = '1'
|
||||
self.handler.toggle_toolchain(enabled)
|
||||
self.configurator.setConfVar('HOB_BUILD_TOOLCHAIN', toolchain)
|
||||
|
||||
def toggle_headers_cb(self, check):
|
||||
enabled = check.get_active()
|
||||
headers = '0'
|
||||
if enabled:
|
||||
headers = '1'
|
||||
self.handler.toggle_toolchain_headers(enabled)
|
||||
self.configurator.setConfVar('HOB_BUILD_TOOLCHAIN_HEADERS', headers)
|
||||
|
||||
def set_parent_window(self, parent):
|
||||
self.set_transient_for(parent)
|
||||
|
||||
def write_changes(self):
|
||||
self.configurator.writeConf()
|
||||
|
||||
def prefs_response_cb(self, dialog, response):
|
||||
if self.reload_required:
|
||||
glib.idle_add(self.handler.reload_data)
|
||||
self.reload_required = False
|
||||
|
||||
def __init__(self, configurator, handler, curr_sdk_mach, curr_distro, pclass,
|
||||
pmake, bbthread, selected_image_types, all_image_types,
|
||||
gplv3disabled, build_toolchain, build_toolchain_headers):
|
||||
"""
|
||||
"""
|
||||
gtk.Dialog.__init__(self, "Preferences", None,
|
||||
gtk.DIALOG_DESTROY_WITH_PARENT,
|
||||
(gtk.STOCK_CLOSE, gtk.RESPONSE_OK))
|
||||
|
||||
self.set_border_width(6)
|
||||
self.vbox.set_property("spacing", 12)
|
||||
self.action_area.set_property("spacing", 12)
|
||||
self.action_area.set_property("border-width", 6)
|
||||
|
||||
self.handler = handler
|
||||
self.configurator = configurator
|
||||
|
||||
self.curr_sdk_mach = curr_sdk_mach
|
||||
self.curr_distro = curr_distro
|
||||
self.curr_package_format = pclass
|
||||
self.pmake = pmake
|
||||
self.bbthread = bbthread
|
||||
self.selected_image_types = selected_image_types.split(" ")
|
||||
self.gplv3disabled = gplv3disabled
|
||||
self.build_toolchain = build_toolchain
|
||||
self.build_toolchain_headers = build_toolchain_headers
|
||||
|
||||
self.reload_required = False
|
||||
self.distro_handler_id = None
|
||||
self.sdk_machine_handler_id = None
|
||||
self.package_handler_id = None
|
||||
|
||||
left = gtk.SizeGroup(gtk.SIZE_GROUP_HORIZONTAL)
|
||||
right = gtk.SizeGroup(gtk.SIZE_GROUP_HORIZONTAL)
|
||||
|
||||
label = gtk.Label()
|
||||
label.set_markup("<b>Policy</b>")
|
||||
label.show()
|
||||
frame = gtk.Frame()
|
||||
frame.set_label_widget(label)
|
||||
frame.set_shadow_type(gtk.SHADOW_NONE)
|
||||
frame.show()
|
||||
self.vbox.pack_start(frame)
|
||||
pbox = gtk.VBox(False, 12)
|
||||
pbox.show()
|
||||
frame.add(pbox)
|
||||
hbox = gtk.HBox(False, 12)
|
||||
hbox.show()
|
||||
pbox.pack_start(hbox, expand=False, fill=False, padding=6)
|
||||
# Distro selector
|
||||
label = gtk.Label("Distribution:")
|
||||
label.show()
|
||||
hbox.pack_start(label, expand=False, fill=False, padding=6)
|
||||
self.distro_combo = gtk.combo_box_new_text()
|
||||
self.distro_combo.set_tooltip_text("Select the Yocto distribution you would like to use")
|
||||
self.distro_combo.show()
|
||||
hbox.pack_start(self.distro_combo, expand=False, fill=False, padding=6)
|
||||
# Exclude GPLv3
|
||||
check = gtk.CheckButton("Exclude GPLv3 packages")
|
||||
check.set_tooltip_text("Check this box to prevent GPLv3 packages from being included in your image")
|
||||
check.show()
|
||||
check.set_active(self.gplv3disabled)
|
||||
check.connect("toggled", self.include_gplv3_cb)
|
||||
hbox.pack_start(check, expand=False, fill=False, padding=6)
|
||||
hbox = gtk.HBox(False, 12)
|
||||
hbox.show()
|
||||
pbox.pack_start(hbox, expand=False, fill=False, padding=6)
|
||||
# Package format selector
|
||||
label = gtk.Label("Package format:")
|
||||
label.show()
|
||||
hbox.pack_start(label, expand=False, fill=False, padding=6)
|
||||
self.package_combo = gtk.combo_box_new_text()
|
||||
self.package_combo.set_tooltip_text("""The package format is that used in creation
|
||||
of the root filesystem and also dictates the package manager used in your image""")
|
||||
self.package_combo.show()
|
||||
hbox.pack_start(self.package_combo, expand=False, fill=False, padding=6)
|
||||
if all_image_types:
|
||||
# Image output type selector
|
||||
label = gtk.Label("Image output types:")
|
||||
label.show()
|
||||
hbox.pack_start(label, expand=False, fill=False, padding=6)
|
||||
chk_cnt = 3
|
||||
for it in all_image_types.split(" "):
|
||||
chk_cnt = chk_cnt + 1
|
||||
if chk_cnt % 6 == 0:
|
||||
hbox = gtk.HBox(False, 12)
|
||||
hbox.show()
|
||||
pbox.pack_start(hbox, expand=False, fill=False, padding=6)
|
||||
chk = gtk.CheckButton(it)
|
||||
if it in self.selected_image_types:
|
||||
chk.set_active(True)
|
||||
chk.set_tooltip_text("Build an %s image" % it)
|
||||
chk.connect("toggled", self.output_type_toggled_cb, handler)
|
||||
chk.show()
|
||||
hbox.pack_start(chk, expand=False, fill=False, padding=3)
|
||||
# BitBake
|
||||
label = gtk.Label()
|
||||
label.set_markup("<b>BitBake</b>")
|
||||
label.show()
|
||||
frame = gtk.Frame()
|
||||
frame.set_label_widget(label)
|
||||
frame.set_shadow_type(gtk.SHADOW_NONE)
|
||||
frame.show()
|
||||
self.vbox.pack_start(frame)
|
||||
pbox = gtk.VBox(False, 12)
|
||||
pbox.show()
|
||||
frame.add(pbox)
|
||||
hbox = gtk.HBox(False, 12)
|
||||
hbox.show()
|
||||
pbox.pack_start(hbox, expand=False, fill=False, padding=6)
|
||||
label = gtk.Label("BitBake threads:")
|
||||
label.show()
|
||||
# NOTE: may be a good idea in future to intelligently cap the maximum
|
||||
# values but we need more data to make an educated decision, for now
|
||||
# set a high maximum as a value for upper bounds is required by the
|
||||
# gtk.Adjustment
|
||||
spin_max = 30 # seems like a high enough arbitrary number
|
||||
hbox.pack_start(label, expand=False, fill=False, padding=6)
|
||||
bbadj = gtk.Adjustment(value=self.bbthread, lower=1, upper=spin_max, step_incr=1)
|
||||
bbspinner = gtk.SpinButton(adjustment=bbadj, climb_rate=1, digits=0)
|
||||
bbspinner.show()
|
||||
bbspinner.connect("value-changed", self.change_bb_threads_cb)
|
||||
hbox.pack_start(bbspinner, expand=False, fill=False, padding=6)
|
||||
label = gtk.Label("Make threads:")
|
||||
label.show()
|
||||
hbox.pack_start(label, expand=False, fill=False, padding=6)
|
||||
madj = gtk.Adjustment(value=self.pmake, lower=1, upper=spin_max, step_incr=1)
|
||||
makespinner = gtk.SpinButton(adjustment=madj, climb_rate=1, digits=0)
|
||||
makespinner.connect("value-changed", self.change_make_threads_cb)
|
||||
makespinner.show()
|
||||
hbox.pack_start(makespinner, expand=False, fill=False, padding=6)
|
||||
# Toolchain
|
||||
label = gtk.Label()
|
||||
label.set_markup("<b>External Toolchain</b>")
|
||||
label.show()
|
||||
frame = gtk.Frame()
|
||||
frame.set_label_widget(label)
|
||||
frame.set_shadow_type(gtk.SHADOW_NONE)
|
||||
frame.show()
|
||||
self.vbox.pack_start(frame)
|
||||
pbox = gtk.VBox(False, 12)
|
||||
pbox.show()
|
||||
frame.add(pbox)
|
||||
hbox = gtk.HBox(False, 12)
|
||||
hbox.show()
|
||||
pbox.pack_start(hbox, expand=False, fill=False, padding=6)
|
||||
toolcheck = gtk.CheckButton("Build external development toolchain with image")
|
||||
toolcheck.show()
|
||||
toolcheck.set_active(self.build_toolchain)
|
||||
toolcheck.connect("toggled", self.toggle_toolchain_cb)
|
||||
hbox.pack_start(toolcheck, expand=False, fill=False, padding=6)
|
||||
hbox = gtk.HBox(False, 12)
|
||||
hbox.show()
|
||||
pbox.pack_start(hbox, expand=False, fill=False, padding=6)
|
||||
label = gtk.Label("Toolchain host:")
|
||||
label.show()
|
||||
hbox.pack_start(label, expand=False, fill=False, padding=6)
|
||||
self.sdk_machine_combo = gtk.combo_box_new_text()
|
||||
self.sdk_machine_combo.set_tooltip_text("Select the host architecture of the external machine")
|
||||
self.sdk_machine_combo.show()
|
||||
hbox.pack_start(self.sdk_machine_combo, expand=False, fill=False, padding=6)
|
||||
# headerscheck = gtk.CheckButton("Include development headers with toolchain")
|
||||
# headerscheck.show()
|
||||
# headerscheck.set_active(self.build_toolchain_headers)
|
||||
# headerscheck.connect("toggled", self.toggle_headers_cb)
|
||||
# hbox.pack_start(headerscheck, expand=False, fill=False, padding=6)
|
||||
self.connect("response", self.prefs_response_cb)
|
||||
@@ -1,153 +0,0 @@
|
||||
#
|
||||
# BitBake Graphical GTK User Interface
|
||||
#
|
||||
# Copyright (C) 2011 Intel Corporation
|
||||
#
|
||||
# Authored by Joshua Lock <josh@linux.intel.com>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License version 2 as
|
||||
# published by the Free Software Foundation.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along
|
||||
# with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
import gobject
|
||||
import gtk
|
||||
from bb.ui.crumbs.configurator import Configurator
|
||||
from bb.ui.crumbs.hig import CrumbsDialog
|
||||
|
||||
class LayerEditor(gtk.Dialog):
|
||||
"""
|
||||
Gtk+ Widget for enabling and disabling layers.
|
||||
Layers are added through using an open dialog to find the layer.conf
|
||||
Disabled layers are deleted from conf/bblayers.conf
|
||||
"""
|
||||
def __init__(self, configurator, parent=None):
|
||||
gtk.Dialog.__init__(self, "Layers", None,
|
||||
gtk.DIALOG_DESTROY_WITH_PARENT,
|
||||
(gtk.STOCK_CLOSE, gtk.RESPONSE_OK))
|
||||
|
||||
# We want to show a little more of the treeview in the default,
|
||||
# emptier, case
|
||||
self.set_size_request(-1, 300)
|
||||
self.set_border_width(6)
|
||||
self.vbox.set_property("spacing", 0)
|
||||
self.action_area.set_property("border-width", 6)
|
||||
|
||||
self.configurator = configurator
|
||||
self.newly_added = {}
|
||||
|
||||
# Label to inform users that meta is enabled but that you can't
|
||||
# disable it as it'd be a *bad* idea
|
||||
msg = "As the core of the build system the <i>meta</i> layer must always be included and therefore can't be viewed or edited here."
|
||||
lbl = gtk.Label()
|
||||
lbl.show()
|
||||
lbl.set_use_markup(True)
|
||||
lbl.set_markup(msg)
|
||||
lbl.set_line_wrap(True)
|
||||
lbl.set_justify(gtk.JUSTIFY_FILL)
|
||||
self.vbox.pack_start(lbl, expand=False, fill=False, padding=6)
|
||||
|
||||
# Create a treeview in which to list layers
|
||||
# ListStore of Name, Path, Enabled
|
||||
self.layer_store = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_BOOLEAN)
|
||||
self.tv = gtk.TreeView(self.layer_store)
|
||||
self.tv.set_headers_visible(True)
|
||||
|
||||
col0 = gtk.TreeViewColumn('Name')
|
||||
self.tv.append_column(col0)
|
||||
col1 = gtk.TreeViewColumn('Path')
|
||||
self.tv.append_column(col1)
|
||||
col2 = gtk.TreeViewColumn('Enabled')
|
||||
self.tv.append_column(col2)
|
||||
|
||||
cell0 = gtk.CellRendererText()
|
||||
col0.pack_start(cell0, True)
|
||||
col0.set_attributes(cell0, text=0)
|
||||
cell1 = gtk.CellRendererText()
|
||||
col1.pack_start(cell1, True)
|
||||
col1.set_attributes(cell1, text=1)
|
||||
cell2 = gtk.CellRendererToggle()
|
||||
cell2.connect("toggled", self._toggle_layer_cb)
|
||||
col2.pack_start(cell2, True)
|
||||
col2.set_attributes(cell2, active=2)
|
||||
|
||||
self.tv.show()
|
||||
self.vbox.pack_start(self.tv, expand=True, fill=True, padding=0)
|
||||
|
||||
tb = gtk.Toolbar()
|
||||
tb.set_icon_size(gtk.ICON_SIZE_SMALL_TOOLBAR)
|
||||
tb.set_style(gtk.TOOLBAR_BOTH)
|
||||
tb.set_tooltips(True)
|
||||
tb.show()
|
||||
icon = gtk.Image()
|
||||
icon.set_from_stock(gtk.STOCK_ADD, gtk.ICON_SIZE_SMALL_TOOLBAR)
|
||||
icon.show()
|
||||
tb.insert_item("Add Layer", "Add new layer", None, icon,
|
||||
self._find_layer_cb, None, -1)
|
||||
self.vbox.pack_start(tb, expand=False, fill=False, padding=0)
|
||||
|
||||
def set_parent_window(self, parent):
|
||||
self.set_transient_for(parent)
|
||||
|
||||
def load_current_layers(self, data):
|
||||
for layer, path in self.configurator.enabled_layers.items():
|
||||
if layer != 'meta':
|
||||
self.layer_store.append([layer, path, True])
|
||||
|
||||
def save_current_layers(self):
|
||||
self.configurator.writeLayerConf()
|
||||
|
||||
def _toggle_layer_cb(self, cell, path):
|
||||
name = self.layer_store[path][0]
|
||||
toggle = not self.layer_store[path][2]
|
||||
if toggle:
|
||||
self.configurator.addLayer(name, path)
|
||||
else:
|
||||
self.configurator.disableLayer(name)
|
||||
self.layer_store[path][2] = toggle
|
||||
|
||||
def _find_layer_cb(self, button):
|
||||
self.find_layer(self)
|
||||
|
||||
def find_layer(self, parent):
|
||||
def conf_error(parent, lbl):
|
||||
dialog = CrumbsDialog(parent, lbl)
|
||||
dialog.add_button(gtk.STOCK_OK, gtk.RESPONSE_OK)
|
||||
response = dialog.run()
|
||||
dialog.destroy()
|
||||
|
||||
dialog = gtk.FileChooserDialog("Add new layer", parent,
|
||||
gtk.FILE_CHOOSER_ACTION_OPEN,
|
||||
(gtk.STOCK_CANCEL, gtk.RESPONSE_NO,
|
||||
gtk.STOCK_OPEN, gtk.RESPONSE_YES))
|
||||
label = gtk.Label("Select the layer.conf of the layer you wish to add")
|
||||
label.show()
|
||||
dialog.set_extra_widget(label)
|
||||
response = dialog.run()
|
||||
path = dialog.get_filename()
|
||||
dialog.destroy()
|
||||
|
||||
lbl = "<b>Error</b>\nUnable to load layer <i>%s</i> because " % path
|
||||
if response == gtk.RESPONSE_YES:
|
||||
# FIXME: verify we've actually got a layer conf?
|
||||
if path.endswith("layer.conf"):
|
||||
name, layerpath = self.configurator.addLayerConf(path)
|
||||
if name and layerpath:
|
||||
self.newly_added[name] = layerpath
|
||||
self.layer_store.append([name, layerpath, True])
|
||||
return
|
||||
elif name:
|
||||
return
|
||||
else:
|
||||
lbl += "there was a problem parsing the layer.conf."
|
||||
else:
|
||||
lbl += "it is not a layer.conf file."
|
||||
conf_error(parent, lbl)
|
||||
@@ -47,31 +47,19 @@ class RunningBuildModel (gtk.TreeStore):
|
||||
|
||||
class RunningBuild (gobject.GObject):
|
||||
__gsignals__ = {
|
||||
'build-started' : (gobject.SIGNAL_RUN_LAST,
|
||||
gobject.TYPE_NONE,
|
||||
()),
|
||||
'build-succeeded' : (gobject.SIGNAL_RUN_LAST,
|
||||
gobject.TYPE_NONE,
|
||||
()),
|
||||
'build-failed' : (gobject.SIGNAL_RUN_LAST,
|
||||
gobject.TYPE_NONE,
|
||||
()),
|
||||
'build-complete' : (gobject.SIGNAL_RUN_LAST,
|
||||
gobject.TYPE_NONE,
|
||||
())
|
||||
())
|
||||
}
|
||||
pids_to_task = {}
|
||||
tasks_to_iter = {}
|
||||
|
||||
def __init__ (self, sequential=False):
|
||||
def __init__ (self):
|
||||
gobject.GObject.__init__ (self)
|
||||
self.model = RunningBuildModel()
|
||||
self.sequential = sequential
|
||||
|
||||
def reset (self):
|
||||
self.pids_to_task.clear()
|
||||
self.tasks_to_iter.clear()
|
||||
self.model.clear()
|
||||
|
||||
def handle_event (self, event, pbar=None):
|
||||
# Handle an event from the event queue, this may result in updating
|
||||
@@ -96,14 +84,7 @@ class RunningBuild (gobject.GObject):
|
||||
parent = self.tasks_to_iter[(package, task)]
|
||||
|
||||
if(isinstance(event, logging.LogRecord)):
|
||||
# FIXME: this is a hack! More info in Yocto #1433
|
||||
# http://bugzilla.pokylinux.org/show_bug.cgi?id=1433, temporarily
|
||||
# mask the error message as it's not informative for the user.
|
||||
if event.msg.startswith("Execution of event handler 'run_buildstats' failed"):
|
||||
return
|
||||
|
||||
if (event.levelno < logging.INFO or
|
||||
event.msg.startswith("Running task")):
|
||||
if (event.msg.startswith ("Running task")):
|
||||
return # don't add these to the list
|
||||
|
||||
if event.levelno >= logging.ERROR:
|
||||
@@ -118,18 +99,18 @@ class RunningBuild (gobject.GObject):
|
||||
|
||||
# if we know which package we belong to, we'll append onto its list.
|
||||
# otherwise, we'll jump to the top of the master list
|
||||
if self.sequential or not parent:
|
||||
if parent:
|
||||
tree_add = self.model.append
|
||||
else:
|
||||
tree_add = self.model.prepend
|
||||
tree_add(parent,
|
||||
(None,
|
||||
package,
|
||||
task,
|
||||
event.getMessage(),
|
||||
icon,
|
||||
color,
|
||||
0))
|
||||
(None,
|
||||
package,
|
||||
task,
|
||||
event.getMessage(),
|
||||
icon,
|
||||
color,
|
||||
0))
|
||||
|
||||
elif isinstance(event, bb.build.TaskStarted):
|
||||
(package, task) = (event._package, event._task)
|
||||
@@ -143,17 +124,13 @@ class RunningBuild (gobject.GObject):
|
||||
if ((package, None) in self.tasks_to_iter):
|
||||
parent = self.tasks_to_iter[(package, None)]
|
||||
else:
|
||||
if self.sequential:
|
||||
add = self.model.append
|
||||
else:
|
||||
add = self.model.prepend
|
||||
parent = add(None, (None,
|
||||
package,
|
||||
None,
|
||||
"Package: %s" % (package),
|
||||
None,
|
||||
Colors.OK,
|
||||
0))
|
||||
parent = self.model.prepend(None, (None,
|
||||
package,
|
||||
None,
|
||||
"Package: %s" % (package),
|
||||
None,
|
||||
Colors.OK,
|
||||
0))
|
||||
self.tasks_to_iter[(package, None)] = parent
|
||||
|
||||
# Because this parent package now has an active child mark it as
|
||||
@@ -224,7 +201,6 @@ class RunningBuild (gobject.GObject):
|
||||
|
||||
elif isinstance(event, bb.event.BuildStarted):
|
||||
|
||||
self.emit("build-started")
|
||||
self.model.prepend(None, (None,
|
||||
None,
|
||||
None,
|
||||
@@ -247,15 +223,6 @@ class RunningBuild (gobject.GObject):
|
||||
self.emit ("build-failed")
|
||||
else:
|
||||
self.emit ("build-succeeded")
|
||||
# Emit a generic "build-complete" signal for things wishing to
|
||||
# handle when the build is finished
|
||||
self.emit("build-complete")
|
||||
|
||||
elif isinstance(event, bb.command.CommandFailed):
|
||||
if event.error.startswith("Exited with"):
|
||||
# If the command fails with an exit code we're done, emit the
|
||||
# generic signal for the UI to notify the user
|
||||
self.emit("build-complete")
|
||||
|
||||
elif isinstance(event, bb.event.CacheLoadStarted) and pbar:
|
||||
pbar.set_title("Loading cache")
|
||||
@@ -265,10 +232,8 @@ class RunningBuild (gobject.GObject):
|
||||
pbar.update(event.current, self.progress_total)
|
||||
elif isinstance(event, bb.event.CacheLoadCompleted) and pbar:
|
||||
pbar.update(self.progress_total, self.progress_total)
|
||||
pbar.hide()
|
||||
|
||||
elif isinstance(event, bb.event.ParseStarted) and pbar:
|
||||
if event.total == 0:
|
||||
return
|
||||
pbar.set_title("Processing recipes")
|
||||
self.progress_total = event.total
|
||||
pbar.update(0, self.progress_total)
|
||||
@@ -295,9 +260,8 @@ class RunningBuildTreeView (gtk.TreeView):
|
||||
__gsignals__ = {
|
||||
"button_press_event" : "override"
|
||||
}
|
||||
def __init__ (self, readonly=False):
|
||||
def __init__ (self):
|
||||
gtk.TreeView.__init__ (self)
|
||||
self.readonly = readonly
|
||||
|
||||
# The icon that indicates whether we're building or failed.
|
||||
renderer = gtk.CellRendererPixbuf ()
|
||||
@@ -309,7 +273,7 @@ class RunningBuildTreeView (gtk.TreeView):
|
||||
self.message_renderer = gtk.CellRendererText ()
|
||||
self.message_column = gtk.TreeViewColumn ("Message", self.message_renderer, text=3)
|
||||
self.message_column.add_attribute(self.message_renderer, 'background', 5)
|
||||
self.message_renderer.set_property('editable', (not self.readonly))
|
||||
self.message_renderer.set_property('editable', 5)
|
||||
self.append_column (self.message_column)
|
||||
|
||||
def do_button_press_event(self, event):
|
||||
@@ -317,49 +281,31 @@ class RunningBuildTreeView (gtk.TreeView):
|
||||
|
||||
if event.button == 3:
|
||||
selection = super(RunningBuildTreeView, self).get_selection()
|
||||
(model, it) = selection.get_selected()
|
||||
if it is not None:
|
||||
can_paste = model.get(it, model.COL_LOG)[0]
|
||||
(model, iter) = selection.get_selected()
|
||||
if iter is not None:
|
||||
can_paste = model.get(iter, model.COL_LOG)[0]
|
||||
if can_paste == 'pastebin':
|
||||
# build a simple menu with a pastebin option
|
||||
menu = gtk.Menu()
|
||||
menuitem = gtk.MenuItem("Copy")
|
||||
menu.append(menuitem)
|
||||
menuitem.connect("activate", self.clipboard_handler, (model, it))
|
||||
menuitem.show()
|
||||
menuitem = gtk.MenuItem("Send log to pastebin")
|
||||
menu.append(menuitem)
|
||||
menuitem.connect("activate", self.pastebin_handler, (model, it))
|
||||
menuitem.connect("activate", self.pastebin_handler, (model, iter))
|
||||
menuitem.show()
|
||||
menu.show()
|
||||
menu.popup(None, None, None, event.button, event.time)
|
||||
|
||||
def _add_to_clipboard(self, clipping):
|
||||
"""
|
||||
Add the contents of clipping to the system clipboard.
|
||||
"""
|
||||
clipboard = gtk.clipboard_get()
|
||||
clipboard.set_text(clipping)
|
||||
clipboard.store()
|
||||
|
||||
def pastebin_handler(self, widget, data):
|
||||
"""
|
||||
Send the log data to pastebin, then add the new paste url to the
|
||||
clipboard.
|
||||
"""
|
||||
(model, it) = data
|
||||
paste_url = do_pastebin(model.get(it, model.COL_MESSAGE)[0])
|
||||
(model, iter) = data
|
||||
paste_url = do_pastebin(model.get(iter, model.COL_MESSAGE)[0])
|
||||
|
||||
# @todo Provide visual feedback to the user that it is done and that
|
||||
# it worked.
|
||||
print paste_url
|
||||
|
||||
self._add_to_clipboard(paste_url)
|
||||
|
||||
def clipboard_handler(self, widget, data):
|
||||
"""
|
||||
"""
|
||||
(model, it) = data
|
||||
message = model.get(it, model.COL_MESSAGE)[0]
|
||||
|
||||
self._add_to_clipboard(message)
|
||||
clipboard = gtk.clipboard_get()
|
||||
clipboard.set_text(paste_url)
|
||||
clipboard.store()
|
||||
@@ -20,67 +20,6 @@
|
||||
|
||||
import gtk
|
||||
import gobject
|
||||
import re
|
||||
|
||||
class BuildRep(gobject.GObject):
|
||||
|
||||
def __init__(self, userpkgs, allpkgs, base_image=None):
|
||||
gobject.GObject.__init__(self)
|
||||
self.base_image = base_image
|
||||
self.allpkgs = allpkgs
|
||||
self.userpkgs = userpkgs
|
||||
|
||||
def loadRecipe(self, pathname):
|
||||
contents = []
|
||||
packages = ""
|
||||
base_image = ""
|
||||
|
||||
with open(pathname, 'r') as f:
|
||||
contents = f.readlines()
|
||||
|
||||
pkg_pattern = "^\s*(IMAGE_INSTALL)\s*([+=.?]+)\s*(\".*?\")"
|
||||
img_pattern = "^\s*(require)\s+(\S+.bb)"
|
||||
|
||||
for line in contents:
|
||||
matchpkg = re.search(pkg_pattern, line)
|
||||
matchimg = re.search(img_pattern, line)
|
||||
if matchpkg:
|
||||
packages = packages + matchpkg.group(3).strip('"')
|
||||
if matchimg:
|
||||
base_image = os.path.basename(matchimg.group(2)).split(".")[0]
|
||||
|
||||
self.base_image = base_image
|
||||
self.userpkgs = packages
|
||||
|
||||
def writeRecipe(self, writepath, model):
|
||||
template = """
|
||||
# Recipe generated by the HOB
|
||||
|
||||
require %s
|
||||
|
||||
IMAGE_INSTALL += "%s"
|
||||
"""
|
||||
|
||||
empty_template = """
|
||||
# Recipe generated by the HOB
|
||||
|
||||
inherit core-image
|
||||
|
||||
IMAGE_INSTALL = "%s"
|
||||
"""
|
||||
if self.base_image and not self.base_image == "empty":
|
||||
meta_path = model.find_image_path(self.base_image)
|
||||
recipe = template % (meta_path, self.userpkgs)
|
||||
else:
|
||||
recipe = empty_template % self.allpkgs
|
||||
|
||||
if os.path.exists(writepath):
|
||||
os.rename(writepath, "%s~" % writepath)
|
||||
|
||||
with open(writepath, 'w') as r:
|
||||
r.write(recipe)
|
||||
|
||||
return writepath
|
||||
|
||||
class TaskListModel(gtk.ListStore):
|
||||
"""
|
||||
@@ -89,18 +28,12 @@ class TaskListModel(gtk.ListStore):
|
||||
providing convenience functions to access gtk.TreeModel subclasses which
|
||||
provide filtered views of the data.
|
||||
"""
|
||||
(COL_NAME, COL_DESC, COL_LIC, COL_GROUP, COL_DEPS, COL_BINB, COL_TYPE, COL_INC, COL_IMG, COL_PATH, COL_PN) = range(11)
|
||||
(COL_NAME, COL_DESC, COL_LIC, COL_GROUP, COL_DEPS, COL_BINB, COL_TYPE, COL_INC) = range(8)
|
||||
|
||||
__gsignals__ = {
|
||||
"tasklist-populated" : (gobject.SIGNAL_RUN_LAST,
|
||||
gobject.TYPE_NONE,
|
||||
()),
|
||||
"contents-changed" : (gobject.SIGNAL_RUN_LAST,
|
||||
gobject.TYPE_NONE,
|
||||
(gobject.TYPE_INT,)),
|
||||
"image-changed" : (gobject.SIGNAL_RUN_LAST,
|
||||
gobject.TYPE_NONE,
|
||||
(gobject.TYPE_STRING,)),
|
||||
())
|
||||
}
|
||||
|
||||
"""
|
||||
@@ -110,7 +43,6 @@ class TaskListModel(gtk.ListStore):
|
||||
self.tasks = None
|
||||
self.packages = None
|
||||
self.images = None
|
||||
self.selected_image = None
|
||||
|
||||
gtk.ListStore.__init__ (self,
|
||||
gobject.TYPE_STRING,
|
||||
@@ -120,31 +52,7 @@ class TaskListModel(gtk.ListStore):
|
||||
gobject.TYPE_STRING,
|
||||
gobject.TYPE_STRING,
|
||||
gobject.TYPE_STRING,
|
||||
gobject.TYPE_BOOLEAN,
|
||||
gobject.TYPE_BOOLEAN,
|
||||
gobject.TYPE_STRING,
|
||||
gobject.TYPE_STRING)
|
||||
|
||||
"""
|
||||
Helper method to determine whether name is a target pn
|
||||
"""
|
||||
def non_target_name(self, name):
|
||||
if ('-native' in name) or ('-cross' in name) or name.startswith('virtual/'):
|
||||
return True
|
||||
return False
|
||||
|
||||
def contents_changed_cb(self, tree_model, path, it=None):
|
||||
pkg_cnt = self.contents.iter_n_children(None)
|
||||
self.emit("contents-changed", pkg_cnt)
|
||||
|
||||
def contents_model_filter(self, model, it):
|
||||
if not model.get_value(it, self.COL_INC) or model.get_value(it, self.COL_TYPE) == 'image':
|
||||
return False
|
||||
name = model.get_value(it, self.COL_NAME)
|
||||
if self.non_target_name(name):
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
gobject.TYPE_BOOLEAN)
|
||||
|
||||
"""
|
||||
Create, if required, and return a filtered gtk.TreeModel
|
||||
@@ -154,9 +62,7 @@ class TaskListModel(gtk.ListStore):
|
||||
def contents_model(self):
|
||||
if not self.contents:
|
||||
self.contents = self.filter_new()
|
||||
self.contents.set_visible_func(self.contents_model_filter)
|
||||
self.contents.connect("row-inserted", self.contents_changed_cb)
|
||||
self.contents.connect("row-deleted", self.contents_changed_cb)
|
||||
self.contents.set_visible_column(self.COL_INC)
|
||||
return self.contents
|
||||
|
||||
"""
|
||||
@@ -201,13 +107,10 @@ class TaskListModel(gtk.ListStore):
|
||||
Helper function to determine whether an item is a package
|
||||
"""
|
||||
def package_model_filter(self, model, it):
|
||||
if model.get_value(it, self.COL_TYPE) != 'package':
|
||||
return False
|
||||
else:
|
||||
name = model.get_value(it, self.COL_NAME)
|
||||
if self.non_target_name(name):
|
||||
return False
|
||||
if model.get_value(it, self.COL_TYPE) == 'package':
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
"""
|
||||
Create, if required, and return a filtered gtk.TreeModel
|
||||
@@ -226,89 +129,33 @@ class TaskListModel(gtk.ListStore):
|
||||
to notify any listeners that the model is ready
|
||||
"""
|
||||
def populate(self, event_model):
|
||||
# First clear the model, in case repopulating
|
||||
self.clear()
|
||||
for item in event_model["pn"]:
|
||||
atype = 'package'
|
||||
name = item
|
||||
summary = event_model["pn"][item]["summary"]
|
||||
lic = event_model["pn"][item]["license"]
|
||||
license = event_model["pn"][item]["license"]
|
||||
group = event_model["pn"][item]["section"]
|
||||
filename = event_model["pn"][item]["filename"]
|
||||
if ('task-' in name):
|
||||
|
||||
depends = event_model["depends"].get(item, "")
|
||||
rdepends = event_model["rdepends-pn"].get(item, "")
|
||||
depends = depends + rdepends
|
||||
self.squish(depends)
|
||||
deps = " ".join(depends)
|
||||
|
||||
if name.count('task-') > 0:
|
||||
atype = 'task'
|
||||
elif ('-image-' in name):
|
||||
elif name.count('-image-') > 0:
|
||||
atype = 'image'
|
||||
|
||||
# Create a combined list of build and runtime dependencies and
|
||||
# then remove any duplicate entries and any entries for -dev
|
||||
# packages
|
||||
depends = event_model["depends"].get(item, [])
|
||||
rdepends = event_model["rdepends-pn"].get(item, [])
|
||||
packages = {}
|
||||
for pkg in event_model["packages"]:
|
||||
if event_model["packages"][pkg]["pn"] == name:
|
||||
deps = []
|
||||
deps.extend(depends)
|
||||
deps.extend(event_model["rdepends-pkg"].get(pkg, []))
|
||||
deps.extend(rdepends)
|
||||
deps = self.squish(deps)
|
||||
# rdepends-pn includes pn-dev
|
||||
if ("%s-dev" % item) in deps:
|
||||
deps.remove("%s-dev" % item)
|
||||
# rdepends-on includes pn
|
||||
if pkg in deps:
|
||||
deps.remove(pkg)
|
||||
packages[pkg] = deps
|
||||
|
||||
for p in packages:
|
||||
self.set(self.append(), self.COL_NAME, p, self.COL_DESC, summary,
|
||||
self.COL_LIC, lic, self.COL_GROUP, group,
|
||||
self.COL_DEPS, " ".join(packages[p]), self.COL_BINB, "",
|
||||
self.COL_TYPE, atype, self.COL_INC, False,
|
||||
self.COL_IMG, False, self.COL_PATH, filename,
|
||||
self.COL_PN, item)
|
||||
|
||||
self.set(self.append(), self.COL_NAME, name, self.COL_DESC, summary,
|
||||
self.COL_LIC, license, self.COL_GROUP, group,
|
||||
self.COL_DEPS, deps, self.COL_BINB, "",
|
||||
self.COL_TYPE, atype, self.COL_INC, False)
|
||||
|
||||
self.emit("tasklist-populated")
|
||||
|
||||
"""
|
||||
Load a BuildRep into the model
|
||||
"""
|
||||
def load_image_rep(self, rep):
|
||||
# Unset everything
|
||||
it = self.get_iter_first()
|
||||
while it:
|
||||
path = self.get_path(it)
|
||||
self[path][self.COL_INC] = False
|
||||
self[path][self.COL_IMG] = False
|
||||
it = self.iter_next(it)
|
||||
|
||||
# Iterate the images and disable them all
|
||||
it = self.images.get_iter_first()
|
||||
while it:
|
||||
path = self.images.convert_path_to_child_path(self.images.get_path(it))
|
||||
name = self[path][self.COL_NAME]
|
||||
if name == rep.base_image:
|
||||
self.include_item(path, image_contents=True)
|
||||
else:
|
||||
self[path][self.COL_INC] = False
|
||||
it = self.images.iter_next(it)
|
||||
|
||||
# Mark all of the additional packages for inclusion
|
||||
packages = rep.userpkgs.split(" ")
|
||||
it = self.get_iter_first()
|
||||
while it:
|
||||
path = self.get_path(it)
|
||||
name = self[path][self.COL_NAME]
|
||||
if name in packages:
|
||||
self.include_item(path, binb="User Selected")
|
||||
packages.remove(name)
|
||||
it = self.iter_next(it)
|
||||
|
||||
self.emit("image-changed", rep.base_image)
|
||||
|
||||
"""
|
||||
squish lst so that it doesn't contain any duplicate entries
|
||||
squish lst so that it doesn't contain any duplicates
|
||||
"""
|
||||
def squish(self, lst):
|
||||
seen = {}
|
||||
@@ -326,157 +173,132 @@ class TaskListModel(gtk.ListStore):
|
||||
self[path][self.COL_INC] = False
|
||||
|
||||
"""
|
||||
Recursively called to mark the item at opath and any package which
|
||||
depends on it for removal.
|
||||
NOTE: This method dumbly removes user selected packages and since we don't
|
||||
do significant reverse dependency tracking it's easier and simpler to save
|
||||
the items marked as user selected and re-add them once the removal sweep is
|
||||
complete.
|
||||
"""
|
||||
def mark(self, opath):
|
||||
usersel = {}
|
||||
removed = []
|
||||
|
||||
def mark(self, path):
|
||||
name = self[path][self.COL_NAME]
|
||||
it = self.get_iter_first()
|
||||
# The name of the item we're removing, so that we can use it to find
|
||||
# other items which either depend on it, or were brought in by it
|
||||
marked_name = self[opath][self.COL_NAME]
|
||||
removals = []
|
||||
#print("Removing %s" % name)
|
||||
|
||||
# Remove the passed item
|
||||
self.remove_item_path(opath)
|
||||
self.remove_item_path(path)
|
||||
|
||||
# Remove all dependent packages, update binb
|
||||
while it:
|
||||
path = self.get_path(it)
|
||||
# FIXME: need to ensure partial name matching doesn't happen, regexp?
|
||||
if self[path][self.COL_INC] and self[path][self.COL_DEPS].count(name):
|
||||
#print("%s depended on %s, marking for removal" % (self[path][self.COL_NAME], name))
|
||||
# found a dependency, remove it
|
||||
self.mark(path)
|
||||
if self[path][self.COL_INC] and self[path][self.COL_BINB].count(name):
|
||||
binb = self.find_alt_dependency(self[path][self.COL_NAME])
|
||||
#print("%s was brought in by %s, binb set to %s" % (self[path][self.COL_NAME], name, binb))
|
||||
self[path][self.COL_BINB] = binb
|
||||
it = self.iter_next(it)
|
||||
|
||||
inc = self[path][self.COL_INC]
|
||||
deps = self[path][self.COL_DEPS]
|
||||
binb = self[path][self.COL_BINB].split(', ')
|
||||
itype = self[path][self.COL_TYPE]
|
||||
itname = self[path][self.COL_NAME]
|
||||
|
||||
# We ignore anything that isn't a package
|
||||
if not itype == "package":
|
||||
continue
|
||||
|
||||
# If the user added this item and it's not the item we're removing
|
||||
# we should keep it and its dependencies, the easiest way to do so
|
||||
# is to save its name and re-mark it for inclusion once dependency
|
||||
# processing is complete
|
||||
if "User Selected" in binb:
|
||||
usersel[itname] = self[path][self.COL_IMG]
|
||||
|
||||
# If the iterated item is included and depends on the removed
|
||||
# item it should also be removed.
|
||||
# FIXME: need to ensure partial name matching doesn't happen
|
||||
if inc and marked_name in deps and itname not in removed:
|
||||
# found a dependency, remove it
|
||||
removed.append(itname)
|
||||
self.mark(path)
|
||||
|
||||
# If the iterated item was brought in by the removed (passed) item
|
||||
# try and find an alternative dependee and update the binb column
|
||||
if inc and marked_name in binb:
|
||||
binb.remove(marked_name)
|
||||
self[path][self.COL_BINB] = ', '.join(binb).lstrip(', ')
|
||||
|
||||
# Re-add any removed user selected items
|
||||
for u in usersel:
|
||||
npath = self.find_path_for_item(u)
|
||||
self.include_item(item_path=npath,
|
||||
binb="User Selected",
|
||||
image_contents=usersel[u])
|
||||
"""
|
||||
Remove items from contents if the have an empty COL_BINB (brought in by)
|
||||
caused by all packages they are a dependency of being removed.
|
||||
If the item isn't a package we leave it included.
|
||||
"""
|
||||
def sweep_up(self):
|
||||
removals = []
|
||||
it = self.get_iter_first()
|
||||
|
||||
while it:
|
||||
path = self.get_path(it)
|
||||
binb = self[path][self.COL_BINB]
|
||||
if binb == "" or binb is None:
|
||||
#print("Sweeping up %s" % self[path][self.COL_NAME])
|
||||
if not path in removals:
|
||||
removals.extend(path)
|
||||
it = self.iter_next(it)
|
||||
|
||||
while removals:
|
||||
path = removals.pop()
|
||||
self.mark(path)
|
||||
|
||||
"""
|
||||
Remove an item from the contents
|
||||
"""
|
||||
def remove_item(self, path):
|
||||
self.mark(path)
|
||||
self.sweep_up()
|
||||
|
||||
"""
|
||||
Find the name of an item in the image contents which depends on the item
|
||||
at contents_path returns either an item name (str) or None
|
||||
NOTE:
|
||||
contents_path must be a path in the self.contents gtk.TreeModel
|
||||
"""
|
||||
def find_alt_dependency(self, name):
|
||||
it = self.get_iter_first()
|
||||
while it:
|
||||
# iterate all items in the model
|
||||
path = self.get_path(it)
|
||||
deps = self[path][self.COL_DEPS]
|
||||
itname = self[path][self.COL_NAME]
|
||||
inc = self[path][self.COL_INC]
|
||||
if itname != name and inc and deps.count(name) > 0:
|
||||
# if this item depends on the item, return this items name
|
||||
#print("%s depends on %s" % (itname, name))
|
||||
return itname
|
||||
it = self.iter_next(it)
|
||||
return ""
|
||||
|
||||
"""
|
||||
Convert a path in self to a path in the filtered contents model
|
||||
"""
|
||||
def contents_path_for_path(self, path):
|
||||
return self.contents.convert_child_path_to_path(path)
|
||||
|
||||
"""
|
||||
Check the self.contents gtk.TreeModel for an item
|
||||
where COL_NAME matches item_name
|
||||
Returns True if a match is found, False otherwise
|
||||
"""
|
||||
def contents_includes_name(self, item_name):
|
||||
it = self.contents.get_iter_first()
|
||||
while it:
|
||||
binb = self.contents.get_value(it, self.COL_BINB)
|
||||
itype = self.contents.get_value(it, self.COL_TYPE)
|
||||
remove = False
|
||||
|
||||
if itype == 'package' and not binb:
|
||||
oit = self.contents.convert_iter_to_child_iter(it)
|
||||
opath = self.get_path(oit)
|
||||
self.mark(opath)
|
||||
remove = True
|
||||
|
||||
# When we remove a package from the contents model we alter the
|
||||
# model, so continuing to iterate is bad. *Furthermore* it's
|
||||
# likely that the removal has affected an already iterated item
|
||||
# so we should start from the beginning anyway.
|
||||
# Only when we've managed to iterate the entire contents model
|
||||
# without removing any items do we allow the loop to exit.
|
||||
if remove:
|
||||
it = self.contents.get_iter_first()
|
||||
else:
|
||||
it = self.contents.iter_next(it)
|
||||
|
||||
"""
|
||||
Check whether the item at item_path is included or not
|
||||
"""
|
||||
def contents_includes_path(self, item_path):
|
||||
return self[item_path][self.COL_INC]
|
||||
path = self.contents.get_path(it)
|
||||
if self.contents[path][self.COL_NAME] == item_name:
|
||||
return True
|
||||
it = self.contents.iter_next(it)
|
||||
return False
|
||||
|
||||
"""
|
||||
Add this item, and any of its dependencies, to the image contents
|
||||
"""
|
||||
def include_item(self, item_path, binb="", image_contents=False):
|
||||
item_name = self[item_path][self.COL_NAME]
|
||||
item_deps = self[item_path][self.COL_DEPS]
|
||||
|
||||
self[item_path][self.COL_INC] = True
|
||||
|
||||
item_bin = self[item_path][self.COL_BINB].split(', ')
|
||||
if binb and not binb in item_bin:
|
||||
item_bin.append(binb)
|
||||
self[item_path][self.COL_BINB] = ', '.join(item_bin).lstrip(', ')
|
||||
|
||||
# We want to do some magic with things which are brought in by the
|
||||
# base image so tag them as so
|
||||
if image_contents:
|
||||
self[item_path][self.COL_IMG] = True
|
||||
if self[item_path][self.COL_TYPE] == 'image':
|
||||
self.selected_image = item_name
|
||||
|
||||
if item_deps:
|
||||
# Ensure all of the items deps are included and, where appropriate,
|
||||
# add this item to their COL_BINB
|
||||
for dep in item_deps.split(" "):
|
||||
def include_item(self, item_path, binb=""):
|
||||
name = self[item_path][self.COL_NAME]
|
||||
deps = self[item_path][self.COL_DEPS]
|
||||
cur_inc = self[item_path][self.COL_INC]
|
||||
#print("Adding %s for %s dependency" % (name, binb))
|
||||
if not cur_inc:
|
||||
self[item_path][self.COL_INC] = True
|
||||
self[item_path][self.COL_BINB] = binb
|
||||
if deps:
|
||||
#print("Dependencies of %s are %s" % (name, deps))
|
||||
# add all of the deps and set their binb to this item
|
||||
for dep in deps.split(" "):
|
||||
# FIXME: this skipping virtuals can't be right? Unless we choose only to show target
|
||||
# packages? In which case we should handle this server side...
|
||||
# If the contents model doesn't already contain dep, add it
|
||||
dep_path = self.find_path_for_item(dep)
|
||||
if not dep_path:
|
||||
continue
|
||||
dep_included = self.contents_includes_path(dep_path)
|
||||
|
||||
if dep_included and not dep in item_bin:
|
||||
# don't set the COL_BINB to this item if the target is an
|
||||
# item in our own COL_BINB
|
||||
dep_bin = self[dep_path][self.COL_BINB].split(', ')
|
||||
if not item_name in dep_bin:
|
||||
dep_bin.append(item_name)
|
||||
self[dep_path][self.COL_BINB] = ', '.join(dep_bin).lstrip(', ')
|
||||
elif not dep_included:
|
||||
self.include_item(dep_path, binb=item_name, image_contents=image_contents)
|
||||
if not dep.startswith("virtual") and not self.contents_includes_name(dep):
|
||||
path = self.find_path_for_item(dep)
|
||||
if path:
|
||||
self.include_item(path, name)
|
||||
else:
|
||||
pass
|
||||
|
||||
"""
|
||||
Find the model path for the item_name
|
||||
Returns the path in the model or None
|
||||
"""
|
||||
def find_path_for_item(self, item_name):
|
||||
# We don't include virtual/* or *-native items in the model so save a
|
||||
# heavy iteration loop by exiting early for these items
|
||||
if self.non_target_name(item_name):
|
||||
return None
|
||||
|
||||
it = self.get_iter_first()
|
||||
path = None
|
||||
while it:
|
||||
if (self.get_value(it, self.COL_NAME) == item_name):
|
||||
return self.get_path(it)
|
||||
path = self.get_path(it)
|
||||
if (self[path][self.COL_NAME] == item_name):
|
||||
return path
|
||||
else:
|
||||
it = self.iter_next(it)
|
||||
return None
|
||||
@@ -485,136 +307,40 @@ class TaskListModel(gtk.ListStore):
|
||||
Empty self.contents by setting the include of each entry to None
|
||||
"""
|
||||
def reset(self):
|
||||
# Deselect images - slightly more complex logic so that we don't
|
||||
# have to iterate all of the contents of the main model, instead
|
||||
# just iterate the images model.
|
||||
if self.selected_image:
|
||||
iit = self.images.get_iter_first()
|
||||
while iit:
|
||||
pit = self.images.convert_iter_to_child_iter(iit)
|
||||
self.set(pit, self.COL_INC, False)
|
||||
iit = self.images.iter_next(iit)
|
||||
self.selected_image = None
|
||||
|
||||
it = self.contents.get_iter_first()
|
||||
while it:
|
||||
oit = self.contents.convert_iter_to_child_iter(it)
|
||||
self.set(oit,
|
||||
self.COL_INC, False,
|
||||
self.COL_BINB, "",
|
||||
self.COL_IMG, False)
|
||||
path = self.contents.get_path(it)
|
||||
opath = self.contents.convert_path_to_child_path(path)
|
||||
self[opath][self.COL_INC] = False
|
||||
self[opath][self.COL_BINB] = ""
|
||||
# As we've just removed the first item...
|
||||
it = self.contents.get_iter_first()
|
||||
|
||||
"""
|
||||
Returns two lists. One of user selected packages and the other containing
|
||||
all selected packages
|
||||
Returns True if one of the selected tasks is an image, False otherwise
|
||||
"""
|
||||
def get_selected_packages(self):
|
||||
allpkgs = []
|
||||
userpkgs = []
|
||||
|
||||
it = self.contents.get_iter_first()
|
||||
def targets_contains_image(self):
|
||||
it = self.images.get_iter_first()
|
||||
while it:
|
||||
sel = "User Selected" in self.contents.get_value(it, self.COL_BINB)
|
||||
name = self.contents.get_value(it, self.COL_NAME)
|
||||
allpkgs.append(name)
|
||||
if sel:
|
||||
userpkgs.append(name)
|
||||
it = self.contents.iter_next(it)
|
||||
return userpkgs, allpkgs
|
||||
|
||||
"""
|
||||
Return a squished (uniquified) list of the PN's of all selected items
|
||||
"""
|
||||
def get_selected_pn(self):
|
||||
pns = []
|
||||
|
||||
it = self.contents.get_iter_first()
|
||||
while it:
|
||||
if self.contents.get_value(it, self.COL_BINB):
|
||||
pns.append(self.contents.get_value(it, self.COL_PN))
|
||||
it = self.contents.iter_next(it)
|
||||
|
||||
return self.squish(pns)
|
||||
|
||||
def image_contents_removed(self):
|
||||
it = self.get_iter_first()
|
||||
while it:
|
||||
sel = self.get_value(it, self.COL_INC)
|
||||
img = self.get_value(it, self.COL_IMG)
|
||||
if img and not sel:
|
||||
path = self.images.get_path(it)
|
||||
inc = self.images[path][self.COL_INC]
|
||||
if inc:
|
||||
return True
|
||||
it = self.iter_next(it)
|
||||
it = self.images.iter_next(it)
|
||||
return False
|
||||
|
||||
def get_build_rep(self):
|
||||
userpkgs, allpkgs = self.get_selected_packages()
|
||||
# If base image contents have been removed start from an empty rootfs
|
||||
if not self.selected_image or self.image_contents_removed():
|
||||
image = "empty"
|
||||
else:
|
||||
image = self.selected_image
|
||||
"""
|
||||
Return a list of all selected items which are not -native or -cross
|
||||
"""
|
||||
def get_targets(self):
|
||||
tasks = []
|
||||
|
||||
return BuildRep(" ".join(userpkgs), " ".join(allpkgs), image)
|
||||
|
||||
def find_reverse_depends(self, pn):
|
||||
revdeps = []
|
||||
it = self.contents.get_iter_first()
|
||||
|
||||
while it:
|
||||
name = self.contents.get_value(it, self.COL_NAME)
|
||||
itype = self.contents.get_value(it, self.COL_TYPE)
|
||||
deps = self.contents.get_value(it, self.COL_DEPS)
|
||||
|
||||
path = self.contents.get_path(it)
|
||||
name = self.contents[path][self.COL_NAME]
|
||||
stype = self.contents[path][self.COL_TYPE]
|
||||
if not name.count('-native') and not name.count('-cross'):
|
||||
tasks.append(name)
|
||||
it = self.contents.iter_next(it)
|
||||
|
||||
if not itype == 'package':
|
||||
continue
|
||||
|
||||
if pn in deps:
|
||||
revdeps.append(name)
|
||||
|
||||
if pn in revdeps:
|
||||
revdeps.remove(pn)
|
||||
return revdeps
|
||||
|
||||
def set_selected_image(self, img):
|
||||
self.selected_image = img
|
||||
path = self.find_path_for_item(img)
|
||||
self.include_item(item_path=path,
|
||||
binb="User Selected",
|
||||
image_contents=True)
|
||||
|
||||
self.emit("image-changed", self.selected_image)
|
||||
|
||||
def set_selected_packages(self, pkglist):
|
||||
selected = pkglist
|
||||
it = self.get_iter_first()
|
||||
|
||||
while it:
|
||||
name = self.get_value(it, self.COL_NAME)
|
||||
if name in pkglist:
|
||||
pkglist.remove(name)
|
||||
path = self.get_path(it)
|
||||
self.include_item(item_path=path,
|
||||
binb="User Selected")
|
||||
if len(pkglist) == 0:
|
||||
return
|
||||
it = self.iter_next(it)
|
||||
|
||||
def find_image_path(self, image):
|
||||
it = self.images.get_iter_first()
|
||||
|
||||
while it:
|
||||
image_name = self.images.get_value(it, self.COL_NAME)
|
||||
if image_name == image:
|
||||
path = self.images.get_value(it, self.COL_PATH)
|
||||
meta_pattern = "(\S*)/(meta*/)(\S*)"
|
||||
meta_match = re.search(meta_pattern, path)
|
||||
if meta_match:
|
||||
_, lyr, bbrel = path.partition(meta_match.group(2))
|
||||
if bbrel:
|
||||
path = bbrel
|
||||
return path
|
||||
it = self.images.iter_next(it)
|
||||
return tasks
|
||||
|
||||
@@ -199,13 +199,10 @@ class gtkthread(threading.Thread):
|
||||
def main(server, eventHandler):
|
||||
try:
|
||||
cmdline = server.runCommand(["getCmdLineAction"])
|
||||
if cmdline and not cmdline['action']:
|
||||
print(cmdline['msg'])
|
||||
return
|
||||
elif not cmdline or (cmdline['action'] and cmdline['action'][0] != "generateDotGraph"):
|
||||
if not cmdline or cmdline[0] != "generateDotGraph":
|
||||
print("This UI is only compatible with the -g option")
|
||||
return
|
||||
ret = server.runCommand(["generateDepTreeEvent", cmdline['action'][1], cmdline['action'][2]])
|
||||
ret = server.runCommand(["generateDepTreeEvent", cmdline[1], cmdline[2]])
|
||||
if ret != True:
|
||||
print("Couldn't run command! %s" % ret)
|
||||
return
|
||||
@@ -250,13 +247,13 @@ def main(server, eventHandler):
|
||||
continue
|
||||
|
||||
if isinstance(event, bb.event.CacheLoadCompleted):
|
||||
pbar.hide()
|
||||
gtk.gdk.threads_enter()
|
||||
pbar.update(progress_total, progress_total)
|
||||
gtk.gdk.threads_leave()
|
||||
continue
|
||||
|
||||
if isinstance(event, bb.event.ParseStarted):
|
||||
progress_total = event.total
|
||||
if progress_total == 0:
|
||||
continue
|
||||
gtk.gdk.threads_enter()
|
||||
pbar.set_title("Processing recipes")
|
||||
pbar.update(0, progress_total)
|
||||
|
||||
@@ -82,12 +82,8 @@ def main (server, eventHandler):
|
||||
try:
|
||||
cmdline = server.runCommand(["getCmdLineAction"])
|
||||
if not cmdline:
|
||||
print("Nothing to do. Use 'bitbake world' to build everything, or run 'bitbake --help' for usage information.")
|
||||
return 1
|
||||
elif not cmdline['action']:
|
||||
print(cmdline['msg'])
|
||||
return 1
|
||||
ret = server.runCommand(cmdline['action'])
|
||||
ret = server.runCommand(cmdline)
|
||||
if ret != True:
|
||||
print("Couldn't get default commandline! %s" % ret)
|
||||
return 1
|
||||
|
||||
@@ -69,30 +69,19 @@ def main(server, eventHandler):
|
||||
# Get values of variables which control our output
|
||||
includelogs = server.runCommand(["getVariable", "BBINCLUDELOGS"])
|
||||
loglines = server.runCommand(["getVariable", "BBINCLUDELOGS_LINES"])
|
||||
consolelogfile = server.runCommand(["getVariable", "BB_CONSOLELOG"])
|
||||
|
||||
helper = uihelper.BBUIHelper()
|
||||
|
||||
console = logging.StreamHandler(sys.stdout)
|
||||
format = bb.msg.BBLogFormatter("%(levelname)s: %(message)s")
|
||||
bb.msg.addDefaultlogFilter(console)
|
||||
console.setFormatter(format)
|
||||
logger.addHandler(console)
|
||||
if consolelogfile:
|
||||
consolelog = logging.FileHandler(consolelogfile)
|
||||
bb.msg.addDefaultlogFilter(consolelog)
|
||||
consolelog.setFormatter(format)
|
||||
logger.addHandler(consolelog)
|
||||
|
||||
try:
|
||||
cmdline = server.runCommand(["getCmdLineAction"])
|
||||
if not cmdline:
|
||||
print("Nothing to do. Use 'bitbake world' to build everything, or run 'bitbake --help' for usage information.")
|
||||
return 1
|
||||
elif not cmdline['action']:
|
||||
print(cmdline['msg'])
|
||||
return 1
|
||||
ret = server.runCommand(cmdline['action'])
|
||||
ret = server.runCommand(cmdline)
|
||||
if ret != True:
|
||||
print("Couldn't get default commandline! %s" % ret)
|
||||
return 1
|
||||
@@ -127,8 +116,8 @@ def main(server, eventHandler):
|
||||
# For "normal" logging conditions, don't show note logs from tasks
|
||||
# but do show them if the user has changed the default log level to
|
||||
# include verbose/debug messages
|
||||
#if logger.getEffectiveLevel() > format.VERBOSE:
|
||||
if event.taskpid != 0 and event.levelno <= format.NOTE:
|
||||
if logger.getEffectiveLevel() > format.VERBOSE:
|
||||
if event.taskpid != 0 and event.levelno <= format.NOTE:
|
||||
continue
|
||||
logger.handle(event)
|
||||
continue
|
||||
@@ -161,17 +150,12 @@ def main(server, eventHandler):
|
||||
logger.info(event._message)
|
||||
continue
|
||||
if isinstance(event, bb.event.ParseStarted):
|
||||
if event.total == 0:
|
||||
continue
|
||||
parseprogress = new_progress("Parsing recipes", event.total).start()
|
||||
continue
|
||||
if isinstance(event, bb.event.ParseProgress):
|
||||
parseprogress.update(event.current)
|
||||
continue
|
||||
if isinstance(event, bb.event.ParseCompleted):
|
||||
if not parseprogress:
|
||||
continue
|
||||
|
||||
parseprogress.finish()
|
||||
print(("Parsing of %d .bb files complete (%d cached, %d parsed). %d targets, %d skipped, %d masked, %d errors."
|
||||
% ( event.total, event.cached, event.parsed, event.virtuals, event.skipped, event.masked, event.errors)))
|
||||
@@ -195,8 +179,7 @@ def main(server, eventHandler):
|
||||
logger.error("Command execution failed: %s", event.error)
|
||||
break
|
||||
if isinstance(event, bb.command.CommandExit):
|
||||
if not return_value:
|
||||
return_value = event.exitcode
|
||||
return_value = event.exitcode
|
||||
continue
|
||||
if isinstance(event, bb.cooker.CookerExit):
|
||||
break
|
||||
@@ -207,7 +190,6 @@ def main(server, eventHandler):
|
||||
logger.info("consider defining a PREFERRED_PROVIDER entry to match %s", event._item)
|
||||
continue
|
||||
if isinstance(event, bb.event.NoProvider):
|
||||
return_value = 1
|
||||
if event._runtime:
|
||||
r = "R"
|
||||
else:
|
||||
@@ -217,9 +199,6 @@ def main(server, eventHandler):
|
||||
logger.error("Nothing %sPROVIDES '%s' (but %s %sDEPENDS on or otherwise requires it)", r, event._item, ", ".join(event._dependees), r)
|
||||
else:
|
||||
logger.error("Nothing %sPROVIDES '%s'", r, event._item)
|
||||
if event._reasons:
|
||||
for reason in event._reasons:
|
||||
logger.error("%s", reason)
|
||||
continue
|
||||
|
||||
if isinstance(event, bb.runqueue.runQueueTaskStarted):
|
||||
@@ -244,7 +223,6 @@ def main(server, eventHandler):
|
||||
bb.event.StampUpdate,
|
||||
bb.event.ConfigParsed,
|
||||
bb.event.RecipeParsed,
|
||||
bb.event.RecipePreFinalise,
|
||||
bb.runqueue.runQueueEvent,
|
||||
bb.runqueue.runQueueExitWait)):
|
||||
continue
|
||||
|
||||
@@ -232,12 +232,8 @@ class NCursesUI:
|
||||
try:
|
||||
cmdline = server.runCommand(["getCmdLineAction"])
|
||||
if not cmdline:
|
||||
print("Nothing to do. Use 'bitbake world' to build everything, or run 'bitbake --help' for usage information.")
|
||||
return
|
||||
elif not cmdline['action']:
|
||||
print(cmdline['msg'])
|
||||
return
|
||||
ret = server.runCommand(cmdline['action'])
|
||||
ret = server.runCommand(cmdline)
|
||||
if ret != True:
|
||||
print("Couldn't get default commandlind! %s" % ret)
|
||||
return
|
||||
@@ -283,7 +279,7 @@ class NCursesUI:
|
||||
# if isinstance(event, bb.build.TaskFailed):
|
||||
# if event.logfile:
|
||||
# if data.getVar("BBINCLUDELOGS", d):
|
||||
# bb.error("log data follows (%s)" % logfile)
|
||||
# bb.msg.error(bb.msg.domain.Build, "log data follows (%s)" % logfile)
|
||||
# number_of_lines = data.getVar("BBINCLUDELOGS_LINES", d)
|
||||
# if number_of_lines:
|
||||
# os.system('tail -n%s %s' % (number_of_lines, logfile))
|
||||
@@ -297,7 +293,7 @@ class NCursesUI:
|
||||
# print '| %s' % l
|
||||
# f.close()
|
||||
# else:
|
||||
# bb.error("see log in %s" % logfile)
|
||||
# bb.msg.error(bb.msg.domain.Build, "see log in %s" % logfile)
|
||||
|
||||
if isinstance(event, bb.command.CommandCompleted):
|
||||
# stop so the user can see the result of the build, but
|
||||
|
||||
@@ -76,7 +76,7 @@ class BBUIEventQueue:
|
||||
self.host, self.port = server.socket.getsockname()
|
||||
|
||||
server.register_function( self.system_quit, "event.quit" )
|
||||
server.register_function( self.send_event, "event.sendpickle" )
|
||||
server.register_function( self.send_event, "event.send" )
|
||||
server.socket.settimeout(1)
|
||||
|
||||
self.EventHandle = self.BBServer.registerEventHandler(self.host, self.port)
|
||||
|
||||
@@ -402,7 +402,7 @@ def fileslocked(files):
|
||||
for lock in locks:
|
||||
bb.utils.unlockfile(lock)
|
||||
|
||||
def lockfile(name, shared=False, retry=True):
|
||||
def lockfile(name, shared=False):
|
||||
"""
|
||||
Use the file fn as a lock file, return when the lock has been acquired.
|
||||
Returns a variable to pass to unlockfile().
|
||||
@@ -418,8 +418,6 @@ def lockfile(name, shared=False, retry=True):
|
||||
op = fcntl.LOCK_EX
|
||||
if shared:
|
||||
op = fcntl.LOCK_SH
|
||||
if not retry:
|
||||
op = op | fcntl.LOCK_NB
|
||||
|
||||
while True:
|
||||
# If we leave the lockfiles lying around there is no problem
|
||||
@@ -443,9 +441,7 @@ def lockfile(name, shared=False, retry=True):
|
||||
return lf
|
||||
lf.close()
|
||||
except Exception:
|
||||
pass
|
||||
if not retry:
|
||||
return None
|
||||
continue
|
||||
|
||||
def unlockfile(lf):
|
||||
"""
|
||||
@@ -505,6 +501,7 @@ def preserved_envvars_exported():
|
||||
'SHELL',
|
||||
'TERM',
|
||||
'USER',
|
||||
'USERNAME',
|
||||
]
|
||||
|
||||
def preserved_envvars_exported_interactive():
|
||||
@@ -562,29 +559,20 @@ def filter_environment(good_vars):
|
||||
|
||||
def create_interactive_env(d):
|
||||
for k in preserved_envvars_exported_interactive():
|
||||
os.setenv(k, d.getVar(k, True))
|
||||
|
||||
def approved_variables():
|
||||
"""
|
||||
Determine and return the list of whitelisted variables which are approved
|
||||
to remain in the envrionment.
|
||||
"""
|
||||
approved = []
|
||||
if 'BB_ENV_WHITELIST' in os.environ:
|
||||
approved = os.environ['BB_ENV_WHITELIST'].split()
|
||||
else:
|
||||
approved = preserved_envvars()
|
||||
if 'BB_ENV_EXTRAWHITE' in os.environ:
|
||||
approved.extend(os.environ['BB_ENV_EXTRAWHITE'].split())
|
||||
return approved
|
||||
os.setenv(k, bb.data.getVar(k, d, True))
|
||||
|
||||
def clean_environment():
|
||||
"""
|
||||
Clean up any spurious environment variables. This will remove any
|
||||
variables the user hasn't chosen to preserve.
|
||||
variables the user hasn't chose to preserve.
|
||||
"""
|
||||
if 'BB_PRESERVE_ENV' not in os.environ:
|
||||
good_vars = approved_variables()
|
||||
if 'BB_ENV_WHITELIST' in os.environ:
|
||||
good_vars = os.environ['BB_ENV_WHITELIST'].split()
|
||||
else:
|
||||
good_vars = preserved_envvars()
|
||||
if 'BB_ENV_EXTRAWHITE' in os.environ:
|
||||
good_vars.extend(os.environ['BB_ENV_EXTRAWHITE'].split())
|
||||
filter_environment(good_vars)
|
||||
|
||||
def empty_environment():
|
||||
@@ -601,9 +589,9 @@ def build_environment(d):
|
||||
"""
|
||||
import bb.data
|
||||
for var in bb.data.keys(d):
|
||||
export = d.getVarFlag(var, "export")
|
||||
export = bb.data.getVarFlag(var, "export", d)
|
||||
if export:
|
||||
os.environ[var] = d.getVar(var, True) or ""
|
||||
os.environ[var] = bb.data.getVar(var, d, True) or ""
|
||||
|
||||
def remove(path, recurse=False):
|
||||
"""Equivalent to rm -f or rm -rf"""
|
||||
@@ -838,6 +826,21 @@ def which(path, item, direction = 0):
|
||||
|
||||
return ""
|
||||
|
||||
def init_logger(logger, verbose, debug, debug_domains):
|
||||
"""
|
||||
Set verbosity and debug levels in the logger
|
||||
"""
|
||||
|
||||
if debug:
|
||||
bb.msg.set_debug_level(debug)
|
||||
elif verbose:
|
||||
bb.msg.set_verbose(True)
|
||||
else:
|
||||
bb.msg.set_debug_level(0)
|
||||
|
||||
if debug_domains:
|
||||
bb.msg.set_debug_domains(debug_domains)
|
||||
|
||||
def to_boolean(string, default=None):
|
||||
if not string:
|
||||
return default
|
||||
@@ -849,16 +852,3 @@ def to_boolean(string, default=None):
|
||||
return False
|
||||
else:
|
||||
raise ValueError("Invalid value for to_boolean: %s" % string)
|
||||
|
||||
def contains(variable, checkvalues, truevalue, falsevalue, d):
|
||||
val = d.getVar(variable, True)
|
||||
if not val:
|
||||
return falsevalue
|
||||
val = set(val.split())
|
||||
if isinstance(checkvalues, basestring):
|
||||
checkvalues = set(checkvalues.split())
|
||||
else:
|
||||
checkvalues = set(checkvalues)
|
||||
if checkvalues.issubset(val):
|
||||
return truevalue
|
||||
return falsevalue
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
__version__ = "1.0.0"
|
||||
|
||||
import os, time
|
||||
import sys,logging
|
||||
|
||||
def init_logger(logfile, loglevel):
|
||||
numeric_level = getattr(logging, loglevel.upper(), None)
|
||||
if not isinstance(numeric_level, int):
|
||||
raise ValueError('Invalid log level: %s' % loglevel)
|
||||
logging.basicConfig(level=numeric_level, filename=logfile)
|
||||
|
||||
@@ -1,100 +0,0 @@
|
||||
import logging
|
||||
import os.path
|
||||
import errno
|
||||
import sys
|
||||
import warnings
|
||||
import sqlite3
|
||||
|
||||
try:
|
||||
import sqlite3
|
||||
except ImportError:
|
||||
from pysqlite2 import dbapi2 as sqlite3
|
||||
|
||||
sqlversion = sqlite3.sqlite_version_info
|
||||
if sqlversion[0] < 3 or (sqlversion[0] == 3 and sqlversion[1] < 3):
|
||||
raise Exception("sqlite3 version 3.3.0 or later is required.")
|
||||
|
||||
class NotFoundError(StandardError):
|
||||
pass
|
||||
|
||||
class PRTable():
|
||||
def __init__(self,cursor,table):
|
||||
self.cursor = cursor
|
||||
self.table = table
|
||||
|
||||
#create the table
|
||||
self._execute("CREATE TABLE IF NOT EXISTS %s \
|
||||
(version TEXT NOT NULL, \
|
||||
checksum TEXT NOT NULL, \
|
||||
value INTEGER, \
|
||||
PRIMARY KEY (version,checksum));"
|
||||
% table)
|
||||
|
||||
def _execute(self, *query):
|
||||
"""Execute a query, waiting to acquire a lock if necessary"""
|
||||
count = 0
|
||||
while True:
|
||||
try:
|
||||
return self.cursor.execute(*query)
|
||||
except sqlite3.OperationalError as exc:
|
||||
if 'database is locked' in str(exc) and count < 500:
|
||||
count = count + 1
|
||||
continue
|
||||
raise
|
||||
except sqlite3.IntegrityError as exc:
|
||||
print "Integrity error %s" % str(exc)
|
||||
break
|
||||
|
||||
def getValue(self, version, checksum):
|
||||
data=self._execute("SELECT value FROM %s WHERE version=? AND checksum=?;" % self.table,
|
||||
(version,checksum))
|
||||
row=data.fetchone()
|
||||
if row != None:
|
||||
return row[0]
|
||||
else:
|
||||
#no value found, try to insert
|
||||
self._execute("INSERT INTO %s VALUES (?, ?, (select ifnull(max(value)+1,0) from %s where version=?));"
|
||||
% (self.table,self.table),
|
||||
(version,checksum,version))
|
||||
data=self._execute("SELECT value FROM %s WHERE version=? AND checksum=?;" % self.table,
|
||||
(version,checksum))
|
||||
row=data.fetchone()
|
||||
if row != None:
|
||||
return row[0]
|
||||
else:
|
||||
raise NotFoundError
|
||||
|
||||
class PRData(object):
|
||||
"""Object representing the PR database"""
|
||||
def __init__(self, filename):
|
||||
self.filename=os.path.abspath(filename)
|
||||
#build directory hierarchy
|
||||
try:
|
||||
os.makedirs(os.path.dirname(self.filename))
|
||||
except OSError as e:
|
||||
if e.errno != errno.EEXIST:
|
||||
raise e
|
||||
self.connection=sqlite3.connect(self.filename, timeout=5,
|
||||
isolation_level=None)
|
||||
self.cursor=self.connection.cursor()
|
||||
self._tables={}
|
||||
|
||||
def __del__(self):
|
||||
print "PRData: closing DB %s" % self.filename
|
||||
self.connection.close()
|
||||
|
||||
def __getitem__(self,tblname):
|
||||
if not isinstance(tblname, basestring):
|
||||
raise TypeError("tblname argument must be a string, not '%s'" %
|
||||
type(tblname))
|
||||
if tblname in self._tables:
|
||||
return self._tables[tblname]
|
||||
else:
|
||||
tableobj = self._tables[tblname] = PRTable(self.cursor, tblname)
|
||||
return tableobj
|
||||
|
||||
def __delitem__(self, tblname):
|
||||
if tblname in self._tables:
|
||||
del self._tables[tblname]
|
||||
logging.info("drop table %s" % (tblname))
|
||||
self.cursor.execute("DROP TABLE IF EXISTS %s;" % tblname)
|
||||
@@ -1,198 +0,0 @@
|
||||
import os,sys,logging
|
||||
import signal,time, atexit
|
||||
from SimpleXMLRPCServer import SimpleXMLRPCServer, SimpleXMLRPCRequestHandler
|
||||
import xmlrpclib,sqlite3
|
||||
|
||||
import bb.server.xmlrpc
|
||||
import prserv
|
||||
import prserv.db
|
||||
|
||||
if sys.hexversion < 0x020600F0:
|
||||
print("Sorry, python 2.6 or later is required.")
|
||||
sys.exit(1)
|
||||
|
||||
class Handler(SimpleXMLRPCRequestHandler):
|
||||
def _dispatch(self,method,params):
|
||||
try:
|
||||
value=self.server.funcs[method](*params)
|
||||
except:
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
raise
|
||||
return value
|
||||
|
||||
class PRServer(SimpleXMLRPCServer):
|
||||
pidfile="/tmp/PRServer.pid"
|
||||
def __init__(self, dbfile, logfile, interface, daemon=True):
|
||||
''' constructor '''
|
||||
SimpleXMLRPCServer.__init__(self, interface,
|
||||
requestHandler=SimpleXMLRPCRequestHandler,
|
||||
logRequests=False, allow_none=True)
|
||||
self.dbfile=dbfile
|
||||
self.daemon=daemon
|
||||
self.logfile=logfile
|
||||
self.host, self.port = self.socket.getsockname()
|
||||
self.db=prserv.db.PRData(dbfile)
|
||||
self.table=self.db["PRMAIN"]
|
||||
|
||||
self.register_function(self.getPR, "getPR")
|
||||
self.register_function(self.quit, "quit")
|
||||
self.register_function(self.ping, "ping")
|
||||
self.register_introspection_functions()
|
||||
|
||||
def ping(self):
|
||||
return not self.quit
|
||||
|
||||
def getPR(self, version, checksum):
|
||||
try:
|
||||
return self.table.getValue(version,checksum)
|
||||
except prserv.NotFoundError:
|
||||
logging.error("can not find value for (%s, %s)",version,checksum)
|
||||
return None
|
||||
except sqlite3.Error as exc:
|
||||
logging.error(str(exc))
|
||||
return None
|
||||
|
||||
def quit(self):
|
||||
self.quit=True
|
||||
return
|
||||
|
||||
def _serve_forever(self):
|
||||
self.quit = False
|
||||
self.timeout = 0.5
|
||||
while not self.quit:
|
||||
self.handle_request()
|
||||
|
||||
logging.info("PRServer: stopping...")
|
||||
self.server_close()
|
||||
return
|
||||
|
||||
def start(self):
|
||||
if self.daemon is True:
|
||||
logging.info("PRServer: starting daemon...")
|
||||
self.daemonize()
|
||||
else:
|
||||
logging.info("PRServer: starting...")
|
||||
self._serve_forever()
|
||||
|
||||
def delpid(self):
|
||||
os.remove(PRServer.pidfile)
|
||||
|
||||
def daemonize(self):
|
||||
"""
|
||||
See Advanced Programming in the UNIX, Sec 13.3
|
||||
"""
|
||||
os.umask(0)
|
||||
|
||||
try:
|
||||
pid = os.fork()
|
||||
if pid > 0:
|
||||
sys.exit(0)
|
||||
except OSError as e:
|
||||
sys.stderr.write("1st fork failed: %d %s\n" % (e.errno, e.strerror))
|
||||
sys.exit(1)
|
||||
|
||||
os.setsid()
|
||||
"""
|
||||
fork again to make sure the daemon is not session leader,
|
||||
which prevents it from acquiring controlling terminal
|
||||
"""
|
||||
try:
|
||||
pid = os.fork()
|
||||
if pid > 0: #parent
|
||||
sys.exit(0)
|
||||
except OSError as e:
|
||||
sys.stderr.write("2nd fork failed: %d %s\n" % (e.errno, e.strerror))
|
||||
sys.exit(1)
|
||||
|
||||
os.chdir("/")
|
||||
|
||||
sys.stdout.flush()
|
||||
sys.stderr.flush()
|
||||
si = file('/dev/null', 'r')
|
||||
so = file(self.logfile, 'a+')
|
||||
se = so
|
||||
os.dup2(si.fileno(),sys.stdin.fileno())
|
||||
os.dup2(so.fileno(),sys.stdout.fileno())
|
||||
os.dup2(se.fileno(),sys.stderr.fileno())
|
||||
|
||||
# write pidfile
|
||||
atexit.register(self.delpid)
|
||||
pid = str(os.getpid())
|
||||
pf = file(PRServer.pidfile, 'w+')
|
||||
pf.write("%s\n" % pid)
|
||||
pf.write("%s\n" % self.host)
|
||||
pf.write("%s\n" % self.port)
|
||||
pf.close()
|
||||
|
||||
self._serve_forever()
|
||||
|
||||
class PRServerConnection():
|
||||
def __init__(self, host, port):
|
||||
self.connection = bb.server.xmlrpc._create_server(host, port)
|
||||
self.host = host
|
||||
self.port = port
|
||||
|
||||
def terminate(self):
|
||||
# Don't wait for server indefinitely
|
||||
import socket
|
||||
socket.setdefaulttimeout(2)
|
||||
try:
|
||||
self.connection.quit()
|
||||
except:
|
||||
pass
|
||||
|
||||
def getPR(self, version, checksum):
|
||||
return self.connection.getPR(version, checksum)
|
||||
|
||||
def ping(self):
|
||||
return self.connection.ping()
|
||||
|
||||
def start_daemon(options):
|
||||
try:
|
||||
pf = file(PRServer.pidfile,'r')
|
||||
pid = int(pf.readline().strip())
|
||||
pf.close()
|
||||
except IOError:
|
||||
pid = None
|
||||
|
||||
if pid:
|
||||
sys.stderr.write("pidfile %s already exist. Daemon already running?\n"
|
||||
% PRServer.pidfile)
|
||||
sys.exit(1)
|
||||
|
||||
server = PRServer(options.dbfile, interface=(options.host, options.port),
|
||||
logfile=os.path.abspath(options.logfile))
|
||||
server.start()
|
||||
|
||||
def stop_daemon():
|
||||
try:
|
||||
pf = file(PRServer.pidfile,'r')
|
||||
pid = int(pf.readline().strip())
|
||||
host = pf.readline().strip()
|
||||
port = int(pf.readline().strip())
|
||||
pf.close()
|
||||
except IOError:
|
||||
pid = None
|
||||
|
||||
if not pid:
|
||||
sys.stderr.write("pidfile %s does not exist. Daemon not running?\n"
|
||||
% PRServer.pidfile)
|
||||
sys.exit(1)
|
||||
|
||||
PRServerConnection(host,port).terminate()
|
||||
time.sleep(0.5)
|
||||
|
||||
try:
|
||||
while 1:
|
||||
os.kill(pid,signal.SIGTERM)
|
||||
time.sleep(0.1)
|
||||
except OSError as err:
|
||||
err = str(err)
|
||||
if err.find("No such process") > 0:
|
||||
if os.path.exists(PRServer.pidfile):
|
||||
os.remove(PRServer.pidfile)
|
||||
else:
|
||||
print err
|
||||
sys.exit(1)
|
||||
|
||||
@@ -17,20 +17,17 @@
|
||||
# The command-line argument DOC represents the folder name in which a particular
|
||||
# document is stored. The command-line argument VER represents the distro
|
||||
# version of the Yocto Release for which the manuals are being generated.
|
||||
# To build the HTML and PDF versions of the manual you must invoke the Makefile
|
||||
# with the DOC argument. If you are going to publish the manual then you
|
||||
# you must invoke the Makefile with both the DOC and the VER argument.
|
||||
#
|
||||
# You must invoke the Makefile with the DOC and VER arguments.
|
||||
# Examples:
|
||||
#
|
||||
# make DOC=bsp-guide
|
||||
# make DOC=yocto-project-qs
|
||||
# make pdf DOC=poky-ref-manual
|
||||
# make DOC=bsp-guide VER=1.1
|
||||
# make DOC=yocto-project-qs VER=1.1
|
||||
# make pdf DOC=yocto-project-qs VER=1.1
|
||||
#
|
||||
# The first example generates the HTML and PDF versions of the BSP Guide.
|
||||
# The second example generates the HTML version only of the Quick Start. Note that
|
||||
# the Quick Start only has an HTML version available. The third example generates
|
||||
# both the PDF and HTML versions of the Yocto Project Reference Manual.
|
||||
# The first example generates the HTML and PDF versions of the BSP Guide for
|
||||
# the Yocto Project 1.1 Release. The second example generates the HTML version
|
||||
# of the Quick Start. The third example generates an error because you cannot
|
||||
# generate a PDF version of the Quick Start.
|
||||
#
|
||||
# Use the publish target to push the generated manuals to the Yocto Project
|
||||
# website. All files needed for the manual's HTML form are pushed as well as the
|
||||
@@ -40,10 +37,6 @@
|
||||
# make publish DOC=bsp-guide VER=1.1
|
||||
# make publish DOC=adt-manual VER=1.1
|
||||
#
|
||||
# The first example publishes the 1.1 version of both the PDF and HTML versions of
|
||||
# the BSP Guide. The second example publishes the 1.1 version of both the PDF and
|
||||
# HTML versions of the ADT Manual.
|
||||
#
|
||||
|
||||
ifeq ($(DOC),bsp-guide)
|
||||
XSLTOPTS = --stringparam html.stylesheet style.css \
|
||||
@@ -59,24 +52,6 @@ STYLESHEET = $(DOC)/*.css
|
||||
|
||||
endif
|
||||
|
||||
ifeq ($(DOC),dev-manual)
|
||||
XSLTOPTS = --stringparam html.stylesheet style.css \
|
||||
--stringparam chapter.autolabel 1 \
|
||||
--stringparam section.autolabel 1 \
|
||||
--stringparam section.label.includes.component.label 1 \
|
||||
--xinclude
|
||||
ALLPREQ = html pdf tarball
|
||||
TARFILES = style.css dev-manual.html dev-manual.pdf figures/bsp-dev-flow.png figures/dev-title.png \
|
||||
figures/git-workflow.png figures/index-downloads.png figures/kernel-dev-flow.png \
|
||||
figures/kernel-example-repos.png figures/kernel-overview-1.png figures/kernel-overview-2.png \
|
||||
figures/kernel-overview-3.png figures/source-repos.png figures/yp-download.png \
|
||||
figures/wip.png
|
||||
MANUALS = $(DOC)/$(DOC).html $(DOC)/$(DOC).pdf
|
||||
FIGURES = figures
|
||||
STYLESHEET = $(DOC)/*.css
|
||||
|
||||
endif
|
||||
|
||||
ifeq ($(DOC),yocto-project-qs)
|
||||
XSLTOPTS = --stringparam html.stylesheet style.css \
|
||||
--xinclude
|
||||
@@ -95,7 +70,7 @@ XSLTOPTS = --stringparam html.stylesheet style.css \
|
||||
--stringparam section.label.includes.component.label 1 \
|
||||
--xinclude
|
||||
ALLPREQ = html pdf tarball
|
||||
TARFILES = poky-ref-manual.html style.css figures/poky-title.png
|
||||
TARFILES = poky-ref-manual.html style.css figures/poky-title.png figures/ss-sato.png
|
||||
MANUALS = $(DOC)/$(DOC).html $(DOC)/$(DOC).pdf
|
||||
FIGURES = figures
|
||||
STYLESHEET = $(DOC)/*.css
|
||||
|
||||
@@ -3,32 +3,29 @@
|
||||
|
||||
<chapter id='using-the-command-line'>
|
||||
<title>Using the Command Line</title>
|
||||
|
||||
<para>
|
||||
Recall that earlier the manual discussed how to use an existing toolchain
|
||||
Recall that earlier we talked about how to use an existing toolchain
|
||||
tarball that had been installed into <filename>/opt/poky</filename>,
|
||||
which is outside of the Yocto Project build tree
|
||||
(see the section "<link linkend='using-an-existing-toolchain-tarball'>Using an Existing
|
||||
Toolchain Tarball)</link>".
|
||||
which is outside of the Poky build environment
|
||||
(see <xref linkend='using-an-existing-toolchain-tarball'>
|
||||
“Using an Existing Toolchain Tarball”)</xref>.
|
||||
And, that sourcing your architecture-specific environment setup script
|
||||
initializes a suitable cross-toolchain development environment.
|
||||
initializes a suitable development environment.
|
||||
This setup occurs by adding the compiler, QEMU scripts, QEMU binary,
|
||||
a special version of <filename>pkgconfig</filename> and other useful
|
||||
utilities to the <filename>PATH</filename> variable.
|
||||
Variables to assist <filename>pkgconfig</filename> and <filename>autotools</filename>
|
||||
are also defined so that,
|
||||
Variables to assist pkgconfig and autotools are also defined so that,
|
||||
for example, <filename>configure.sh</filename> can find pre-generated
|
||||
test results for tests that need target hardware on which to run.
|
||||
These conditions allow you to easily use the toolchain outside of the
|
||||
Yocto Project build environment on both autotools-based projects and
|
||||
Makefile-based projects.
|
||||
Poky build environment on both autotools-based projects and
|
||||
makefile-based projects.
|
||||
</para>
|
||||
|
||||
<section id='autotools-based-projects'>
|
||||
<title>Autotools-Based Projects</title>
|
||||
|
||||
<para>
|
||||
For an Autotools-based project, you can use the cross-toolchain by just
|
||||
For an autotools-based project you can use the cross-toolchain by just
|
||||
passing the appropriate host option to <filename>configure.sh</filename>.
|
||||
The host option you use is derived from the name of the environment setup
|
||||
script in <filename>/opt/poky</filename> resulting from unpacking the
|
||||
@@ -39,42 +36,26 @@
|
||||
<filename>environment-setup-armv5te-poky-linux-gnueabi</filename>.
|
||||
Thus, the following command works:
|
||||
<literallayout class='monospaced'>
|
||||
$ configure --host=armv5te-poky-linux-gnueabi \
|
||||
--with-libtool-sysroot=<sysroot-dir>
|
||||
$ configure ‐‐host-armv5te-poky-linux-gnueabi ‐‐with-libtool-sysroot=<sysroot-dir>
|
||||
</literallayout>
|
||||
</para>
|
||||
<para>
|
||||
This single command updates your project and rebuilds it using the appropriate
|
||||
cross-toolchain tools.
|
||||
</para>
|
||||
<note>
|
||||
If <filename>configure</filename> script results in problems recognizing the
|
||||
<filename>--with-libtool-sysroot=<sysroot-dir></filename> option,
|
||||
regenerate the script to enable the support by doing the following and then
|
||||
re-running the script:
|
||||
<literallayout class='monospaced'>
|
||||
$ libtoolize --automake
|
||||
$ aclocal -I ${OECORE_NATIVE_SYSROOT}/usr/share/aclocal \
|
||||
[-I <dir_containing_your_project-specific_m4_macros>]
|
||||
$ autoconf
|
||||
$ autoheader
|
||||
$ automake -a
|
||||
</literallayout>
|
||||
</note>
|
||||
</section>
|
||||
|
||||
<section id='makefile-based-projects'>
|
||||
<title>Makefile-Based Projects</title>
|
||||
|
||||
<para>
|
||||
For a Makefile-based project, you use the cross-toolchain by making sure
|
||||
For a makefile-based project you use the cross-toolchain by making sure
|
||||
the tools are used.
|
||||
You can do this as follows:
|
||||
<literallayout class='monospaced'>
|
||||
CC=arm-poky-linux-gnueabi-gcc
|
||||
LD=arm-poky-linux-gnueabi-ld
|
||||
CFLAGS=”${CFLAGS} --sysroot=<sysroot-dir>”
|
||||
CXXFLAGS=”${CXXFLAGS} --sysroot=<sysroot-dir>”
|
||||
CFLAGS=”${CFLAGS} ‐‐sysroot=<sysroot-dir>”
|
||||
CXXFLAGS=”${CXXFLAGS} ‐‐sysroot=<sysroot-dir>”
|
||||
</literallayout>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
@@ -3,18 +3,17 @@
|
||||
|
||||
<chapter id='adt-eclipse'>
|
||||
<title>Working Within Eclipse</title>
|
||||
|
||||
<para>
|
||||
The Eclipse IDE is a popular development environment and it fully supports
|
||||
development using Yocto Project.
|
||||
When you install and configure the Eclipse Yocto Project Plug-in into
|
||||
the Eclipse IDE, you maximize your Yocto Project design experience.
|
||||
the Eclipse IDE you maximize your Yocto Project design experience.
|
||||
Installing and configuring the Plug-in results in an environment that
|
||||
has extensions specifically designed to let you more easily develop software.
|
||||
These extensions allow for cross-compilation, deployment, and execution of
|
||||
These extensions allow for cross-compilation and deployment and execution of
|
||||
your output into a QEMU emulation session.
|
||||
You can also perform cross-debugging and profiling.
|
||||
The environment also supports a suite of tools that allows you to perform
|
||||
The environment also has a suite of tools that allows you to perform
|
||||
remote profiling, tracing, collection of power data, collection of
|
||||
latency data, and collection of performance data.
|
||||
</para>
|
||||
@@ -25,378 +24,220 @@
|
||||
|
||||
<section id='setting-up-the-eclipse-ide'>
|
||||
<title>Setting Up the Eclipse IDE</title>
|
||||
|
||||
<para>
|
||||
To develop within the Eclipse IDE, you need to do the following:
|
||||
To develop within the Eclipse IDE you need to do the following:
|
||||
<orderedlist>
|
||||
<listitem><para>Install the optimal version of the Eclipse IDE.</para></listitem>
|
||||
<listitem><para>Configure the Eclipse IDE.</para></listitem>
|
||||
<listitem><para>Install the Eclipse Yocto Plug-in.</para></listitem>
|
||||
<listitem><para>Be sure the optimal version of Eclipse IDE
|
||||
is installed.</para></listitem>
|
||||
<listitem><para>Install required Eclipse plug-ins prior to installing
|
||||
the Eclipse Yocto Plug-in.</para></listitem>
|
||||
<listitem><para>Configure the Eclipse Yocto Plug-in.</para></listitem>
|
||||
</orderedlist>
|
||||
</para>
|
||||
|
||||
<section id='installing-eclipse-ide'>
|
||||
<title>Installing the Eclipse IDE</title>
|
||||
|
||||
<title>Installing Eclipse IDE</title>
|
||||
<para>
|
||||
It is recommended that you have the Indigo 3.7 version of the
|
||||
It is recommended that you have the Helios 3.6.1 version of the
|
||||
Eclipse IDE installed on your development system.
|
||||
If you don’t have this version, you can find it at
|
||||
If you don’t have this version you can find it at
|
||||
<ulink url='http://www.eclipse.org/downloads'></ulink>.
|
||||
From that site, choose the Eclipse Classic version particular to your development
|
||||
host.
|
||||
From that site, choose the Eclipse Classic version.
|
||||
This version contains the Eclipse Platform, the Java Development
|
||||
Tools (JDT), and the Plug-in Development Environment.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Once you have downloaded the tarball, extract it into a clean
|
||||
directory.
|
||||
For example, the following command unpacks and installs the Eclipse IDE
|
||||
into a clean directory using the default name <filename>eclipse</filename>:
|
||||
<literallayout class='monospaced'>
|
||||
$ tar -xzvf ~/Downloads/Eclipse-SDK-3.7-linux-gtk-x86_64.tar.gz
|
||||
</literallayout>
|
||||
directory and complete the installation.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
One issue exists that you need to be aware of regarding the Java
|
||||
Virtual machine’s garbage collection (GC) process.
|
||||
The GC process does not clean up the permanent generation
|
||||
space (PermGen).
|
||||
This space stores metadata descriptions of classes.
|
||||
This space stores meta-data descriptions of classes.
|
||||
The default value is set too small and it could trigger an
|
||||
out-of-memory error such as the following:
|
||||
<literallayout class='monospaced'>
|
||||
Java.lang.OutOfMemoryError: PermGen space
|
||||
</literallayout>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
This error causes the application to hang.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
To fix this issue, you can use the <filename>--vmargs</filename>
|
||||
option when you start Eclipse to increase the size of the permanent generation space:
|
||||
To fix this issue you can use the ‐‐vmargs option when you start
|
||||
Eclipse to increase the size of the permanent generation space:
|
||||
<literallayout class='monospaced'>
|
||||
eclipse --vmargs --XX:PermSize=256M
|
||||
eclipse ‐‐vmargs ‐‐XX:PermSize=256M
|
||||
</literallayout>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id='configuring-the-eclipse-ide'>
|
||||
<title>Configuring the Eclipse IDE</title>
|
||||
|
||||
<section id='installing-required-plug-ins-and-the-eclipse-yocto-plug-in'>
|
||||
<title>Installing Required Plug-ins and the Eclipse Yocto Plug-in</title>
|
||||
<para>
|
||||
Before installing and configuring the Eclipse Yocto Plug-in, you need to configure
|
||||
the Eclipse IDE.
|
||||
Follow these general steps to configure Eclipse:
|
||||
Before installing the Yocto Plug-in you need to be sure that the
|
||||
CDT 7.0, RSE 3.2, and Autotools plug-ins are all installed in the
|
||||
following order.
|
||||
After installing these three plug-ins, you can install the
|
||||
Eclipse Yocto Plug-in.
|
||||
Use the following URLs for the plug-ins:
|
||||
<orderedlist>
|
||||
<listitem><para>Start the Eclipse IDE.</para></listitem>
|
||||
<listitem><para>Make sure you are in your Workbench and select
|
||||
"Install New Software" from the "Help" pull-down menu.
|
||||
</para></listitem>
|
||||
<listitem><para>Select <filename>indigo - http://download.eclipse.org/releases/indigo</filename>
|
||||
from the "Work with:" pull-down menu.</para></listitem>
|
||||
<listitem><para>Expand the box next to <filename>Programming Languages</filename>
|
||||
and select the <filename>Autotools Support for CDT (incubation)</filename>
|
||||
and <filename>C/C++ Development Tools</filename> boxes.</para></listitem>
|
||||
<listitem><para>Complete the installation and restart the Eclipse IDE.</para></listitem>
|
||||
<listitem><para>After the Eclipse IDE restarts and from the Workbench, select
|
||||
"Install New Software" from the "Help" pull-down menu.</para></listitem>
|
||||
<listitem><para>Click the
|
||||
"Available Software Sites" link.</para></listitem>
|
||||
<listitem><para>Check the box next to
|
||||
<filename>http://download.eclipse.org/tm/updates/3.3</filename>
|
||||
and click "OK".</para></listitem>
|
||||
<listitem><para>Select <filename>http://download.eclipse.org/tm/updates/3.3</filename>
|
||||
from the "Work with:" pull-down menu.</para></listitem>
|
||||
<listitem><para>Check the box next to <filename>TM and RSE Main Features</filename>.
|
||||
</para></listitem>
|
||||
<listitem><para>Expand the box next to <filename>TM and RSE Optional Add-ons</filename>
|
||||
and select every item except <filename>RSE Unit Tests</filename> and
|
||||
<filename>RSE WinCE Services (incubation)</filename>.</para></listitem>
|
||||
<listitem><para>Complete the installation and restart the Eclipse IDE.</para></listitem>
|
||||
<listitem><para>If necessary, select
|
||||
"Install New Software" from the "Help" pull-down menu so you can click the
|
||||
"Available Software Sites" link again.</para></listitem>
|
||||
<listitem><para>After clicking "Available Software Sites", check the box next to
|
||||
<filename>http://download.eclipse.org/tools/cdt/releases/indigo</filename>
|
||||
and click "OK".</para></listitem>
|
||||
<listitem><para>Select <filename>http://download.eclipse.org/tools/cdt/releases/indigo</filename>
|
||||
from the "Work with:" pull-down menu.</para></listitem>
|
||||
<listitem><para>Check the box next to <filename>CDT Main Features</filename>.
|
||||
</para></listitem>
|
||||
<listitem><para>Expand the box next to <filename>CDT Optional Features</filename>
|
||||
and select <filename>C/C++ Remote Launch</filename> and
|
||||
<filename>Target Communication Framework (incubation)</filename>.</para></listitem>
|
||||
<listitem><para>Complete the installation and restart the Eclipse IDE.</para></listitem>
|
||||
<listitem><para><emphasis>CDT 7.0</emphasis> –
|
||||
<ulink url='http://download.eclipse.org/tools/cdt/releases/helios/'></ulink>:
|
||||
For CDT main features select the checkbox so you get all items.
|
||||
For CDT optional features expand the selections and check
|
||||
“C/C++ Remote Launch”.</para></listitem>
|
||||
<listitem><para><emphasis>RSE 3.2</emphasis> –
|
||||
<ulink url='http://download.eclipse.org/tm/updates/3.2'></ulink>:
|
||||
Check the box next to “TM and RSE Main Features” so you select all
|
||||
those items.
|
||||
Note that all items in the main features depend on 3.2.1 version.
|
||||
Expand the items under “TM and RSE Uncategorized 3.2.1” and
|
||||
select the following: “Remote System Explorer End-User Runtime”,
|
||||
“Remote System Explorer Extended SDK”, “Remote System Explorer User Actions”,
|
||||
“RSE Core”, “RSE Terminals UI”, and “Target Management Terminal”.</para></listitem>
|
||||
<listitem><para><emphasis>Autotools</emphasis> –
|
||||
<ulink url='http://download.eclipse.org/technology/linuxtools/update/'></ulink>:
|
||||
Expand the items under “Linux Tools” and select “Autotools support for
|
||||
CDT (Incubation)”.</para></listitem>
|
||||
<listitem><para><emphasis>Yocto Plug-in</emphasis> –
|
||||
<ulink url='http://www.yoctoproject.org/downloads/eclipse-plugin/1.0'></ulink>:
|
||||
Check the box next to “Development tools & SDKs for Yocto Linux”
|
||||
to select all the items.</para></listitem>
|
||||
</orderedlist>
|
||||
</para>
|
||||
<para>
|
||||
Follow these general steps to install a plug-in:
|
||||
<orderedlist>
|
||||
<listitem><para>From within the Eclipse IDE select the
|
||||
“Install New Software” item from the “Help” menu.</para></listitem>
|
||||
<listitem><para>Click “Add…” in the “Work with:” area.</para></listitem>
|
||||
<listitem><para>Enter the URL for the repository and leave the “Name”
|
||||
field blank.</para></listitem>
|
||||
<listitem><para>Check the boxes next to the software you need to
|
||||
install and then complete the installation.
|
||||
For information on the specific software packages you need to include,
|
||||
see the previous list.</para></listitem>
|
||||
</orderedlist>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id='installing-the-eclipse-yocto-plug-in'>
|
||||
<title>Installing the Eclipse Yocto Plug-in</title>
|
||||
|
||||
<section id='configuring-the-plug-in'>
|
||||
<title>Configuring the Plug-in</title>
|
||||
<para>
|
||||
You can install the Eclipse Yocto Plug-in one of three methods: as new software
|
||||
from within the Eclipse IDE, from the Yocto Project source repositories, or as a built zip file.
|
||||
Configuring the Eclipse Yocto Plug-in involves choosing the Cross
|
||||
Compiler Options, selecting the Target Architecture, and choosing
|
||||
the Target Options.
|
||||
These settings are the default settings for all projects.
|
||||
You do have opportunities to change them later if you choose to when
|
||||
you configure the project.
|
||||
See “Configuring the Cross Toolchain” section later in the manual.
|
||||
</para>
|
||||
|
||||
<section id='new-software'>
|
||||
<title>New Software</title>
|
||||
|
||||
<para>
|
||||
To install the Eclipse Yocto Plug-in directly into the Eclipse IDE,
|
||||
follow these steps:
|
||||
<orderedlist>
|
||||
<listitem><para>Start up the Eclipse IDE.</para></listitem>
|
||||
<listitem><para>In Eclipse, select "Install New Software" from the "Help" menu.</para></listitem>
|
||||
<listitem><para>Click "Add..." in the "Work with:" area.</para></listitem>
|
||||
<listitem><para>Enter
|
||||
<filename>http://www.yoctoproject.org/downloads/eclipse-plugin/1.1</filename>
|
||||
in the URL field and provide a meaningful name in the "Name" field.</para></listitem>
|
||||
<listitem><para>Click "OK" to have the entry added to the "Work with:"
|
||||
drop-down list.</para></listitem>
|
||||
<listitem><para>Select the entry for the plug-in from the "Work with:" drop-down
|
||||
list.</para></listitem>
|
||||
<listitem><para>Complete the remaining software installation steps and
|
||||
then restart the Eclipse IDE to finish the installation of the plug-in.
|
||||
</para></listitem>
|
||||
</orderedlist>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
|
||||
<section id='yocto-project-source'>
|
||||
<title>Yocto Project Source</title>
|
||||
|
||||
<para>
|
||||
To install the Eclipse Yocto Plug-in from the Yocto Project source repositories,
|
||||
follow these steps:
|
||||
<orderedlist>
|
||||
<listitem><para>Open a shell and create a Git repository with:
|
||||
<literallayout class='monospaced'>
|
||||
$ git clone git://git.yoctoproject.org/eclipse-poky yocto-eclipse
|
||||
</literallayout>
|
||||
For this example, the repository is named
|
||||
<filename>~/yocto-eclipse</filename>.</para></listitem>
|
||||
<listitem><para>In Eclipse, select "Import" from the "File" menu.</para></listitem>
|
||||
<listitem><para>Expand the "General" box and pick "existing projects into workspace".
|
||||
</para></listitem>
|
||||
<listitem><para>Select the root directory and browse to "~/yocto-eclipse/plugins".
|
||||
</para></listitem>
|
||||
<listitem><para>There will be three things there.
|
||||
Select each one and install one at a time.
|
||||
Do all three.</para></listitem>
|
||||
<listitem><para>Restart everything.</para></listitem>
|
||||
</orderedlist>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
At this point you should be able to invoke Eclipse from the shell using the following:
|
||||
<literallayout class='monospaced'>
|
||||
$ cd ~/eclipse
|
||||
$ ./eclipse -vmargs -XX:PermSize=256M
|
||||
</literallayout>
|
||||
The left navigation pane shows the default projects.
|
||||
Right-click on one of these projects and run it as an Eclipse application.
|
||||
This brings up a second instance of Eclipse IDE that has the Yocto Plug-in.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id='zip-file-method'>
|
||||
<title>Zip File Method</title>
|
||||
<para>
|
||||
To install the Eclipse Yocto Plug-in by building and installing a plug-in
|
||||
zip file, follow these steps:
|
||||
<orderedlist>
|
||||
<listitem><para>Open a shell and create a Git repository with:
|
||||
<literallayout class='monospaced'>
|
||||
$ git clone git://git.yoctoproject.org/eclipse-poky yocto-eclipse
|
||||
</literallayout>
|
||||
For this example, the repository is named
|
||||
<filename>~/yocto-eclipse</filename>.</para></listitem>
|
||||
<listitem><para>Locate the <filename>build.sh</filename> script in the
|
||||
Git repository you created in the previous step.
|
||||
The script is located in the <filename>scripts</filename>.</para></listitem>
|
||||
<listitem><para>Be sure to set and export the <filename>ECLIPSE_HOME</filename> environment
|
||||
variable to the top-level directory in which you installed the Indigo
|
||||
version of Eclipse.
|
||||
For example, if your Eclipse directory is <filename>$HOME/eclipse</filename>,
|
||||
use the following:
|
||||
<literallayout class='monospaced'>
|
||||
$ export ECLIPSE_HOME=$HOME/eclipse
|
||||
</literallayout></para></listitem>
|
||||
<listitem><para>Run the <filename>build.sh</filename> script and provide the
|
||||
name of the Git branch along with the Yocto Project release you are
|
||||
using.
|
||||
Here is an example that uses the <filename>master</filename> Git repository
|
||||
and the <filename>1.1M4</filename> release:
|
||||
<literallayout class='monospaced'>
|
||||
$ scripts/build.sh master 1.1M4
|
||||
</literallayout>
|
||||
After running the script, the file
|
||||
<filename>org.yocto.sdk-<release>-<date>-archive.zip</filename>
|
||||
is in the current directory.</para></listitem>
|
||||
<listitem><para>If necessary, start the Eclipse IDE and be sure you are in the
|
||||
Workbench.</para></listitem>
|
||||
<listitem><para>Select "Install New Software" from the "Help" pull-down menu.
|
||||
</para></listitem>
|
||||
<listitem><para>Click "Add".</para></listitem>
|
||||
<listitem><para>Provide anything you want in the "Name" field.</para></listitem>
|
||||
<listitem><para>For the "Archive" field, select the ZIP file you built in step
|
||||
4.
|
||||
This ZIP file should not be "unzipped", and must be the
|
||||
<filename>*archive.zip</filename> file created by running the
|
||||
<filename>build.sh</filename> script.</para></listitem>
|
||||
<listitem><para>Select the new entry in the installation window and complete
|
||||
the installation.</para></listitem>
|
||||
<listitem><para>Restart the Eclipse IDE if necessary.</para></listitem>
|
||||
</orderedlist>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
At this point you should be able to configure the Eclipse Yocto Plug-in as described in
|
||||
the next section.
|
||||
</para>
|
||||
</section>
|
||||
</section>
|
||||
|
||||
<section id='configuring-the-eclipse-yocto-plug-in'>
|
||||
<title>Configuring the Eclipse Yocto Plug-in</title>
|
||||
|
||||
<para>
|
||||
Configuring the Eclipse Yocto Plug-in involves setting the Cross
|
||||
Compiler options and the Target options.
|
||||
The configurations you choose become the default settings for all projects.
|
||||
You do have opportunities to change them later when
|
||||
you configure the project (see the following section).
|
||||
</para>
|
||||
|
||||
<para>
|
||||
To start, you need to do the following from within the Eclipse IDE:
|
||||
<itemizedlist>
|
||||
<listitem><para>Choose <filename>Windows -> Preferences</filename> to display
|
||||
the <filename>Preferences</filename> Dialog</para></listitem>
|
||||
<listitem><para>Click <filename>Yocto ADT</filename></para></listitem>
|
||||
<listitem><para>Choose Windows -> Preferences to display
|
||||
the Preferences Dialog</para></listitem>
|
||||
<listitem><para>Click “Yocto SDK”</para></listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
|
||||
<section id='configuring-the-cross-compiler-options'>
|
||||
<title>Configuring the Cross-Compiler Options</title>
|
||||
|
||||
<para>
|
||||
To configure the Cross Compiler Options, you must select the type of toolchain,
|
||||
point to the toolchain, specify the sysroot location, and select the target architecture.
|
||||
Choose between ‘SDK Root Mode’ and ‘Poky Tree Mode’ for Cross
|
||||
Compiler Options.
|
||||
<itemizedlist>
|
||||
<listitem><para><emphasis>Selecting the Toolchain Type:</emphasis>
|
||||
Choose between <filename>Standalone pre-built toolchain</filename>
|
||||
and <filename>Build system derived toolchain</filename> for Cross
|
||||
Compiler Options.
|
||||
<itemizedlist>
|
||||
<listitem><para><emphasis>
|
||||
<filename>Standalone Pre-built Toolchain:</filename></emphasis>
|
||||
Select this mode when you are using a stand-alone cross-toolchain.
|
||||
For example, suppose you are an application developer and do not
|
||||
need to build a target image.
|
||||
Instead, you just want to use an architecture-specific toolchain on an
|
||||
existing kernel and target root filesystem.
|
||||
</para></listitem>
|
||||
<listitem><para><emphasis>
|
||||
<filename>Build System Derived Toolchain:</filename></emphasis>
|
||||
Select this mode if the cross-toolchain has been installed and built
|
||||
as part of the Yocto Project build tree.
|
||||
When you select <filename>Build system derived toolchain</filename>,
|
||||
you are using the toolchain bundled
|
||||
inside the Yocto Project build tree.
|
||||
</para></listitem>
|
||||
</itemizedlist>
|
||||
</para></listitem>
|
||||
<listitem><para><emphasis>Point to the Toolchain:</emphasis>
|
||||
If you are using a stand-alone pre-built toolchain, you should be pointing to the
|
||||
<filename>/opt/poky/1.1</filename> directory.
|
||||
This is the location for toolchains installed by the ADT Installer or by hand.
|
||||
Sections "<link linkend='configuring-and-running-the-adt-installer-script'>Configuring
|
||||
and Running the ADT Installer Script</link>" and
|
||||
"<link linkend='using-an-existing-toolchain-tarball'>Using a Cross-Toolchain
|
||||
Tarball</link>" describe two ways to install
|
||||
a stand-alone cross-toolchain in the
|
||||
<filename>/opt/poky</filename> directory.
|
||||
<note>It is possible to install a stand-alone cross-toolchain in a directory
|
||||
other than <filename>/opt/poky</filename>.
|
||||
However, doing so is discouraged.</note></para>
|
||||
<para>If you are using a system-derived toolchain, the path you provide
|
||||
for the <filename>Toolchain Root Location</filename>
|
||||
field is the Yocto Project's build directory.
|
||||
See section "<link linkend='using-the-toolchain-from-within-the-build-tree'>Using
|
||||
BitBake and the Yocto Project Build Tree</link>" for
|
||||
information on how to install the toolchain into the Yocto
|
||||
Project build tree.</para></listitem>
|
||||
<listitem><para><emphasis>Specify the Sysroot Location:</emphasis>
|
||||
This location is where the root filesystem for the
|
||||
target hardware is created on the development system by the ADT Installer.
|
||||
The QEMU user-space tools, the
|
||||
NFS boot process, and the cross-toolchain all use the sysroot location.
|
||||
</para></listitem>
|
||||
<listitem><para><emphasis>Select the Target Architecture:</emphasis>
|
||||
The target architecture is the type of hardware you are
|
||||
going to use or emulate.
|
||||
Use the pull-down <filename>Target Architecture</filename> menu to make
|
||||
your selection.
|
||||
The pull-down menu should have the supported architectures.
|
||||
If the architecture you need is not listed in the menu, you
|
||||
will need to build the image.
|
||||
See the "<ulink url='http://www.yoctoproject.org/docs/latest/yocto-project-qs/yocto-project-qs.html#building-image'>Building an Image</ulink>" section of the
|
||||
<ulink url='http://www.yoctoproject.org/docs/latest/yocto-project-qs/yocto-project-qs.html'>
|
||||
The Yocto Project Quick Start</ulink> for more information.</para></listitem>
|
||||
<listitem><para><emphasis>SDK Root Mode</emphasis> – Select this mode
|
||||
when you are not concerned with building an image or you do not have
|
||||
a Poky build tree on your system.
|
||||
For example, suppose you are an application developer and do not
|
||||
need to build an image.
|
||||
You just want to use an architecture-specific toolchain on an
|
||||
existing kernel and root filesystem.
|
||||
When you use SDK Root Mode you are using the toolchain installed
|
||||
in the <filename>/opt/poky</filename> directory.</para></listitem>
|
||||
<listitem><para><emphasis>Poky Tree Mode</emphasis> – Select this mode
|
||||
if you are concerned with building images for hardware or your
|
||||
development environment already has a build tree.
|
||||
In this case you likely already have a Poky build tree installed on
|
||||
your system or you (or someone else) will be building one.
|
||||
When you use the Poky Tree Mode you are using the toolchain bundled
|
||||
inside the Poky build tree.
|
||||
If you use this mode you must also supply the Poky Root Location
|
||||
in the Preferences Dialog.</para></listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id='configuring-the-target-options'>
|
||||
<title>Configuring the Target Options</title>
|
||||
<section id='configuring-the-sysroot'>
|
||||
<title>Configuring the Sysroot</title>
|
||||
<para>
|
||||
Specify the sysroot, which is used by both the QEMU user-space
|
||||
NFS boot process and by the cross-toolchain regardless of the
|
||||
mode you select (SDK Root Mode or Poky Tree Mode).
|
||||
For example, sysroot is the location to which you extract the
|
||||
downloaded image’s root filesystem to through the ADT Installer.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id='selecting-the-target-architecture'>
|
||||
<title>Selecting the Target Architecture</title>
|
||||
<para>
|
||||
Use the pull-down Target Architecture menu and select the
|
||||
target architecture.
|
||||
</para>
|
||||
<para>
|
||||
The Target Architecture is the type of hardware you are
|
||||
going to use or emulate.
|
||||
This pull-down menu should have the supported architectures.
|
||||
If the architecture you need is not listed in the menu then you
|
||||
will need to re-visit
|
||||
<xref linkend='adt-prepare'>
|
||||
“Preparing to Use the Application Development Toolkit (ADT)”</xref>
|
||||
section earlier in this document.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id='choosing-the-target-options'>
|
||||
<title>Choosing the Target Options</title>
|
||||
<para>
|
||||
You can choose to emulate hardware using the QEMU emulator, or you
|
||||
can choose to run your image on actual hardware.
|
||||
can choose to use actual hardware.
|
||||
<itemizedlist>
|
||||
<listitem><para><emphasis><filename>QEMU:</filename></emphasis> Select this option if
|
||||
you will be using the QEMU emulator.
|
||||
If you are using the emulator, you also need to locate the kernel
|
||||
and specify any custom options.</para>
|
||||
<para>If you selected <filename>Build system derived toolchain</filename>,
|
||||
the target kernel you built will be located in the
|
||||
Yocto Project build tree in <filename>tmp/deploy/images</filename> directory.
|
||||
If you selected <filename>Standalone pre-built toolchain</filename>, the
|
||||
pre-built image you downloaded is located
|
||||
in the directory you specified when you downloaded the image.</para>
|
||||
<para>Most custom options are for advanced QEMU users to further
|
||||
customize their QEMU instance.
|
||||
These options are specified between paired angled brackets.
|
||||
Some options must be specified outside the brackets.
|
||||
In particular, the options <filename>serial</filename>,
|
||||
<filename>nographic</filename>, and <filename>kvm</filename> must all
|
||||
be outside the brackets.
|
||||
Use the <filename>man qemu</filename> command to get help on all the options
|
||||
and their use.
|
||||
The following is an example:
|
||||
<listitem><para><emphasis>External HW</emphasis> – Select this option
|
||||
if you will be using actual hardware.</para></listitem>
|
||||
<listitem><para><emphasis>QEMU</emphasis> – Select this option if
|
||||
you will be using the QEMU emulator.
|
||||
If you are using the emulator you also need to locate the Kernel
|
||||
and you can specify custom options.</para>
|
||||
<para>In Poky Tree Mode the kernel you built will be located in the
|
||||
Poky Build tree in <filename>tmp/deploy/images</filename> directory.
|
||||
In SDK Root Mode the pre-built kernel you downloaded is located
|
||||
in the directory you specified when you downloaded the image.</para>
|
||||
<para>Most custom options are for advanced QEMU users to further
|
||||
customize their QEMU instance.
|
||||
These options are specified between paired angled brackets.
|
||||
Some options must be specified outside the brackets.
|
||||
In particular, the options <filename>serial</filename>,
|
||||
<filename>nographic</filename>, and <filename>kvm</filename> must all
|
||||
be outside the brackets.
|
||||
Use the <filename>man qemu</filename> command to get help on all the options
|
||||
and their use.
|
||||
The following is an example:
|
||||
<literallayout class='monospaced'>
|
||||
serial ‘<-m 256 -full-screen>’
|
||||
</literallayout></para>
|
||||
<para>
|
||||
Regardless of the mode, Sysroot is already defined as part of the
|
||||
Cross Compiler Options configuration in the
|
||||
<filename>Sysroot Location:</filename> field.</para></listitem>
|
||||
<listitem><para><emphasis><filename>External HW:</filename></emphasis> Select this option
|
||||
if you will be using actual hardware.</para></listitem>
|
||||
</literallayout>
|
||||
</para>
|
||||
<para>
|
||||
Regardless of the mode, Sysroot is already defined in the “Sysroot”
|
||||
field.</para></listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Click the <filename>OK</filename> button to save your plug-in configurations.
|
||||
Click the “OK” button to save your plug-in configurations.
|
||||
</para>
|
||||
</section>
|
||||
</section>
|
||||
@@ -404,139 +245,127 @@
|
||||
|
||||
<section id='creating-the-project'>
|
||||
<title>Creating the Project</title>
|
||||
|
||||
<para>
|
||||
You can create two types of projects: Autotools-based, or Makefile-based.
|
||||
This section describes how to create Autotools-based projects from within
|
||||
This section describes how to create autotools-based projects from within
|
||||
the Eclipse IDE.
|
||||
For information on creating Makefile-based projects in a terminal window, see the section
|
||||
"<link linkend='using-the-command-line'>Using the Command Line</link>".
|
||||
For information on creating projects in a terminal window see
|
||||
<xref linkend='using-the-command-line'> “Using the Command Line”</xref>
|
||||
section.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
To create a project based on a Yocto template and then display the source code,
|
||||
follow these steps:
|
||||
<orderedlist>
|
||||
<listitem><para>Select <filename>File -> New -> Project</filename>.</para></listitem>
|
||||
<listitem><para>Double click <filename>CC++</filename>.</para></listitem>
|
||||
<listitem><para>Double click <filename>C Project</filename> to create the project.</para></listitem>
|
||||
<listitem><para>Expand <filename>Yocto ADT Project</filename>.</para></listitem>
|
||||
<listitem><para>Select <filename>Hello World ANSI C Autotools Project</filename>.
|
||||
This is an Autotools-based project based on a Yocto Project template.</para></listitem>
|
||||
<listitem><para>Put a name in the <filename>Project name:</filename> field.
|
||||
Do not use hyphens as part of the name.</para></listitem>
|
||||
<listitem><para>Click <filename>Next</filename>.</para></listitem>
|
||||
<listitem><para>Add information in the <filename>Author</filename> and
|
||||
<filename>Copyright notice</filename> fields.</para></listitem>
|
||||
<listitem><para>Be sure the <filename>License</filename> field is correct.</para></listitem>
|
||||
<listitem><para>Click <filename>Finish</filename>.</para></listitem>
|
||||
<listitem><para>If the "open perspective" prompt appears, click "Yes" so that you
|
||||
in the C/C++ perspective.</para></listitem>
|
||||
<listitem><para>The left-hand navigation pane shows your project.
|
||||
You can display your source by double clicking the project's source file.
|
||||
</para></listitem>
|
||||
<listitem><para>Select File -> New -> Project.</para></listitem>
|
||||
<listitem><para>Double click “CC++”.</para></listitem>
|
||||
<listitem><para>Double click “C Project” to create the project.</para></listitem>
|
||||
<listitem><para>Double click “Yocto SDK Project”.</para></listitem>
|
||||
<listitem><para>Select “Hello World ANSI C Autotools Project”.
|
||||
This is an Autotools-based project based on a Yocto Project template.</para></listitem>
|
||||
<listitem><para>Put a name in the “Project name:” field.</para></listitem>
|
||||
<listitem><para>Click “Next”.</para></listitem>
|
||||
<listitem><para>Add information in the “Author” field.</para></listitem>
|
||||
<listitem><para>Use “GNU General Public License v2.0” for the License.</para></listitem>
|
||||
<listitem><para>Click “Finish”.</para></listitem>
|
||||
<listitem><para>Answer ‘Yes” to the open perspective prompt.</para></listitem>
|
||||
<listitem><para>In the Project Explorer expand your project.</para></listitem>
|
||||
<listitem><para>Expand ‘src’.</para></listitem>
|
||||
<listitem><para>Double click on your source file and the code appears
|
||||
in the window.
|
||||
This is the template.</para></listitem>
|
||||
</orderedlist>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id='configuring-the-cross-toolchains'>
|
||||
<title>Configuring the Cross-Toolchains</title>
|
||||
|
||||
<para>
|
||||
The earlier section, "<link linkend='configuring-the-eclipse-yocto-plug-in'>Configuring
|
||||
the Eclipse Yocto Plug-in</link>", sets up the default project
|
||||
The previous section, <xref linkend='configuring-the-cross-compiler-options'>
|
||||
“Configuring the Cross-Compiler Options”</xref>, set up the default project
|
||||
configurations.
|
||||
You can override these settings for a given project by following these steps:
|
||||
You can change these settings for a given project by following these steps:
|
||||
<orderedlist>
|
||||
<listitem><para>Select <filename>Project -> Change Yocto Project Settings</filename>:
|
||||
This selection brings up the <filename>Project Yocto Settings</filename> Dialog
|
||||
and allows you to make changes specific to an individual project.
|
||||
</para>
|
||||
<para>By default, the Cross Compiler Options and Target Options for a project
|
||||
are inherited from settings you provide using the <filename>Preferences</filename>
|
||||
Dialog as described earlier
|
||||
in the "<link linkend='configuring-the-eclipse-yocto-plug-in'>Configuring the Eclipse
|
||||
Yocto Plug-in</link>" section.
|
||||
The <filename>Project Yocto Settings</filename>
|
||||
Dialog allows you to override those default settings
|
||||
for a given project.</para></listitem>
|
||||
<listitem><para>Make your configurations for the project and click "OK".</para></listitem>
|
||||
<listitem><para>Select <filename>Project -> Reconfigure Project</filename>:
|
||||
This selection reconfigures the project by running
|
||||
<filename>autogen.sh</filename> in the workspace for your project.
|
||||
The script also runs <filename>libtoolize</filename>, <filename>aclocal</filename>,
|
||||
<filename>autoconf</filename>, <filename>autoheader</filename>,
|
||||
<filename>automake --a</filename>, and
|
||||
<filename>./configure</filename>.</para></listitem>
|
||||
<listitem><para>Select Project -> Invoke Yocto Tools -> Reconfigure Yocto.
|
||||
This brings up the project Yocto Settings Dialog.
|
||||
Settings are inherited from the default project configuration.
|
||||
The information in this dialogue is identical to that chosen earlier
|
||||
for the Cross Compiler Option (SDK Root Mode or Poky Tree Mode),
|
||||
the Target Architecture, and the Target Options.
|
||||
The settings are inherited from the Yocto Plug-in configuration performed
|
||||
after installing the plug-in.</para></listitem>
|
||||
<listitem><para>Select Project -> Reconfigure Project.
|
||||
This runs the <filename>autogen.sh</filename> in the workspace for your project.
|
||||
The script runs <filename>libtoolize</filename>, <filename>aclocal</filename>,
|
||||
<filename>autoconf</filename>, <filename>autoheader</filename>,
|
||||
<filename>automake ‐‐a</filename>, and
|
||||
<filename>./configure</filename>.</para></listitem>
|
||||
</orderedlist>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id='building-the-project'>
|
||||
<title>Building the Project</title>
|
||||
|
||||
<para>
|
||||
To build the project, select <filename>Project -> Build Project</filename>.
|
||||
The console should update and you can note the cross-compiler you are using.
|
||||
To build the project, select Project -> Build Project.
|
||||
You should see the console updated and you can note the cross-compiler you are using.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id='starting-qemu-in-user-space-nfs-mode'>
|
||||
<title>Starting QEMU in User Space NFS Mode</title>
|
||||
|
||||
<para>
|
||||
To start the QEMU emulator from within Eclipse, follow these steps:
|
||||
<orderedlist>
|
||||
<listitem><para>Expose the <filename>Run -> External Tools</filename> menu.
|
||||
Your image should appear as a selectable menu item.
|
||||
</para></listitem>
|
||||
<listitem><para>Select your image in the navigation pane to launch the
|
||||
emulator in a new window.</para></listitem>
|
||||
<listitem><para>If needed, enter your host root password in the shell window at the prompt.
|
||||
This sets up a <filename>Tap 0</filename> connection needed for running in user-space
|
||||
NFS mode.</para></listitem>
|
||||
<listitem><para>Select Run -> External Tools -> External Tools Configurations...
|
||||
This selection brings up the External Tools Configurations Dialogue.</para></listitem>
|
||||
<listitem><para>Go to the left navigation area and expand ‘Program’.
|
||||
You should find the image listed.
|
||||
For example, qemu-x86_64-poky-linux.</para></listitem>
|
||||
<listitem><para>Click on the image.
|
||||
This brings up a new environment in the main area of the External
|
||||
Tools Configurations Dialogue.
|
||||
The Main tab is selected.</para></listitem>
|
||||
<listitem><para>Click “Run” next.
|
||||
This brings up a shell window.</para></listitem>
|
||||
<listitem><para>Enter your host root password in the shell window at the prompt.
|
||||
This sets up a Tap 0 connection needed for running in user-space NFS mode.</para></listitem>
|
||||
<listitem><para>Wait for QEMU to launch.</para></listitem>
|
||||
<listitem><para>Once QEMU launches, you can begin operating within that
|
||||
environment.
|
||||
For example, you could determine the IP Address
|
||||
for the user-space NFS by using the <filename>ifconfig</filename> command.
|
||||
</para></listitem>
|
||||
<listitem><para>Once QEMU launches you need to determine the IP Address
|
||||
for the user-space NFS.
|
||||
You can do that by going to a terminal in the QEMU and entering the
|
||||
<filename>ipconfig</filename> command.</para></listitem>
|
||||
</orderedlist>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id='deploying-and-debugging-the-application'>
|
||||
<title>Deploying and Debugging the Application</title>
|
||||
|
||||
<para>
|
||||
Once the QEMU emulator is running the image, you can deploy your application and use the emulator
|
||||
Once QEMU is running you can deploy your application and use the emulator
|
||||
to perform debugging.
|
||||
Follow these steps to deploy the application.
|
||||
<orderedlist>
|
||||
<listitem><para>Select <filename>Run -> Debug Configurations...</filename></para></listitem>
|
||||
<listitem><para>In the left area, expand <filename>C/C++Remote Application</filename>.</para></listitem>
|
||||
<listitem><para>Select Run -> Debug Configurations...</para></listitem>
|
||||
<listitem><para>In the left area expand “C/C++Remote Application”.</para></listitem>
|
||||
<listitem><para>Locate your project and select it to bring up a new
|
||||
tabbed view in the <filename>Debug Configurations</filename> Dialog.</para></listitem>
|
||||
tabbed view in the Debug Configurations dialogue.</para></listitem>
|
||||
<listitem><para>Enter the absolute path into which you want to deploy
|
||||
the application.
|
||||
Use the <filename>Remote Absolute File Path for C/C++Application:</filename> field.
|
||||
For example, enter <filename>/usr/bin/<programname></filename>.</para></listitem>
|
||||
<listitem><para>Click on the <filename>Debugger</filename> tab to see the cross-tool debugger
|
||||
you are using.</para></listitem>
|
||||
<listitem><para>Click on the <filename>Main</filename> tab.</para></listitem>
|
||||
the application.
|
||||
Use the Remote Absolute File Path for C/C++Application:.
|
||||
For example, enter <filename>/usr/bin/<programname></filename>.</para></listitem>
|
||||
<listitem><para>Click on the Debugger tab to see the cross-tool debugger
|
||||
you are using.</para></listitem>
|
||||
<listitem><para>Create a new connection to the QEMU instance
|
||||
by clicking on <filename>new</filename>.</para></listitem>
|
||||
<listitem><para>Select <filename>TCF</filename>, which means Target Communication
|
||||
Framework.</para></listitem>
|
||||
<listitem><para>Click <filename>Next</filename>.</para></listitem>
|
||||
<listitem><para>Clear out the <filename>host name</filename> field and enter the IP Address
|
||||
determined earlier.</para></listitem>
|
||||
<listitem><para>Click <filename>Finish</filename> to close the
|
||||
<filename>New Connections</filename> Dialog.</para></listitem>
|
||||
<listitem><para>Use the drop-down menu now in the <filename>Connection</filename> field and pick
|
||||
the IP Address you entered.</para></listitem>
|
||||
<listitem><para>Click <filename>Debug</filename> to bring up a login screen
|
||||
and login.</para></listitem>
|
||||
by clicking on “new”.</para></listitem>
|
||||
<listitem><para>Select “TCF, which means Target Communication Framework.</para></listitem>
|
||||
<listitem><para>Click “Next”.</para></listitem>
|
||||
<listitem><para>Clear out the “host name” field and enter the IP Address
|
||||
determined earlier.</para></listitem>
|
||||
<listitem><para>Click Finish to close the new connections dialogue.</para></listitem>
|
||||
<listitem><para>Use the drop-down menu now in the “Connection” field and pick
|
||||
the IP Address you entered.</para></listitem>
|
||||
<listitem><para>Click “Debug” to bring up a login screen and login.</para></listitem>
|
||||
<listitem><para>Accept the debug perspective.</para></listitem>
|
||||
</orderedlist>
|
||||
</para>
|
||||
@@ -544,68 +373,58 @@
|
||||
|
||||
<section id='running-user-space-tools'>
|
||||
<title>Running User-Space Tools</title>
|
||||
|
||||
<para>
|
||||
As mentioned earlier in the manual, several tools exist that enhance
|
||||
As mentioned earlier in the manual several tools exist that enhance
|
||||
your development experience.
|
||||
These tools are aids in developing and debugging applications and images.
|
||||
You can run these user-space tools from within the Eclipse IDE through the
|
||||
<filename>Window -> YoctoTools</filename> menu.
|
||||
You can run these user-space tools from within the Yocto Eclipse
|
||||
Plug-in through the Window -> YoctoTools menu.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Once you pick a tool, you need to configure it for the remote target.
|
||||
Once you pick a tool you need to configure it for the remote target.
|
||||
Every tool needs to have the connection configured.
|
||||
You must select an existing TCF-based RSE connection to the remote target.
|
||||
If one does not exist, click <filename>New</filename> to create one.
|
||||
If one does not exist, click "New" to create one.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Here are some specifics about the remote tools:
|
||||
<itemizedlist>
|
||||
<listitem><para><emphasis><filename>OProfile</filename>:</emphasis> Selecting this tool causes
|
||||
the <filename>oprofile-server</filename> on the remote target to launch on
|
||||
the local host machine.
|
||||
The <filename>oprofile-viewer</filename> must be installed on the local host machine and the
|
||||
<filename>oprofile-server</filename> must be installed on the remote target,
|
||||
respectively, in order to use.
|
||||
You must compile and install the <filename>oprofile-viewer</filename> from the source code
|
||||
on your local host machine.
|
||||
Furthermore, in order to convert the target's sample format data into a form that the
|
||||
host can use, you must have <filename>oprofile</filename> version 0.9.4 or
|
||||
greater installed on the host.</para>
|
||||
<para>You can locate both the viewer and server from
|
||||
<ulink url='http://git.yoctoproject.org/cgit/cgit.cgi/oprofileui/'></ulink>.
|
||||
<note>The <filename>oprofile-server</filename> is installed by default on
|
||||
the <filename>core-image-sato-sdk</filename> image.</note></para></listitem>
|
||||
<listitem><para><emphasis><filename>Lttng-ust</filename>:</emphasis> Selecting this tool runs
|
||||
<filename>usttrace</filename> on the remote target, transfers the output data back to the
|
||||
local host machine, and uses <filename>lttv-gui</filename> to graphically display the output.
|
||||
The <filename>lttv-gui</filename> must be installed on the local host machine to use this tool.
|
||||
For information on how to use <filename>lttng</filename> to trace an application, see
|
||||
<ulink url='http://lttng.org/files/ust/manual/ust.html'></ulink>.</para>
|
||||
<para>For <filename>Application</filename>, you must supply the absolute path name of the
|
||||
application to be traced by user mode <filename>lttng</filename>.
|
||||
For example, typing <filename>/path/to/foo</filename> triggers
|
||||
<filename>usttrace /path/to/foo</filename> on the remote target to trace the
|
||||
program <filename>/path/to/foo</filename>.</para>
|
||||
<para><filename>Argument</filename> is passed to <filename>usttrace</filename>
|
||||
running on the remote target.</para></listitem>
|
||||
<listitem><para><emphasis><filename>PowerTOP</filename>:</emphasis> Selecting this tool runs
|
||||
<filename>powertop</filename> on the remote target machine and displays the results in a
|
||||
new view called <filename>powertop</filename>.</para>
|
||||
<para><filename>Time to gather data(sec):</filename> is the time passed in seconds before data
|
||||
is gathered from the remote target for analysis.</para>
|
||||
<para><filename>show pids in wakeups list:</filename> corresponds to the
|
||||
<filename>-p</filename> argument
|
||||
passed to <filename>powertop</filename>.</para></listitem>
|
||||
<listitem><para><emphasis><filename>LatencyTOP and Perf</filename>:</emphasis>
|
||||
<filename>latencytop</filename> identifies system latency, while
|
||||
<filename>perf</filename> monitors the system's
|
||||
performance counter registers.
|
||||
Selecting either of these tools causes an RSE terminal view to appear
|
||||
from which you can run the tools.
|
||||
Both tools refresh the entire screen to display results while they run.</para></listitem>
|
||||
<listitem><para><emphasis>OProfile:</emphasis> Selecting this tool causes
|
||||
the oprofile-server on the remote target to launch on the local host machine.
|
||||
The oprofile-viewer must be installed on the local host machine and the
|
||||
oprofile-server must be installed on the remote target, respectively, in order
|
||||
to use.
|
||||
You can locate both the viewer and server from
|
||||
<ulink url='http://git.yoctoproject.org/cgit/cgit.cgi/oprofileui/'></ulink>.
|
||||
You need to compile and install the oprofile-viewer from the source code
|
||||
on your local host machine.
|
||||
The oprofile-server is installed by default in the image.</para></listitem>
|
||||
<listitem><para><emphasis>Lttng-ust:</emphasis> Selecting this tool runs
|
||||
"usttrace" on the remote target, transfers the output data back to the
|
||||
local host machine and uses "lttv-gui" to graphically display the output.
|
||||
The "lttv-gui" must be installed on the local host machine to use this tool.
|
||||
For information on how to use "lttng" to trace an application, see
|
||||
<ulink url='http://lttng.org/files/ust/manual/ust.html'></ulink>.</para>
|
||||
<para>For "Application" you must supply the absolute path name of the
|
||||
application to be traced by user mode lttng.
|
||||
For example, typing <filename>/path/to/foo</filename> triggers
|
||||
<filename>usttrace /path/to/foo</filename> on the remote target to trace the
|
||||
program <filename>/path/to/foo</filename>.</para>
|
||||
<para>"Argument" is passed to <filename>usttrace</filename>
|
||||
running on the remote target.</para></listitem>
|
||||
<listitem><para><emphasis>PowerTOP:</emphasis> Selecting this tool runs
|
||||
"PowerTOP" on the remote target machine and displays the results in a
|
||||
new view called "powertop".</para>
|
||||
<para>"Time to gather data(sec):" is the time passed in seconds before data
|
||||
is gathered from the remote target for analysis.</para>
|
||||
<para>"show pids in wakeups list:" corresponds to the -p argument
|
||||
passed to "powertop".</para></listitem>
|
||||
<listitem><para><emphasis>LatencyTOP and Perf:</emphasis> "LatencyTOP"
|
||||
identifies system latency, while "perf" monitors the system's
|
||||
performance counter registers.
|
||||
Selecting either of these tools causes an RSE terminal view to appear
|
||||
from which you can run the tools.
|
||||
Both tools refresh the entire screen to display results while they run.</para></listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
@@ -13,43 +13,29 @@
|
||||
|
||||
<section id='book-intro'>
|
||||
<title>Introducing the Application Development Toolkit (ADT)</title>
|
||||
|
||||
<para>
|
||||
Fundamentally, the ADT consists of an architecture-specific cross-toolchain and
|
||||
a matching sysroot that are both built by the Yocto Project build system Poky.
|
||||
a matching sysroot that are both built by the Poky build system.
|
||||
The toolchain and sysroot are based on a metadata configuration and extensions,
|
||||
which allows you to cross-develop on the host machine for the target.
|
||||
which allows you to cross develop for the target on the host machine.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Additionally, to provide an effective development platform, the Yocto Project
|
||||
makes available and suggests other tools you can use with the ADT.
|
||||
makes available and suggests other tools as part of the ADT.
|
||||
These other tools include the Eclipse IDE Yocto Plug-in, an emulator (QEMU),
|
||||
and various user-space tools that greatly enhance your development experience.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The resulting combination of the architecture-specific cross-toolchain and sysroot
|
||||
along with these additional tools yields a custom-built, cross-development platform
|
||||
for a user-targeted product.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id='adt-components'>
|
||||
<title>ADT Components</title>
|
||||
|
||||
<para>
|
||||
This section provides a brief description of what comprises the ADT.
|
||||
</para>
|
||||
|
||||
<section id='the-cross-toolchain'>
|
||||
<title>The Cross-Toolchain</title>
|
||||
|
||||
<para>
|
||||
The cross-toolchain consists of a cross-compiler, cross-linker, and cross-debugger
|
||||
that are used to develop user-space applications for targeted hardware.
|
||||
This toolchain is created either by running the ADT Installer script or
|
||||
through a Yocto Project build tree that is based on your metadata
|
||||
that are all generated through a Poky build that is based on your metadata
|
||||
configuration or extension for your targeted device.
|
||||
The cross-toolchain works with a matching target sysroot.
|
||||
</para>
|
||||
@@ -57,76 +43,70 @@
|
||||
|
||||
<section id='sysroot'>
|
||||
<title>Sysroot</title>
|
||||
|
||||
<para>
|
||||
The matching target sysroot contains needed headers and libraries for generating
|
||||
binaries that run on the target architecture.
|
||||
The sysroot is based on the target root filesystem image that is built by
|
||||
the Yocto Project's build system Poky and uses the same metadata configuration
|
||||
used to build the cross-toolchain.
|
||||
Poky and uses the same metadata configuration used to build the cross-toolchain.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id='the-qemu-emulator'>
|
||||
<title>The QEMU Emulator</title>
|
||||
|
||||
<para>
|
||||
The QEMU emulator allows you to simulate your hardware while running your
|
||||
application or image.
|
||||
QEMU is made available a number of ways:
|
||||
<itemizedlist>
|
||||
<listitem><para>If you use the ADT Installer script to install ADT, you can
|
||||
specify whether or not to install QEMU.</para></listitem>
|
||||
<listitem><para>If you have downloaded a Yocto Project release and unpacked
|
||||
it to create a Yocto Project file structure and you have sourced
|
||||
the Yocto Project environment setup script, QEMU is installed and automatically
|
||||
available.</para></listitem>
|
||||
<listitem><para>If you have installed the cross-toolchain
|
||||
tarball and you have sourcing the toolchain's setup environment script, QEMU
|
||||
is also installed and automatically available.</para></listitem>
|
||||
</itemizedlist>
|
||||
application or image.
|
||||
QEMU is installed several ways: as part of the Poky tree, ADT installation
|
||||
through a toolchain tarball, or through the ADT Installer.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id='user-space-tools'>
|
||||
<title>User-Space Tools</title>
|
||||
|
||||
<para>
|
||||
User-space tools are included as part of the distribution.
|
||||
You will find these tools helpful during development.
|
||||
The tools include LatencyTOP, PowerTOP, OProfile, Perf, SystemTap, and Lttng-ust.
|
||||
These tools are common development tools for the Linux platform.
|
||||
<itemizedlist>
|
||||
<listitem><para><emphasis>LatencyTOP:</emphasis> LatencyTOP focuses on latency
|
||||
that causes skips in audio,
|
||||
stutters in your desktop experience, or situations that overload your server
|
||||
even when you have plenty of CPU power left.
|
||||
You can find out more about LatencyTOP at
|
||||
<ulink url='http://www.latencytop.org/'></ulink>.</para></listitem>
|
||||
<listitem><para><emphasis>PowerTOP:</emphasis> Helps you determine what
|
||||
software is using the most power.
|
||||
You can find out more about PowerTOP at
|
||||
<ulink url='http://www.linuxpowertop.org/'></ulink>.</para></listitem>
|
||||
<listitem><para><emphasis>OProfile:</emphasis> A system-wide profiler for Linux
|
||||
systems that is capable of profiling all running code at low overhead.
|
||||
You can find out more about OProfile at
|
||||
<ulink url='http://oprofile.sourceforge.net/about/'></ulink>.</para></listitem>
|
||||
<listitem><para><emphasis>Perf:</emphasis> Performance counters for Linux used
|
||||
to keep track of certain types of hardware and software events.
|
||||
For more information on these types of counters see
|
||||
<ulink url='https://perf.wiki.kernel.org/index.php'></ulink> and click
|
||||
on “Perf tools.”</para></listitem>
|
||||
<listitem><para><emphasis>SystemTap:</emphasis> A free software infrastructure
|
||||
that simplifies information gathering about a running Linux system.
|
||||
This information helps you diagnose performance or functional problems.
|
||||
SystemTap is not available as a user-space tool through the Yocto Eclipse IDE Plug-in.
|
||||
See <ulink url='http://sourceware.org/systemtap'></ulink> for more information
|
||||
on SystemTap.</para></listitem>
|
||||
<listitem><para><emphasis>Lttng-ust:</emphasis> A User-space Tracer designed to
|
||||
provide detailed information on user-space activity.
|
||||
See <ulink url='http://lttng.org/ust'></ulink> for more information on Lttng-ust.
|
||||
</para></listitem>
|
||||
</itemizedlist>
|
||||
<itemizedlist>
|
||||
<listitem><para><emphasis>LatencyTOP</emphasis> – LatencyTOP focuses on latency
|
||||
that causes skips in audio,
|
||||
stutters in your desktop experience, or situations that overload your server
|
||||
even when you have plenty of CPU power left.
|
||||
You can find out more about LatencyTOP at
|
||||
<ulink url='http://www.latencytop.org/'></ulink>.
|
||||
</para></listitem>
|
||||
<listitem><para><emphasis>PowerTOP</emphasis> – Helps you determine what
|
||||
software is using the most power.
|
||||
You can find out more about PowerTOP at
|
||||
<ulink url='http://www.linuxpowertop.org/'></ulink>.
|
||||
</para></listitem>
|
||||
<listitem><para><emphasis>OProfile</emphasis> – A system-wide profiler for Linux
|
||||
systems that is capable
|
||||
of profiling all running code at low overhead.
|
||||
You can find out more about OProfile at
|
||||
<ulink url='http://oprofile.sourceforge.net/about/'></ulink>.
|
||||
</para></listitem>
|
||||
<listitem><para><emphasis>Perf</emphasis> – Performance counters for Linux used
|
||||
to keep track of certain
|
||||
types of hardware and software events.
|
||||
For more information on these types of counters see
|
||||
<ulink url='https://perf.wiki.kernel.org/index.php'></ulink> and click
|
||||
on “Perf tools.”
|
||||
</para></listitem>
|
||||
<listitem><para><emphasis>SystemTap</emphasis> – A free software infrastructure
|
||||
that simplifies
|
||||
information gathering about a running Linux system.
|
||||
This information helps you diagnose performance or functional problems.
|
||||
SystemTap is not available as a user-space tool through the Yocto Eclipse IDE Plug-in.
|
||||
See <ulink url='http://sourceware.org/systemtap'></ulink> for more information
|
||||
on SystemTap.
|
||||
</para></listitem>
|
||||
<listitem><para><emphasis>Lttng-ust</emphasis> – A User-space Tracer designed to
|
||||
provide detailed information on user-space activity.
|
||||
See <ulink url='http://lttng.org/ust'></ulink> for more information on Lttng-ust.
|
||||
</para></listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
</section>
|
||||
</section>
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
</imageobject>
|
||||
</mediaobject>
|
||||
|
||||
<title></title>
|
||||
<title></title>
|
||||
|
||||
<authorgroup>
|
||||
<author>
|
||||
@@ -31,17 +31,17 @@
|
||||
<revision>
|
||||
<revnumber>1.0</revnumber>
|
||||
<date>6 April 2011</date>
|
||||
<revremark>Released with the Yocto Project 1.0 Release.</revremark>
|
||||
<revremark>Initial Document released with Yocto Project 1.0 on 6 April 2011.</revremark>
|
||||
</revision>
|
||||
<revision>
|
||||
<revnumber>1.0.1</revnumber>
|
||||
<date>23 May 2011</date>
|
||||
<revremark>Released with the Yocto Project 1.0.1 Release.</revremark>
|
||||
<revremark>Released with Yocto Project 1.0.1 on 23 May 2011.</revremark>
|
||||
</revision>
|
||||
<revision>
|
||||
<revnumber>1.1</revnumber>
|
||||
<date>6 October 2011</date>
|
||||
<revremark>Released with the Yocto Project 1.1 Release.</revremark>
|
||||
<revnumber>1.0.2</revnumber>
|
||||
<date>20 December 2011</date>
|
||||
<revremark>Released with Yocto Project 1.0.2 on 20 December 2011.</revremark>
|
||||
</revision>
|
||||
</revhistory>
|
||||
|
||||
@@ -55,15 +55,6 @@
|
||||
Permission is granted to copy, distribute and/or modify this document under
|
||||
the terms of the <ulink type="http" url="http://creativecommons.org/licenses/by-sa/2.0/uk/">Creative Commons Attribution-Share Alike 2.0 UK: England & Wales</ulink> as published by Creative Commons.
|
||||
</para>
|
||||
<note>
|
||||
Due to production processes, there could be differences between the Yocto Project
|
||||
documentation bundled in the release tarball and the
|
||||
<ulink url='http://www.yoctoproject.org/docs/latest/adt-manual/adt-manual.html'>
|
||||
Application Developer's Toolkit (ADT) User's Guide</ulink> on
|
||||
the <ulink url='http://www.yoctoproject.org'>Yocto Project</ulink> website.
|
||||
For the latest version of this manual, see the manual on the website.
|
||||
</note>
|
||||
|
||||
</legalnotice>
|
||||
|
||||
</bookinfo>
|
||||
|
||||
@@ -3,93 +3,76 @@
|
||||
|
||||
<chapter id='adt-package'>
|
||||
<title>Optionally Customizing the Development Packages Installation</title>
|
||||
|
||||
<para>
|
||||
Because the Yocto Project is suited for embedded Linux development, it is
|
||||
Because the Yocto Project is suited for embedded Linux development it is
|
||||
likely that you will need to customize your development packages installation.
|
||||
For example, if you are developing a minimal image, then you might not need
|
||||
For example, if you are developing a minimal image then you might not need
|
||||
certain packages (e.g. graphics support packages).
|
||||
Thus, you would like to be able to remove those packages from your target sysroot.
|
||||
Thus, you would like to be able to remove those packages from your sysroot.
|
||||
</para>
|
||||
|
||||
<section id='package-management-systems'>
|
||||
<title>Package Management Systems</title>
|
||||
|
||||
<para>
|
||||
The Yocto Project supports the generation of sysroot files using
|
||||
The Yocto Project supports the generation of root filesystem files using
|
||||
three different Package Management Systems (PMS):
|
||||
<itemizedlist>
|
||||
<listitem><para><emphasis>OPKG:</emphasis> A less well known PMS whose use
|
||||
originated in the OpenEmbedded and OpenWrt embedded Linux projects.
|
||||
This PMS works with files packaged in an <filename>.ipk</filename> format.
|
||||
See <ulink url='http://en.wikipedia.org/wiki/Opkg'></ulink> for more
|
||||
information about OPKG.</para></listitem>
|
||||
<listitem><para><emphasis>RPM:</emphasis> A more widely known PMS intended for GNU/Linux
|
||||
distributions.
|
||||
This PMS works with files packaged in an <filename>.rms</filename> format.
|
||||
The Yocto Project currently installs through this PMS by default.
|
||||
See <ulink url='http://en.wikipedia.org/wiki/RPM_Package_Manager'></ulink>
|
||||
for more information about RPM.</para></listitem>
|
||||
<listitem><para><emphasis>Debian:</emphasis> The PMS for Debian-based systems
|
||||
is built on many PMS tools.
|
||||
The lower-level PMS tool <filename>dpkg</filename> forms the base of the Debian PMS.
|
||||
For information on dpkg see
|
||||
<ulink url='http://en.wikipedia.org/wiki/Dpkg'></ulink>.</para></listitem>
|
||||
</itemizedlist>
|
||||
<itemizedlist>
|
||||
<listitem><para><emphasis>OPKG</emphasis> – A less well known PMS whose use
|
||||
originated in the OpenEmbedded and OpenWrt embedded Linux projects.
|
||||
This PMS works with files packaged in an <filename>.ipk</filename> format.
|
||||
See <ulink url='http://en.wikipedia.org/wiki/Opkg'></ulink> for more
|
||||
information about OPKG.</para></listitem>
|
||||
<listitem><para><emphasis>RPM</emphasis> – A more widely known PMS intended for GNU/Linux
|
||||
distributions.
|
||||
This PMS works with files packaged in an <filename>.rms</filename> format.
|
||||
The Yocto Project currently installs through this PMS by default.
|
||||
See <ulink url='http://en.wikipedia.org/wiki/RPM_Package_Manager'></ulink>
|
||||
for more information about RPM.</para></listitem>
|
||||
<listitem><para><emphasis>Debian</emphasis> – The PMS for Debian-based systems
|
||||
is built on many PMS tools.
|
||||
The lower-level PMS tool dpkg forms the base of the Debian PMS.
|
||||
For information on dpkg see
|
||||
<ulink url='http://en.wikipedia.org/wiki/Dpkg'></ulink>.</para></listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id='configuring-the-pms'>
|
||||
<title>Configuring the PMS</title>
|
||||
|
||||
<para>
|
||||
Whichever PMS you are using, you need to be sure that the
|
||||
Whichever PMS you are using you need to be sure that the
|
||||
<filename>PACKAGE_CLASSES</filename> variable in the <filename>conf/local.conf</filename>
|
||||
file is set to reflect that system.
|
||||
The first value you choose for the variable specifies the package file format for the root
|
||||
filesystem at sysroot.
|
||||
filesystem.
|
||||
Additional values specify additional formats for convenience or testing.
|
||||
See the configuration file for details.
|
||||
</para>
|
||||
|
||||
<note>
|
||||
For build performance information related to the PMS, see
|
||||
<ulink url='http://www.yoctoproject.org/docs/latest/poky-ref-manual/poky-ref-manual.html#ref-classes-package'>Packaging - <filename>package*.bbclass</filename></ulink>
|
||||
in <ulink url='http://www.yoctoproject.org/docs/latest/poky-ref-manual/poky-ref-manual.html'>
|
||||
The Yocto Project Reference Manual</ulink>.
|
||||
</note>
|
||||
|
||||
<para>
|
||||
As an example, consider a scenario where you are using OPKG and you want to add
|
||||
the <filename>libglade</filename> package to the target sysroot.
|
||||
the libglade package to sysroot.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
First, you should generate the <filename>ipk</filename> file for the
|
||||
<filename>libglade</filename> package and add it
|
||||
into a working <filename>opkg</filename> repository.
|
||||
First, you should generate the ipk file for the libglade package and add it
|
||||
into a working opkg repository.
|
||||
Use these commands:
|
||||
<literallayout class='monospaced'>
|
||||
$ bitbake libglade
|
||||
$ bitbake package-index
|
||||
</literallayout>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Next, source the environment setup script found in the Yocto Project files.
|
||||
Next, source the environment setup script.
|
||||
Follow that by setting up the installation destination to point to your
|
||||
sysroot as <filename><sysroot_dir></filename>.
|
||||
Finally, have an OPKG configuration file <filename><conf_file></filename>
|
||||
that corresponds to the <filename>opkg</filename> repository you have just created.
|
||||
sysroot as <filename><sysroot dir></filename>.
|
||||
Finally, have an opkg configuration file <filename><conf file></filename>
|
||||
that corresponds to the opkg repository you have just created.
|
||||
The following command forms should now work:
|
||||
<literallayout class='monospaced'>
|
||||
$ opkg-cl –f <conf_file> -o <sysroot_dir> update
|
||||
$ opkg-cl –f <cconf_file> -o <sysroot_dir> \
|
||||
--force-overwrite install libglade
|
||||
$ opkg-cl –f <cconf_file> -o <sysroot_dir> \
|
||||
--force-overwrite install libglade-dbg
|
||||
$ opkg-cl –f <conf_file> -o <sysroot_dir> \
|
||||
--force-overwrite install libglade-dev
|
||||
$ opkg-cl –f <conf file> -o <sysroot dir> update
|
||||
$ opkg-cl –f <conf file>> -o <sysroot dir> --force-overwrite install libglade
|
||||
$ opkg-cl –f <conf file> -o <sysroot dir> --force-overwrite install libglade-dbg
|
||||
$ opkg-cl –f <conf file> -o <sysroot dir> --force-overwrite install libglade-dev
|
||||
</literallayout>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
@@ -6,435 +6,236 @@
|
||||
<title>Preparing to Use the Application Development Toolkit (ADT)</title>
|
||||
|
||||
<para>
|
||||
In order to use the ADT, you must install it, <filename>source</filename> a script to set up the
|
||||
environment, and be sure both the kernel and filesystem image specific to the target architecture
|
||||
exist.
|
||||
This chapter describes how to be sure you meet the ADT requirements.
|
||||
In order to use the ADT it must be installed, the environment setup script must be
|
||||
sourced, and the kernel and filesystem image specific to the target architecture must exist.
|
||||
This section describes how to install the ADT, set up the environment, and provides
|
||||
some reference information on kernels and filesystem images.
|
||||
</para>
|
||||
|
||||
<section id='installing-the-adt'>
|
||||
<title>Installing the ADT</title>
|
||||
|
||||
<para>
|
||||
The following list describes how you can install the ADT, which includes the cross-toolchain.
|
||||
Regardless of the installation you choose, you must <filename>source</filename> the cross-toolchain
|
||||
environment setup script before you use the toolchain.
|
||||
See the "<link linkend='setting-up-the-cross-development-environment'>Setting Up the
|
||||
Cross-Development Environment</link>"
|
||||
section for more information.
|
||||
<itemizedlist>
|
||||
<listitem><para><emphasis>Use the ADT Installer Script:</emphasis>
|
||||
This method is the recommended way to install the ADT because it
|
||||
automates much of the process for you.
|
||||
For example, you can configure the installation to install the QEMU emulator
|
||||
and the user-space NFS, specify which root filesystem profiles to download,
|
||||
and define the target sysroot location.</para></listitem>
|
||||
<listitem><para><emphasis>Use an Existing Toolchain Tarball:</emphasis>
|
||||
Using this method, you select and download an architecture-specific
|
||||
toolchain tarball and then hand-install the toolchain.
|
||||
If you use this method, you just get the cross-toolchain and QEMU - you do not
|
||||
get any of the other mentioned benefits had you run the ADT Installer script.</para></listitem>
|
||||
<listitem><para><emphasis>Use the Toolchain from within a Yocto Project Build Tree:</emphasis>
|
||||
If you already have a Yocto Project build tree, you can build the cross-toolchain
|
||||
within tree.
|
||||
However, like the previous method mentioned, you only get the cross-toolchain and QEMU - you
|
||||
do not get any of the other benefits without taking separate steps.</para></listitem>
|
||||
</itemizedlist>
|
||||
You can install the ADT three ways.
|
||||
However, we recommend configuring and running the ADT Installer script.
|
||||
Running this script automates much of the process for you.
|
||||
For example, the script allows you to install the QEMU emulator and
|
||||
user-space NFS, define which root filesystem profiles to download,
|
||||
and allows you to define the target sysroot location.
|
||||
</para>
|
||||
<note>
|
||||
If you need to generate the ADT tarball you can do so using the following command:
|
||||
<literallayout class='monospaced'>
|
||||
$ bitbake adt-installer
|
||||
</literallayout>
|
||||
This command generates the file <filename>adt-installer.tar.bz2</filename>
|
||||
in the <filename>../build/tmp/deploy/sdk</filename> directory.
|
||||
</note>
|
||||
|
||||
<section id='using-the-adt-installer'>
|
||||
<title>Using the ADT Installer</title>
|
||||
|
||||
<section id='configuring-and-running-the-adt-installer'>
|
||||
<title>Configuring and Running the ADT Installer</title>
|
||||
<para>
|
||||
To run the ADT Installer, you need to first get the ADT Installer tarball and then run the ADT
|
||||
Installer Script.
|
||||
The ADT Installer is contained in a tarball that can be built using
|
||||
<filename>bitbake adt-installer</filename>.
|
||||
Yocto Project has a pre-built ADT Installer tarball that you can download
|
||||
from <filename>tmp/deploy/sdk</filename> located in the build directory.
|
||||
</para>
|
||||
|
||||
<section id='getting-the-adt-installer-tarball'>
|
||||
<title>Getting the ADT Installer Tarball</title>
|
||||
<note>
|
||||
You can install and run the ADT Installer tarball in any directory you want.
|
||||
</note>
|
||||
|
||||
<para>
|
||||
The ADT Installer is contained in the ADT Installer tarball.
|
||||
You can download the tarball into any directory from
|
||||
<ulink url='http://downloads.yoctoproject.org/releases/yocto/yocto-1.1/adt_installer'></ulink>.
|
||||
Or, you can use BitBake to generate the tarball inside the existing Yocto Project
|
||||
build tree.
|
||||
</para>
|
||||
<para>
|
||||
Before running the ADT Installer you need to configure it by editing
|
||||
the <filename>adt-installer.conf</filename> file, which is located in the
|
||||
directory where the ADT Installer tarball was installed.
|
||||
Your configurations determine which kernel and filesystem image are downloaded.
|
||||
The following list describes the variables you can define for the ADT Installer.
|
||||
For configuration values and restrictions see the comments in
|
||||
the <filename>adt-installer.conf</filename> file:
|
||||
|
||||
<para>
|
||||
If you use BitBake to generate the ADT Installer tarball, you must
|
||||
<filename>source</filename> the Yocto Project environment setup script
|
||||
(<filename>oe-init-build-env</filename>) located
|
||||
in the Yocto Project file structure before running the <filename>bitbake</filename>
|
||||
command that creates the tarball.
|
||||
</para>
|
||||
<itemizedlist>
|
||||
<listitem><para><filename>YOCTOADT_IPKG_REPO</filename> – This area
|
||||
includes the IPKG-based packages and the root filesystem upon which
|
||||
the installation is based.
|
||||
If you want to set up your own IPKG repository pointed to by
|
||||
<filename>YOCTOADT_IPKG_REPO</filename>, you need to be sure that the
|
||||
directory structure follows the same layout as the reference directory
|
||||
set up at <ulink url='http://adtrepo.yoctoproject.org'></ulink>.
|
||||
Also, your repository needs to be accessible through HTTP.
|
||||
</para></listitem>
|
||||
<listitem><para><filename>YOCTOADT-TARGETS</filename> – The machine
|
||||
target architectures for which you want to set up cross-development
|
||||
environments.
|
||||
</para></listitem>
|
||||
<listitem><para><filename>YOCTOADT_QEMU</filename> – Indicates whether
|
||||
or not to install the emulator QEMU.
|
||||
</para></listitem>
|
||||
<listitem><para><filename>YOCTOADT_NFS_UTIL</filename> – Indicates whether
|
||||
or not to install user-mode NFS.
|
||||
If you plan to use the Yocto Eclipse IDE plug-in against QEMU,
|
||||
you should install NFS.
|
||||
<note>
|
||||
To boot QEMU images using our userspace NFS server, you need
|
||||
to be running portmap or rpcbind.
|
||||
If you are running rpcbind, you will also need to add the -i
|
||||
option when rpcbind starts up.
|
||||
Please make sure you understand the security implications of doing this.
|
||||
Your firewall settings may also have to be modified to allow
|
||||
NFS booting to work.
|
||||
</note>
|
||||
</para></listitem>
|
||||
<listitem><para><filename>YOCTOADT_ROOTFS_<arch></filename> - The root
|
||||
filesystem images you want to download.
|
||||
</para></listitem>
|
||||
<listitem><para><filename>YOCTOADT_TARGET_SYSROOT_IMAGE_<arch></filename> - The
|
||||
root filesystem used to extract and create the target sysroot.
|
||||
</para></listitem>
|
||||
<listitem><para><filename>YOCTOADT_TARGET_SYSROOT_LOC_<arch></filename> - The
|
||||
location of the target sysroot that will be set up on the development machine.
|
||||
</para></listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The following example commands download the Yocto Project release tarball, set up the Yocto
|
||||
Project files structure, set up the environment while also creating the
|
||||
default Yocto Project build tree,
|
||||
and run the <filename>bitbake</filename> command that results in the tarball
|
||||
<filename>~/yocto-project/build/tmp/deploy/sdk/adt_installer.tar.bz2</filename>:
|
||||
<literallayout class='monospaced'>
|
||||
$ cd ~
|
||||
$ mkdir yocto-project
|
||||
$ cd yocto-project
|
||||
$ wget http://downloads.yoctoproject.org/releases/yocto/yocto-1.1/poky-edison-6.0.tar.bz2
|
||||
$ tar xjf poky-edison-6.0.tar.bz2
|
||||
$ source poky-edison-6.0/oe-init-build-env
|
||||
$ bitbake adt-installer
|
||||
</literallayout>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id='configuring-and-running-the-adt-installer-script'>
|
||||
<title>Configuring and Running the ADT Installer Script</title>
|
||||
|
||||
<para>
|
||||
Before running the ADT Installer script, you need to unpack the tarball.
|
||||
You can unpack the tarball in any directory you wish.
|
||||
Unpacking it creates the directory <filename>adt-installer</filename>,
|
||||
which contains the ADT Installer script (<filename>adt_installer</filename>)
|
||||
and its configuration file (<filename>adt_installer.conf</filename>).
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Before you run the script, however, you should examine the ADT Installer configuration
|
||||
file and be sure you are going to get what you want.
|
||||
Your configurations determine which kernel and filesystem image are downloaded.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The following list describes the configurations you can define for the ADT Installer.
|
||||
For configuration values and restrictions, see the comments in
|
||||
the <filename>adt-installer.conf</filename> file:
|
||||
|
||||
<itemizedlist>
|
||||
<listitem><para><filename>YOCTOADT_REPO</filename>: This area
|
||||
includes the IPKG-based packages and the root filesystem upon which
|
||||
the installation is based.
|
||||
If you want to set up your own IPKG repository pointed to by
|
||||
<filename>YOCTOADT_REPO</filename>, you need to be sure that the
|
||||
directory structure follows the same layout as the reference directory
|
||||
set up at <ulink url='http://adtrepo.yoctoproject.org'></ulink>.
|
||||
Also, your repository needs to be accessible through HTTP.</para></listitem>
|
||||
<listitem><para><filename>YOCTOADT_TARGETS</filename>: The machine
|
||||
target architectures for which you want to set up cross-development
|
||||
environments.</para></listitem>
|
||||
<listitem><para><filename>YOCTOADT_QEMU</filename>: Indicates whether
|
||||
or not to install the emulator QEMU.</para></listitem>
|
||||
<listitem><para><filename>YOCTOADT_NFS_UTIL</filename>: Indicates whether
|
||||
or not to install user-mode NFS.
|
||||
If you plan to use the Yocto Eclipse IDE plug-in against QEMU,
|
||||
you should install NFS.
|
||||
<note>To boot QEMU images using our userspace NFS server, you need
|
||||
to be running <filename>portmap</filename> or <filename>rpcbind</filename>.
|
||||
If you are running <filename>rpcbind</filename>, you will also need to add the
|
||||
<filename>-i</filename> option when <filename>rpcbind</filename> starts up.
|
||||
Please make sure you understand the security implications of doing this.
|
||||
You might also have to modify your firewall settings to allow
|
||||
NFS booting to work.</note></para></listitem>
|
||||
<listitem><para><filename>YOCTOADT_ROOTFS_<arch></filename>: The root
|
||||
filesystem images you want to download from the
|
||||
<filename>YOCTOADT_IPKG_REPO</filename> repository.</para></listitem>
|
||||
<listitem><para><filename>YOCTOADT_TARGET_SYSROOT_IMAGE_<arch></filename>: The
|
||||
particular root filesystem used to extract and create the target sysroot.
|
||||
The value of this variable must have been specified with
|
||||
<filename>YOCTOADT_ROOTFS_<arch></filename>.
|
||||
For example, if you downloaded both <filename>minimal</filename> and
|
||||
<filename>sato-sdk</filename> images by setting
|
||||
<filename>YOCTOADT_ROOTFS_<arch></filename>
|
||||
to "minimal sato-sdk", then <filename>YOCTOADT_ROOTFS_<arch></filename>
|
||||
must be set to either <filename>minimal</filename> or
|
||||
<filename>sato-sdk</filename>.</para></listitem>
|
||||
<listitem><para><filename>YOCTOADT_TARGET_SYSROOT_LOC_<arch></filename>: The
|
||||
location on the development host where the target sysroot is created.
|
||||
</para></listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
After you have configured the <filename>adt_installer.conf</filename> file,
|
||||
run the installer using the following command:
|
||||
<literallayout class='monospaced'>
|
||||
<para>
|
||||
After you have configured the <filename>adt-installer.conf</filename> file,
|
||||
run the installer using the following command:
|
||||
<literallayout class='monospaced'>
|
||||
$ adt_installer
|
||||
</literallayout>
|
||||
</para>
|
||||
</literallayout>
|
||||
</para>
|
||||
|
||||
<note>
|
||||
The ADT Installer requires the <filename>libtool</filename> package to complete.
|
||||
If you install the recommended packages as described in the
|
||||
"<ulink url='http://www.yoctoproject.org/docs/latest/yocto-project-qs/yocto-project-qs.html#packages'>Packages</ulink>"
|
||||
section of
|
||||
<ulink url='http://www.yoctoproject.org/docs/latest/yocto-project-qs/yocto-project-qs.html'>
|
||||
The Yocto Project Quick Start</ulink>, then you will have libtool installed.
|
||||
</note>
|
||||
<para>
|
||||
Once the installer begins to run you are asked whether you want to run in
|
||||
interactive or silent mode.
|
||||
If you want to closely monitor the installation then choose “I” for interactive
|
||||
mode rather than “S” for silent mode.
|
||||
Follow the prompts from the script to complete the installation.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Once the installer begins to run, you are asked whether you want to run in
|
||||
interactive or silent mode.
|
||||
If you want to closely monitor the installation, choose “I” for interactive
|
||||
mode rather than “S” for silent mode.
|
||||
Follow the prompts from the script to complete the installation.
|
||||
</para>
|
||||
<para>
|
||||
Once the installation completes, the cross-toolchain is installed in
|
||||
<filename>/opt/poky/$SDKVERSION</filename>.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Once the installation completes, the ADT, which includes the cross-toolchain, is installed.
|
||||
You will notice environment setup files for the cross-toolchain in
|
||||
<filename>/opt/poky/1.1</filename>,
|
||||
and image tarballs in the <filename>adt-installer</filename>
|
||||
directory according to your installer configurations, and the target sysroot located
|
||||
according to the <filename>YOCTOADT_TARGET_SYSROOT_LOC_<arch></filename> variable
|
||||
also in your configuration file.
|
||||
</para>
|
||||
</section>
|
||||
<para>
|
||||
Before using the ADT you need to run the environment setup script for
|
||||
your target architecture also located in <filename>/opt/poky/$SDKVERSION</filename>.
|
||||
See the <xref linkend='setting-up-the-environment'>“Setting Up the Environment”</xref>
|
||||
section for information.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id='using-an-existing-toolchain-tarball'>
|
||||
<title>Using a Cross-Toolchain Tarball</title>
|
||||
|
||||
<para>
|
||||
If you want to simply install the cross-toolchain by hand, you can do so by using an existing
|
||||
cross-toolchain tarball.
|
||||
If you use this method to install the cross-toolchain and you still need to install the target
|
||||
sysroot, you will have to install sysroot separately.
|
||||
</para>
|
||||
|
||||
<title>Using an Existing Toolchain Tarball</title>
|
||||
<para>
|
||||
If you do not want to use the ADT Installer you can install the toolchain
|
||||
and the sysroot by hand.
|
||||
Follow these steps:
|
||||
<orderedlist>
|
||||
<listitem><para>Go to
|
||||
<ulink url='http://downloads.yoctoproject.org/releases/yocto/yocto-1.1/toolchain'></ulink>
|
||||
and find the folder that matches your host development system
|
||||
(i.e. <filename>i686</filename> for 32-bit machines or
|
||||
<filename>x86_64</filename> for 64-bit machines).</para></listitem>
|
||||
<listitem><para>Go into that folder and download the toolchain tarball whose name
|
||||
includes the appropriate target architecture.
|
||||
For example, if your host development system is an Intel-based 64-bit system and
|
||||
you are going to use your cross-toolchain for an Intel-based 32-bit target, go into the
|
||||
<filename>x86_64</filename> folder and download the following tarball:
|
||||
<literallayout class='monospaced'>
|
||||
poky-eglibc-x86_64-i586-toolchain-gmae-1.1.tar.bz2
|
||||
</literallayout>
|
||||
<note><para>As an alternative to steps one and two, you can build the toolchain tarball
|
||||
if you have a Yocto Project build tree.
|
||||
If you need GMAE, you should use the <filename>bitbake meta-toolchain-gmae</filename>
|
||||
command.
|
||||
The resulting tarball will support such development.
|
||||
However, if you are not concerned with GMAE,
|
||||
you can generate the tarball using <filename>bitbake meta-toolchain</filename>.</para>
|
||||
<para>Use the appropriate <filename>bitbake</filename> command only after you have
|
||||
sourced the <filename>oe-build-init-env</filename> script located in the Yocto
|
||||
Project files.
|
||||
When the <filename>bitbake</filename> command completes, the tarball will
|
||||
be in <filename>tmp/deploy/sdk</filename> in the Yocto Project build tree.
|
||||
</para></note></para></listitem>
|
||||
<listitem><para>Make sure you are in the root directory with root privileges and then expand
|
||||
the tarball.
|
||||
The tarball expands into <filename>/opt/poky/1.1</filename>.
|
||||
Once the tarball is expanded, the cross-toolchain is installed.
|
||||
You will notice environment setup files for the cross-toolchain in the directory.
|
||||
</para></listitem>
|
||||
<listitem><para>Locate and download the architecture-specific toolchain
|
||||
tarball from <ulink url='http://autobuilder.yoctoproject.org/downloads/yocto-1.0'></ulink>.
|
||||
Look in the ‘toolchain’ folder and then open up the folder that matches your
|
||||
host development system (i.e. 'i686' for 32-bit machines or 'x86_64'
|
||||
for 64-bit machines).
|
||||
Then, select the toolchain tarball whose name includes the appropriate
|
||||
target architecture.
|
||||
<note>
|
||||
If you need to build the toolchain tarball use the
|
||||
<filename>bitbake meta-toolchain</filename> command after you have
|
||||
sourced the poky-build-init script.
|
||||
The tarball will be located in the build directory at
|
||||
<filename>tmp/deploy/sdk</filename> after the build.
|
||||
</note>
|
||||
</para></listitem>
|
||||
<listitem><para>Make sure you are in the root directory and then expand
|
||||
the tarball.
|
||||
The tarball expands into the <filename>/opt/poky/$SDKVERSION</filename> directory.
|
||||
</para></listitem>
|
||||
<listitem><para>Set up the environment by sourcing the environment set up
|
||||
script.
|
||||
See the <xref linkend='setting-up-the-environment'>“Setting Up the Environment”</xref>
|
||||
for information.
|
||||
</para></listitem>
|
||||
</orderedlist>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id='using-the-toolchain-from-within-the-build-tree'>
|
||||
<title>Using BitBake and the Yocto Project Build Tree</title>
|
||||
|
||||
<title>Using the Toolchain from Within the Build Tree</title>
|
||||
<para>
|
||||
A final way of installing just the cross-toolchain is to use BitBake to build the
|
||||
toolchain within an existing Yocto Project build tree.
|
||||
This method does not install the toolchain into the <filename>/opt</filename> directory.
|
||||
As with the previous method, if you need to install the target sysroot, you must
|
||||
do this separately.
|
||||
A final way of accessing the toolchain is from the build tree.
|
||||
The build tree can be set up to contain the architecture-specific cross toolchain.
|
||||
To populate the build tree with the toolchain you need to run the following command:
|
||||
<literallayout class='monospaced'>
|
||||
$ bitbake meta-ide-support
|
||||
</literallayout>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Before running the command you need to be sure that the
|
||||
<filename>conf/local.conf</filename> file in the build directory has
|
||||
the desired architecture specified for the <filename>MACHINE</filename>
|
||||
variable.
|
||||
See the <filename>local.conf</filename> file for a list of values you
|
||||
can supply for this variable.
|
||||
You can populate the build tree with the cross-toolchains for more
|
||||
than a single architecture.
|
||||
You just need to edit the <filename>local.conf</filename> file and re-run
|
||||
the BitBake command.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Follow these steps to build and install the toolchain into the build tree:
|
||||
<orderedlist>
|
||||
<listitem><para>Source the environment setup script
|
||||
<filename>oe-init-build-env</filename> located in the Yocto Project
|
||||
files.</para></listitem>
|
||||
<listitem><para>At this point, you should be sure that the
|
||||
<filename>MACHINE</filename> variable
|
||||
in the <filename>local.conf</filename> file found in the
|
||||
<filename>conf</filename> directory of the Yocto Project build directory
|
||||
is set for the target architecture.
|
||||
Comments within the <filename>local.conf</filename> file list the values you
|
||||
can use for the <filename>MACHINE</filename> variable.
|
||||
<note>You can populate the build tree with the cross-toolchains for more
|
||||
than a single architecture.
|
||||
You just need to edit the <filename>MACHINE</filename> variable in the
|
||||
<filename>local.conf</filename> file and re-run the BitBake
|
||||
command.</note></para></listitem>
|
||||
<listitem><para>Run <filename>bitbake meta-ide-support</filename> to complete the
|
||||
cross-toolchain installation.
|
||||
<note>If change out of your working directory after you
|
||||
<filename>source</filename> the environment setup script and before you run
|
||||
the <filename>bitbake</filename> command, the command might not work.
|
||||
Be sure to run the <filename>bitbake</filename> command immediately
|
||||
after checking or editing the <filename>local.conf</filename> but without
|
||||
changing out of your working directory.</note>
|
||||
Once the <filename>bitbake</filename> command finishes,
|
||||
the tarball for the cross-toolchain is generated within the Yocto Project build tree.
|
||||
You will notice environment setup files for the cross-toolchain in the
|
||||
Yocto Project build tree in the <filename>tmp</filename> directory.
|
||||
Setup script filenames contain the strings <filename>environment-setup</filename>.
|
||||
</para></listitem>
|
||||
</orderedlist>
|
||||
Once the build tree has the toolchain you need to source the environment
|
||||
setup script so that you can run the cross-tools without having to locate them.
|
||||
See the <xref linkend='setting-up-the-environment'>“Setting Up the Environment”</xref>
|
||||
for information.
|
||||
</para>
|
||||
</section>
|
||||
</section>
|
||||
|
||||
<section id='setting-up-the-cross-development-environment'>
|
||||
<title>Setting Up the Cross-Development Environment</title>
|
||||
|
||||
<section id='setting-up-the-environment'>
|
||||
<title>Setting Up the Environment</title>
|
||||
<para>
|
||||
Before you can develop using the cross-toolchain, you need to set up the
|
||||
cross-development environment by sourcing the toolchain's environment setup script.
|
||||
If you used the ADT Installer or used an existing ADT tarball to install the ADT,
|
||||
then you can find this script in the <filename>/opt/poky/1.1</filename>
|
||||
Before you can use the cross-toolchain you need to set up the environment by
|
||||
sourcing the environment setup script.
|
||||
If you used adt_installer or used an existing ADT tarball to install the ADT,
|
||||
then you can find this script in the <filename>/opt/poky/$SDKVERSION</filename>
|
||||
directory.
|
||||
If you installed the toolchain in the build tree, you can find the environment setup
|
||||
script for the toolchain in the Yocto Project build tree's <filename>tmp</filename> directory.
|
||||
If you are using the ADT from a Poky build tree, then look in the build
|
||||
directory in <filename>tmp</filename> for the setup script.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Be sure to run the environment setup script that matches the architecture for
|
||||
which you are developing.
|
||||
Environment setup scripts begin with the string “<filename>environment-setup</filename>”
|
||||
and include as part of their name the architecture.
|
||||
For example, the toolchain environment setup script for a 64-bit IA-based architecture would
|
||||
Environment setup scripts begin with the string “environment-setup” and include as
|
||||
part of their name the architecture.
|
||||
For example, the environment setup script for a 64-bit IA-based architecture would
|
||||
be the following:
|
||||
<literallayout class='monospaced'>
|
||||
/opt/poky/1.1/environment-setup-x86_64-poky-linux
|
||||
/opt/poky/environment-setup-x86_64-poky-linux
|
||||
</literallayout>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id='securing-kernel-and-filesystem-images'>
|
||||
<title>Securing Kernel and Filesystem Images</title>
|
||||
|
||||
<section id='kernels-and-filesystem-images'>
|
||||
<title>Kernels and Filesystem Images</title>
|
||||
<para>
|
||||
You will need to have a kernel and filesystem image to boot using your
|
||||
hardware or the QEMU emulator.
|
||||
Furthermore, if you plan on booting your image using NFS or you want to use the root filesystem
|
||||
as the target sysroot, you need to extract the root filesystem.
|
||||
</para>
|
||||
|
||||
<section id='getting-the-images'>
|
||||
<title>Getting the Images</title>
|
||||
|
||||
<para>
|
||||
To get the kernel and filesystem images, you either have to build them or download
|
||||
pre-built versions.
|
||||
You can find examples for both these situations in the
|
||||
"<ulink url='http://www.yoctoproject.org/docs/latest/yocto-project-qs/yocto-project-qs.html#test-run'>A
|
||||
Quick Test Run</ulink>" section of
|
||||
<ulink url='http://www.yoctoproject.org/docs/latest/yocto-project-qs/yocto-project-qs.html'>
|
||||
The Yocto Project Quick Start</ulink>.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The Yocto Project provides basic kernel and filesystem images for several
|
||||
architectures (<filename>x86</filename>, <filename>x86-64</filename>,
|
||||
<filename>mips</filename>, <filename>powerpc</filename>, and <filename>arm</filename>)
|
||||
that you can use unaltered in the QEMU emulator.
|
||||
These kernel images reside in the Yocto Project release
|
||||
area - <ulink url='http://downloads.yoctoproject.org/releases/yocto/yocto-1.1/machines/'></ulink>
|
||||
hardware or the QEMU emulator.
|
||||
That means you either have to build them or know where to get them.
|
||||
You can find lots of details on how to get or build images and kernels for your
|
||||
architecture in the "Yocto Project Quick Start" found at
|
||||
<ulink url='http://www.yoctoproject.org/docs/yocto-quick-start/yocto-project-qs.html'></ulink>.
|
||||
<note>
|
||||
Yocto Project provides basic kernels and filesystem images for several
|
||||
architectures (x86, x86-64, mips, powerpc, and arm) that can be used
|
||||
unaltered in the QEMU emulator.
|
||||
These kernels and filesystem images reside in the Yocto Project release
|
||||
area - <ulink url='http://autobuilder.yoctoproject.org/downloads/yocto-1.0/'></ulink>
|
||||
and are ideal for experimentation within Yocto Project.
|
||||
For information on the image types you can build using the Yocto Project, see the
|
||||
"<ulink url='http://www.yoctoproject.org/docs/latest/poky-ref-manual/poky-ref-manual.html#ref-images'>Reference: Images</ulink>" appendix in
|
||||
<ulink url='http://www.yoctoproject.org/docs/latest/poky-ref-manual/poky-ref-manual.html'>
|
||||
The Yocto Project Reference Manual</ulink>.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
If you plan on remotely deploying and debugging your application from within the
|
||||
Eclipse IDE, you must have an image that contains the Yocto Target Communication
|
||||
Framework (TCF) agent (<filename>tcf-agent</filename>).
|
||||
By default, the Yocto Project provides only one type pre-built image that contains the
|
||||
<filename>tcf-agent</filename>.
|
||||
And, those images are SDK (e.g.<filename>core-image-sato-sdk</filename>).
|
||||
</para>
|
||||
|
||||
<para>
|
||||
If you want to use a different image type that contains the <filename>tcf-agent</filename>,
|
||||
you can do so one of two ways:
|
||||
<itemizedlist>
|
||||
<listitem><para>Modify the <filename>conf/local.conf</filename> configuration in
|
||||
the Yocto Project build directory and then rebuild the image.
|
||||
With this method, you need to modify the <filename>EXTRA_IMAGE_FEATURES</filename>
|
||||
variable to have the value of "tools-debug" before rebuilding the image.
|
||||
Once the image is rebuilt, the <filename>tcf-agent</filename> will be included
|
||||
in the image and is launched automatically after the boot.</para></listitem>
|
||||
<listitem><para>Manually build the <filename>tcf-agent</filename>.
|
||||
To build the agent, follow these steps:
|
||||
<orderedlist>
|
||||
<listitem><para>Be sure the ADT is installed as described in the
|
||||
"<link linkend='installing-the-adt'>Installing the ADT</link>" section.
|
||||
</para></listitem>
|
||||
<listitem><para>Set up the cross-development environment as described in the
|
||||
"<link linkend='setting-up-the-cross-development-environment'>Setting
|
||||
Up the Cross-Development Environment</link>" section.</para></listitem>
|
||||
<listitem><para>Get the <filename>tcf-agent</filename> source code, which is
|
||||
stored using the Subversion SCM, using the following command:
|
||||
<literallayout class='monospaced'>
|
||||
$ svn checkout svn://dev.eclipse.org/svnroot/dsdp/org.eclipse.tm.tcf/trunk/agent \
|
||||
<-r #rev_number>
|
||||
</literallayout></para></listitem>
|
||||
<listitem><para>Modify the <filename>Makefile.inc</filename> file
|
||||
for the cross-compilation environment by setting the
|
||||
<filename>OPSYS</filename> and <filename>MACHINE</filename>
|
||||
variables according to your target.</para></listitem>
|
||||
<listitem><para>Use the cross-development tools to build the
|
||||
<filename>tcf-agent</filename>.
|
||||
Before you "Make" the file, be sure your cross-tools are set up first.
|
||||
See the "<link linkend='makefile-based-projects'>Makefile-Based Projects</link>"
|
||||
section for information on how to make sure the cross-tools are set up
|
||||
correctly.</para>
|
||||
<para>If the build is successful, the <filename>tcf-agent</filename> output will
|
||||
be <filename>obj/$(OPSYS)/$(MACHINE)/Debug/agent</filename>.</para></listitem>
|
||||
<listitem><para>Deploy the agent into the image's root filesystem.</para></listitem>
|
||||
</orderedlist>
|
||||
</para></listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id='extracting-the-root-filesystem'>
|
||||
<title>Extracting the Root Filesystem</title>
|
||||
|
||||
<para>
|
||||
You must extract the root filesystem if you want to boot the image using NFS
|
||||
or you want to use the root filesystem as the target sysroot.
|
||||
For example, the Eclipse IDE environment with the Eclipse Yocto Plug-in installed allows you
|
||||
to use QEMU to boot under NFS.
|
||||
Another example is if you want to develop your target application using the
|
||||
root filesystem as the target sysroot.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
To extract the root filesystem, first <filename>source</filename>
|
||||
the cross-development environment setup script and then
|
||||
use the <filename>runqemu-extract-sdk</filename> command on the
|
||||
filesystem image.
|
||||
For example, the following commands set up the environment and then extract
|
||||
the root filesystem from a previously built filesystem image tarball named
|
||||
<filename>core-image-sato-sdk-qemux86-2011091411831.rootfs.tar.bz2</filename>.
|
||||
The example extracts the root filesystem into the <filename>$HOME/qemux86-sato</filename>
|
||||
directory:
|
||||
<literallayout class='monospaced'>
|
||||
$ source $HOME/poky/build/tmp/environment-setup-i586-poky-linux
|
||||
$ runqemu-extract-sdk \
|
||||
tmp/deploy/images/core-image-sato-sdk-qemux86-2011091411831.rootfs.tar.bz2 \
|
||||
$HOME/qemux86-sato
|
||||
</literallayout>
|
||||
In this case, you could now point to the target sysroot at
|
||||
<filename>$HOME/qemux86-sato</filename>.
|
||||
</para>
|
||||
</section>
|
||||
</note>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
</chapter>
|
||||
|
||||
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 14 KiB |
@@ -966,9 +966,3 @@ table {
|
||||
color: #fff;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.footnote {
|
||||
font-size: small;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,17 +18,10 @@
|
||||
<title></title>
|
||||
|
||||
<authorgroup>
|
||||
<author>
|
||||
<firstname>Tom</firstname> <surname>Zanussi</surname>
|
||||
<affiliation>
|
||||
<orgname>Intel Corporation</orgname>
|
||||
</affiliation>
|
||||
<email>tom.zanussi@intel.com</email>
|
||||
</author>
|
||||
<author>
|
||||
<firstname>Richard</firstname> <surname>Purdie</surname>
|
||||
<affiliation>
|
||||
<orgname>Linux Foundation</orgname>
|
||||
<orgname>Intel Corporation</orgname>
|
||||
</affiliation>
|
||||
<email>richard.purdie@linuxfoundation.org</email>
|
||||
</author>
|
||||
@@ -37,23 +30,24 @@
|
||||
<revhistory>
|
||||
<revision>
|
||||
<revnumber>0.9</revnumber>
|
||||
<date>24 November 2010</date>
|
||||
<revremark>The initial document draft released with the Yocto Project 0.9 Release.</revremark>
|
||||
<date>27 October 2010</date>
|
||||
<revremark>This manual revision is the initial manual and corresponds to the
|
||||
Yocto Project 0.9 Release.</revremark>
|
||||
</revision>
|
||||
<revision>
|
||||
<revnumber>1.0</revnumber>
|
||||
<date>6 April 2011</date>
|
||||
<revremark>Released with the Yocto Project 1.0 Release.</revremark>
|
||||
<revremark>This manual revision corresponds to the Yocto Project 1.0 Release.</revremark>
|
||||
</revision>
|
||||
<revision>
|
||||
<revnumber>1.0.1</revnumber>
|
||||
<date>23 May 2011</date>
|
||||
<revremark>Released with the Yocto Project 1.0.1 Release.</revremark>
|
||||
<revremark>Released with Yocto Project 1.0.1 on 23 May 2011.</revremark>
|
||||
</revision>
|
||||
<revision>
|
||||
<revnumber>1.1</revnumber>
|
||||
<date>6 October 2011</date>
|
||||
<revremark>Released with the Yocto Project 1.1 Release.</revremark>
|
||||
<revnumber>1.0.2</revnumber>
|
||||
<date>20 December 2011</date>
|
||||
<revremark>Released with Yocto Project 1.0.2 on 20 December 2011.</revremark>
|
||||
</revision>
|
||||
</revhistory>
|
||||
|
||||
@@ -67,14 +61,6 @@
|
||||
Permission is granted to copy, distribute and/or modify this document under
|
||||
the terms of the <ulink type="http" url="http://creativecommons.org/licenses/by-nc-sa/2.0/uk/">Creative Commons Attribution-Non-Commercial-Share Alike 2.0 UK: England & Wales</ulink> as published by Creative Commons.
|
||||
</para>
|
||||
<note>
|
||||
Due to production processes, there could be differences between the Yocto Project
|
||||
documentation bundled in the release tarball and the
|
||||
<ulink url='http://www.yoctoproject.org/docs/latest/bsp-guide/bsp-guide.html'>
|
||||
Board Support Package (BSP) Developer's Guide</ulink> on
|
||||
the <ulink url='http://www.yoctoproject.org'>Yocto Project</ulink> website.
|
||||
For the latest version of this manual, see the manual on the website.
|
||||
</note>
|
||||
</legalnotice>
|
||||
|
||||
</bookinfo>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
<chapter id='bsp'>
|
||||
|
||||
<title>Board Support Packages (BSP) - Developer's Guide</title>
|
||||
<title>Board Support Packages (BSP) - Developers Guide</title>
|
||||
|
||||
<para>
|
||||
A Board Support Package (BSP) is a collection of information that
|
||||
@@ -27,25 +27,13 @@
|
||||
of software support of hardware.
|
||||
</para>
|
||||
|
||||
<note>
|
||||
The information here does not provide an example of how to create a BSP.
|
||||
For examples on how to create a BSP, see the
|
||||
<ulink url='http://www.yoctoproject.org/docs/latest/dev-manual/dev-manual.html#dev-manual-bsp-appendix'>
|
||||
BSP Development Example</ulink> in
|
||||
<ulink url='http://www.yoctoproject.org/docs/latest/dev-manual/dev-manual.html'>
|
||||
The Yocto Project Development Manual</ulink>.
|
||||
You can also see the
|
||||
<ulink url='https://wiki.yoctoproject.org/wiki/Transcript:_creating_one_generic_Atom_BSP_from_another'>
|
||||
wiki page</ulink>.
|
||||
</note>
|
||||
|
||||
<para>
|
||||
The proposed format does have elements that are specific to the Yocto Project and
|
||||
The proposed format does have elements that are specific to the Poky and
|
||||
OpenEmbedded build systems.
|
||||
It is intended that this information can be
|
||||
used by other systems besides Yocto Project and OpenEmbedded and that it will be simple
|
||||
used by other systems besides Poky and OpenEmbedded and that it will be simple
|
||||
to extract information and convert it to other formats if required.
|
||||
Yocto Project, through its standard layers mechanism, can directly accept the format
|
||||
Poky, through its standard layers mechanism, can directly accept the format
|
||||
described as a layer.
|
||||
The BSP captures all
|
||||
the hardware-specific details in one place in a standard format, which is
|
||||
@@ -86,11 +74,8 @@
|
||||
|
||||
<para>
|
||||
The base directory (<filename>meta-<bsp_name></filename>) is the root of the BSP layer.
|
||||
This root is what you add to the <filename>BBLAYERS</filename>
|
||||
variable in the <filename>build/conf/bblayers.conf</filename> file found in the
|
||||
Yocto Project file's build directory.
|
||||
Adding the root allows the Yocto Project build system to recognize the BSP
|
||||
definition and from it build an image.
|
||||
This root is what you add to the BBLAYERS variable in <filename>build/conf/bblayers.conf</filename>
|
||||
so that the build system recognizes the BSP definition and from it can build an image.
|
||||
Here is an example:
|
||||
<literallayout class='monospaced'>
|
||||
BBLAYERS = " \
|
||||
@@ -100,10 +85,8 @@
|
||||
"
|
||||
</literallayout>
|
||||
For more detailed information on layers, see the
|
||||
"<ulink url='http://www.yoctoproject.org/docs/latest/poky-ref-manual/poky-ref-manual.html#usingpoky-changes-layers'>BitBake Layers</ulink>" section of the Yocto Project Reference Manual.
|
||||
You can also see the detailed examples in the appendices of
|
||||
<ulink url='http://www.yoctoproject.org/docs/latest/dev-manual/dev-manual.html'>
|
||||
The Yocto Project Development Manual</ulink>.
|
||||
<ulink url='http://www.yoctoproject.org/docs/poky-ref-manual/poky-ref-manual.html#usingpoky-changes-layers'>
|
||||
BitBake Layers</ulink> section of the Poky Reference Manual.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
@@ -111,59 +94,41 @@
|
||||
While you can use this basic form for the standard, realize that the actual structures
|
||||
for specific BSPs could differ.
|
||||
|
||||
<literallayout class='monospaced'>
|
||||
meta-<bsp_name>/
|
||||
meta-<bsp_name>/<bsp_license_file>
|
||||
meta-<bsp_name>/README
|
||||
meta-<bsp_name>/binary/<bootable_images>
|
||||
meta-<bsp_name>/conf/layer.conf
|
||||
meta-<bsp_name>/conf/machine/*.conf
|
||||
meta-<bsp_name>/recipes-bsp/*
|
||||
meta-<bsp_name>/recipes-graphics/*
|
||||
meta-<bsp_name>/recipes-kernel/linux/linux-yocto_<kernel_rev>.bbappend
|
||||
</literallayout>
|
||||
<programlisting>
|
||||
meta-<bsp_name>/
|
||||
meta-<bsp_name>/<bsp_license_file>
|
||||
meta-<bsp_name>/README
|
||||
meta-<bsp_name>/binary/<bootable_images>
|
||||
meta-<bsp_name>/conf/layer.conf
|
||||
meta-<bsp_name>/conf/machine/*.conf
|
||||
meta-<bsp_name>/recipes-bsp/*
|
||||
meta-<bsp_name>/recipes-graphics/*
|
||||
meta-<bsp_name>/recipes-kernel/linux/linux-yocto_git.bbappend
|
||||
</programlisting>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Below is an example of the Crown Bay BSP:
|
||||
Below is an example of the crownbay BSP:
|
||||
|
||||
<literallayout class='monospaced'>
|
||||
meta-crownbay/COPYING.MIT
|
||||
meta-crownbay/README
|
||||
meta-crownbay/binary
|
||||
meta-crownbay/conf/
|
||||
meta-crownbay/conf/layer.conf
|
||||
meta-crownbay/conf/machine/
|
||||
meta-crownbay/conf/machine/crownbay.conf
|
||||
meta-crownbay/conf/machine/crownbay-noemgd.conf
|
||||
meta-crownbay/recipes-bsp/
|
||||
meta-crownbay/recipes-bsp/formfactor/
|
||||
meta-crownbay/recipes-bsp/formfactor/formfactor_0.0.bbappend
|
||||
meta-crownbay/recipes-bsp/formfactor/formfactor/
|
||||
meta-crownbay/recipes-bsp/formfactor/formfactor/crownbay/
|
||||
meta-crownbay/recipes-bsp/formfactor/formfactor/crownbay/machconfig
|
||||
meta-crownbay/recipes-bsp/formfactor/formfactor/crownbay-noemgd/
|
||||
meta-crownbay/recipes-bsp/formfactor/formfactor/crownbay-noemgd/machconfig
|
||||
meta-crownbay/recipes-core
|
||||
meta-crownbay/recipes-core/tasks
|
||||
meta-crownbay/recipes-core/tasks/task-core-tools.bbappend
|
||||
meta-crownbay/recipes-graphics/
|
||||
meta-crownbay/recipes-graphics/xorg-xserver/
|
||||
meta-crownbay/recipes-graphics/xorg-xserver/emgd-driver-bin_1.6.bb
|
||||
meta-crownbay/recipes-graphics/xorg-xserver/xserver-xf86-config_0.1.bbappend
|
||||
meta-crownbay/recipes-graphics/xorg-xserver/emgd-driver-bin-1.6/
|
||||
meta-crownbay/recipes-graphics/xorg-xserver/emgd-driver-bin-1.6/.gitignore
|
||||
meta-crownbay/recipes-graphics/xorg-xserver/xserver-xf86-config/
|
||||
meta-crownbay/recipes-graphics/xorg-xserver/xserver-xf86-config/crownbay/
|
||||
meta-crownbay/recipes-graphics/xorg-xserver/xserver-xf86-config/crownbay/xorg.conf
|
||||
meta-crownbay/recipes-graphics/xorg-xserver/xserver-xf86-config/crownbay-noemgd/
|
||||
meta-crownbay/recipes-graphics/xorg-xserver/xserver-xf86-config/crownbay-noemgd/xorg.conf
|
||||
meta-crownbay/recipes-kernel/
|
||||
meta-crownbay/recipes-kernel/linux/
|
||||
meta-crownbay/recipes-kernel/linux/linux-yocto_2.6.34.bbappend
|
||||
meta-crownbay/recipes-kernel/linux/linux-yocto_2.6.37.bbappend
|
||||
meta-crownbay/recipes-kernel/linux/linux-yocto_3.0.bbappend
|
||||
</literallayout>
|
||||
<programlisting>
|
||||
meta-crownbay/COPYING.MIT
|
||||
meta-crownbay/README
|
||||
meta-crownbay/binary/.gitignore
|
||||
meta-crownbay/conf/layer.conf
|
||||
meta-crownbay/conf/machine/crownbay.conf
|
||||
meta-crownbay/recipes-bsp/formfactor/formfactor/crownbay/machconfig
|
||||
meta-crownbay/recipes-bsp/formfactor/formfactor_0.0.bbappend
|
||||
meta-crownbay/recipes-graphics/xorg-xserver/xserver-xf86-config/crownbay/xcorg.conf
|
||||
meta-crownbay/recipes-graphics/xorg-xserver/xserver-xf86-config_0.1.bbappend
|
||||
meta-crownbay/recipes-graphics/xorg-xserver/xserver-xf86-emgd-bin/.gitignore
|
||||
meta-crownbay/recipes-graphics/xorg-xserver/xserver-xf86-emgd-bin_1.7.99.2.bb
|
||||
meta-crownbay/recipes-graphics/xorg-xserver/xserver-xf86-emgd/crosscompile.patch
|
||||
meta-crownbay/recipes-graphics/xorg-xserver/xserver-xf86-emgd/fix_open_max_preprocessor_error.patch
|
||||
meta-crownbay/recipes-graphics/xorg-xserver/xserver-xf86-emgd/macro_tweak.patch
|
||||
meta-crownbay/recipes-graphics/xorg-xserver/xserver-xf86-emgd/nodolt.patch
|
||||
meta-crownbay/recipes-graphics/xorg-xserver/xserver-xf86-emgd_1.7.99.2.bb
|
||||
meta-crownbay/recipes-kernel/linux/linux-yocto_git.bbappend
|
||||
</programlisting>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
@@ -172,18 +137,14 @@
|
||||
|
||||
<section id="bsp-filelayout-license">
|
||||
<title>License Files</title>
|
||||
|
||||
<para>
|
||||
You can find these files in the Yocto Project file's directory structure at:
|
||||
<literallayout class='monospaced'>
|
||||
meta-<bsp_name>/<bsp_license_file>
|
||||
</literallayout>
|
||||
</para>
|
||||
<programlisting>
|
||||
meta-<bsp_name>/<bsp_license_file>
|
||||
</programlisting>
|
||||
|
||||
<para>
|
||||
These optional files satisfy licensing requirements for the BSP.
|
||||
The type or types of files here can vary depending on the licensing requirements.
|
||||
For example, in the Crown Bay BSP all licensing requirements are handled with the
|
||||
For example, in the crownbay BSP all licensing requirements are handled with the
|
||||
<filename>COPYING.MIT</filename> file.
|
||||
</para>
|
||||
|
||||
@@ -195,12 +156,9 @@
|
||||
|
||||
<section id="bsp-filelayout-readme">
|
||||
<title>README File</title>
|
||||
<para>
|
||||
You can find these files in the Yocto Project file's directory structure at:
|
||||
<literallayout class='monospaced'>
|
||||
meta-<bsp_name>/README
|
||||
</literallayout>
|
||||
</para>
|
||||
<programlisting>
|
||||
meta-<bsp_name>/README
|
||||
</programlisting>
|
||||
|
||||
<para>
|
||||
This file provides information on how to boot the live images that are optionally
|
||||
@@ -217,12 +175,9 @@
|
||||
|
||||
<section id="bsp-filelayout-binary">
|
||||
<title>Pre-built User Binaries</title>
|
||||
<para>
|
||||
You can find these files in the Yocto Project file's directory structure at:
|
||||
<literallayout class='monospaced'>
|
||||
meta-<bsp_name>/binary/<bootable_images>
|
||||
</literallayout>
|
||||
</para>
|
||||
<programlisting>
|
||||
meta-<bsp_name>/binary/<bootable_images>
|
||||
</programlisting>
|
||||
|
||||
<para>
|
||||
This optional area contains useful pre-built kernels and user-space filesystem
|
||||
@@ -244,64 +199,56 @@
|
||||
|
||||
<section id='bsp-filelayout-layer'>
|
||||
<title>Layer Configuration File</title>
|
||||
<para>
|
||||
You can find this file in the Yocto Project file's directory structure at:
|
||||
<literallayout class='monospaced'>
|
||||
meta-<bsp_name>/conf/layer.conf
|
||||
</literallayout>
|
||||
</para>
|
||||
<programlisting>
|
||||
meta-<bsp_name>/conf/layer.conf
|
||||
</programlisting>
|
||||
|
||||
<para>
|
||||
The <filename>conf/layer.conf</filename> file identifies the file structure as a Yocto
|
||||
Project layer, identifies the
|
||||
contents of the layer, and contains information about how Yocto Project should use it.
|
||||
This file identifies the structure as a Poky layer, identifies the
|
||||
contents of the layer, and contains information about how Poky should use it.
|
||||
Generally, a standard boilerplate file such as the following works.
|
||||
In the following example you would replace "bsp" and "_bsp" with the actual name
|
||||
of the BSP (i.e. <bsp_name> from the example template).
|
||||
</para>
|
||||
|
||||
<para>
|
||||
<literallayout class='monospaced'>
|
||||
# We have a conf directory, add to BBPATH
|
||||
BBPATH := "${BBPATH}:${LAYERDIR}"
|
||||
<programlisting>
|
||||
# We have a conf directory, add to BBPATH
|
||||
BBPATH := "${BBPATH}:${LAYERDIR}"
|
||||
|
||||
# We have a recipes directory containing .bb and .bbappend files, add to BBFILES
|
||||
BBFILES := "${BBFILES} ${LAYERDIR}/recipes/*/*.bb \
|
||||
${LAYERDIR}/recipes/*/*.bbappend"
|
||||
# We have a recipes directory containing .bb and .bbappend files, add to BBFILES
|
||||
BBFILES := "${BBFILES} ${LAYERDIR}/recipes/*/*.bb \
|
||||
${LAYERDIR}/recipes/*/*.bbappend"
|
||||
|
||||
BBFILE_COLLECTIONS += "bsp"
|
||||
BBFILE_PATTERN_bsp := "^${LAYERDIR}/"
|
||||
BBFILE_PRIORITY_bsp = "5"
|
||||
</literallayout>
|
||||
BBFILE_COLLECTIONS += "bsp"
|
||||
BBFILE_PATTERN_bsp := "^${LAYERDIR}/"
|
||||
BBFILE_PRIORITY_bsp = "5"
|
||||
</programlisting>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
This file simply makes BitBake aware of the recipes and configuration directories.
|
||||
This file must exist so that the Yocto Project build system can recognize the BSP.
|
||||
This file must exist so that Poky can recognize the BSP.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="bsp-filelayout-machine">
|
||||
<title>Hardware Configuration Options</title>
|
||||
<para>
|
||||
You can find these files in the Yocto Project file's directory structure at:
|
||||
<literallayout class='monospaced'>
|
||||
meta-<bsp_name>/conf/machine/*.conf
|
||||
</literallayout>
|
||||
</para>
|
||||
<programlisting>
|
||||
meta-<bsp_name>/conf/machine/*.conf
|
||||
</programlisting>
|
||||
|
||||
<para>
|
||||
The machine files bind together all the information contained elsewhere
|
||||
in the BSP into a format that the Yocto Project build system can understand.
|
||||
in the BSP into a format that Poky can understand.
|
||||
If the BSP supports multiple machines, multiple machine configuration files
|
||||
can be present.
|
||||
These filenames correspond to the values to which users have set the
|
||||
<filename>MACHINE</filename> variable.
|
||||
These filenames correspond to the values to which users have set the MACHINE variable.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
These files define things such as the kernel package to use
|
||||
(<filename>PREFERRED_PROVIDER</filename> of virtual/kernel), the hardware drivers to
|
||||
(PREFERRED_PROVIDER of virtual/kernel), the hardware drivers to
|
||||
include in different types of images, any special software components
|
||||
that are needed, any bootloader information, and also any special image
|
||||
format requirements.
|
||||
@@ -310,61 +257,49 @@
|
||||
<para>
|
||||
At least one machine file is required for a BSP layer.
|
||||
However, you can supply more than one file.
|
||||
For example, in the Crown Bay BSP shown earlier in this section, the
|
||||
<filename>conf/machine</filename> directory contains two configuration files:
|
||||
<filename>crownbay.conf</filename> and <filename>crownbay-noemgd.conf</filename>.
|
||||
The <filename>crownbay.conf</filename> file is used for the Crown Bay BSP
|
||||
that supports the <trademark class='registered'>Intel</trademark> Embedded
|
||||
Media and Graphics Driver (<trademark class='registered'>Intel</trademark>
|
||||
EMGD), while the <filename>crownbay-noemgd.conf</filename> file is used for the
|
||||
Crown Bay BSP that does not support the <trademark class='registered'>Intel</trademark>
|
||||
EMGD.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
This <filename>crownbay.conf</filename> file could also include
|
||||
a hardware "tuning" file that is commonly used to
|
||||
define the the package architecture and specify
|
||||
optimization flags, which are carefully chosen to give best
|
||||
performance on a given processor.
|
||||
This directory could also contain shared hardware "tuning" definitions that are commonly used to
|
||||
pass specific optimization flags to the compiler.
|
||||
An example is <filename>tune-atom.inc</filename>:
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Tuning files are found in the <filename>meta/conf/machine/include</filename>
|
||||
directory.
|
||||
To use them, you simply include them in the machine configuration file.
|
||||
For example, the Crown Bay BSP <filename>crownbay.conf</filename> has the
|
||||
following statement:
|
||||
<literallayout class='monospaced'>
|
||||
include conf/machine/include/tune-atom.inc
|
||||
</literallayout>
|
||||
<programlisting>
|
||||
BASE_PACKAGE_ARCH = "core2"
|
||||
TARGET_CC_ARCH = "-m32 -march=core2 -msse3 -mtune=generic -mfpmath=sse"
|
||||
</programlisting>
|
||||
</para>
|
||||
<para>
|
||||
This example defines a new package architecture called "core2" and uses the
|
||||
specified optimization flags, which are carefully chosen to give best
|
||||
performance on atom processors.
|
||||
</para>
|
||||
<para>
|
||||
The tune file would be included by the machine definition and can be
|
||||
contained in the BSP or referenced from one of the standard core set of
|
||||
files included with Poky itself.
|
||||
</para>
|
||||
<para>
|
||||
Both the base package architecture file and the tune file are optional for a Poky BSP layer.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id='bsp-filelayout-misc-recipes'>
|
||||
<title>Miscellaneous Recipe Files</title>
|
||||
<para>
|
||||
You can find these files in the Yocto Project file's directory structure at:
|
||||
<literallayout class='monospaced'>
|
||||
meta-<bsp_name>/recipes-bsp/*
|
||||
</literallayout>
|
||||
</para>
|
||||
<programlisting>
|
||||
meta-<bsp_name>/recipes-bsp/*
|
||||
</programlisting>
|
||||
|
||||
<para>
|
||||
This optional directory contains miscellaneous recipe files for the BSP.
|
||||
Most notably would be the formfactor files.
|
||||
For example, in the Crown Bay BSP there is the
|
||||
<filename>formfactor_0.0.bbappend</filename> file, which is an append file used
|
||||
to augment the recipe that starts the build.
|
||||
Furthermore, there are machine-specific settings used during the build that are
|
||||
defined by the <filename>machconfig</filename> files.
|
||||
In the Crown Bay example, two <filename>machconfig</filename> files exist:
|
||||
one that supports the Intel EMGD and one that does not:
|
||||
<literallayout class='monospaced'>
|
||||
meta-crownbay/recipes-bsp/formfactor/formfactor/crownbay/machconfig
|
||||
meta-crownbay/recipes-bsp/formfactor/formfactor/crownbay-noemgd/machconfig
|
||||
meta-crownbay/recipes-bsp/formfactor/formfactor_0.0.bbappend
|
||||
</literallayout>
|
||||
For example, in the crownbay BSP there is a <filename>machconfig</filename> file and a
|
||||
<filename>formfactor_0.0.bbappend</filename> file:
|
||||
<programlisting>
|
||||
meta-crownbay/recipes-bsp/formfactor/formfactor/crownbay/machconfig
|
||||
meta-crownbay/recipes-bsp/formfactor/formfactor_0.0.bbappend
|
||||
</programlisting>
|
||||
</para>
|
||||
|
||||
<note><para>
|
||||
@@ -373,197 +308,233 @@
|
||||
</para></note>
|
||||
</section>
|
||||
|
||||
<section id='bsp-filelayout-core-recipes'>
|
||||
<title>Core Recipe Files</title>
|
||||
<para>
|
||||
You can find these files in the Yocto Project file's directory structure at:
|
||||
<literallayout class='monospaced'>
|
||||
meta-<bsp_name>/recipes-core/*
|
||||
</literallayout>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
This directory contains recipe files for the core.
|
||||
For example, in the Crown Bay BSP there is the
|
||||
<filename>task-core-tools.bbappend</filename> file, which is an append file used
|
||||
to recommend that the SystemTap package be included as a package when the image
|
||||
is built.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id='bsp-filelayout-recipes-graphics'>
|
||||
<title>Display Support Files</title>
|
||||
<para>
|
||||
You can find these files in the Yocto Project file's directory structure at:
|
||||
<literallayout class='monospaced'>
|
||||
meta-<bsp_name>/recipes-graphics/*
|
||||
</literallayout>
|
||||
</para>
|
||||
<programlisting>
|
||||
meta-<bsp_name>/recipes-graphics/*
|
||||
</programlisting>
|
||||
|
||||
<para>
|
||||
This optional directory contains recipes for the BSP if it has
|
||||
special requirements for graphics support.
|
||||
All files that are needed for the BSP to support a display are kept here.
|
||||
For example, the Crown Bay BSP contains the following files that support
|
||||
building a BSP that supports and does not support the Intel EMGD:
|
||||
<literallayout class='monospaced'>
|
||||
meta-crownbay/recipes-graphics/xorg-xserver/emgd-driver-bin_1.6.bb
|
||||
meta-crownbay/recipes-graphics/xorg-xserver/xserver-xf86-config_0.1.bbappend
|
||||
meta-crownbay/recipes-graphics/xorg-xserver/xserver-xf86-config/crownbay/xorg.conf
|
||||
meta-crownbay/recipes-graphics/xorg-xserver/xserver-xf86-config/crownbay-noemgd/xorg.conf
|
||||
</literallayout>
|
||||
For example, in the crownbay BSP several display support files exist:
|
||||
<programlisting>
|
||||
meta-crownbay/recipes-graphics/xorg-xserver/xserver-xf86-config/crownbay/xcorg.conf
|
||||
meta-crownbay/recipes-graphics/xorg-xserver/xserver-xf86-config_0.1.bbappend
|
||||
meta-crownbay/recipes-graphics/xorg-xserver/xserver-xf86-emgd-bin/.gitignore
|
||||
meta-crownbay/recipes-graphics/xorg-xserver/xserver-xf86-emgd-bin_1.7.99.2.bb
|
||||
meta-crownbay/recipes-graphics/xorg-xserver/xserver-xf86-emgd/crosscompile.patch
|
||||
meta-crownbay/recipes-graphics/xorg-xserver/xserver-xf86-emgd/fix_open_max_preprocessor_error.patch
|
||||
meta-crownbay/recipes-graphics/xorg-xserver/xserver-xf86-emgd/macro_tweak.patch
|
||||
meta-crownbay/recipes-graphics/xorg-xserver/xserver-xf86-emgd/nodolt.patch
|
||||
meta-crownbay/recipes-graphics/xorg-xserver/xserver-xf86-emgd_1.7.99.2.bb
|
||||
</programlisting>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id='bsp-filelayout-kernel'>
|
||||
<title>Linux Kernel Configuration</title>
|
||||
<para>
|
||||
You can find these files in the Yocto Project file's directory structure at:
|
||||
<literallayout class='monospaced'>
|
||||
meta-<bsp_name>/recipes-kernel/linux/linux-yocto_*.bbappend
|
||||
</literallayout>
|
||||
</para>
|
||||
<programlisting>
|
||||
meta-<bsp_name>/recipes-kernel/linux/linux-yocto_git.bbappend
|
||||
</programlisting>
|
||||
|
||||
<para>
|
||||
These files append your specific changes to the kernel you are using.
|
||||
This file appends your specific changes to the kernel you are using.
|
||||
</para>
|
||||
<para>
|
||||
For your BSP, you typically want to use an existing Yocto Project kernel found in the
|
||||
Yocto Project repository at <filename>meta/recipes-kernel/linux</filename>.
|
||||
You can append your specific changes to the kernel recipe by using a
|
||||
similarly named append file, which is located in the
|
||||
<filename>meta-<bsp_name>/recipes-kernel/linux</filename>
|
||||
For your BSP you typically want to use an existing Poky kernel found in the
|
||||
Poky repository at <filename class='directory'>meta/recipes-kernel/kernel</filename>.
|
||||
You can append your specific changes to the kernel recipe by using an append file,
|
||||
which is located in the
|
||||
<filename class='directory'>meta-<bsp_name>/recipes-kernel/linux</filename>
|
||||
directory.
|
||||
</para>
|
||||
<para>
|
||||
Suppose you use a BSP that uses the <filename>linux-yocto_3.0.bb</filename> kernel,
|
||||
Suppose you use a BSP that uses the <filename>linux-yocto_git.bb</filename> kernel,
|
||||
which is the preferred kernel to use for developing a new BSP using the Yocto Project.
|
||||
In other words, you have selected the kernel in your
|
||||
<filename><bsp_name>.conf</filename> file by adding the following statements:
|
||||
<literallayout class='monospaced'>
|
||||
PREFERRED_PROVIDER_virtual/kernel ?= "linux-yocto"
|
||||
PREFERRED_VERSION_linux-yocto = "3.0%"
|
||||
</literallayout>
|
||||
You would use the <filename>linux-yocto_3.0.bbappend</filename> file to append
|
||||
<filename><bsp_name>.conf</filename> file by adding the following statement:
|
||||
<programlisting>
|
||||
PREFERRED_PROVIDER_virtual/kernel ?= "linux-yocto"
|
||||
</programlisting>
|
||||
You would use the <filename>linux-yocto_git.bbappend</filename> file to append
|
||||
specific BSP settings to the kernel, thus configuring the kernel for your particular BSP.
|
||||
</para>
|
||||
<para>
|
||||
As an example, look at the existing Crown Bay BSP.
|
||||
Now take a look at the existing "crownbay" BSP.
|
||||
The append file used is:
|
||||
<literallayout class='monospaced'>
|
||||
meta-crownbay/recipes-kernel/linux/linux-yocto_3.0.bbappend
|
||||
</literallayout>
|
||||
<programlisting>
|
||||
meta-crownbay/recipes-kernel/linux/linux-yocto_git.bbappend
|
||||
</programlisting>
|
||||
The file contains the following:
|
||||
<literallayout class='monospaced'>
|
||||
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
|
||||
|
||||
COMPATIBLE_MACHINE_crownbay = "crownbay"
|
||||
KMACHINE_crownbay = "yocto/standard/crownbay"
|
||||
KERNEL_FEATURES_append_crownbay += " cfg/smp.scc"
|
||||
|
||||
COMPATIBLE_MACHINE_crownbay-noemgd = "crownbay-noemgd"
|
||||
KMACHINE_crownbay-noemgd = "yocto/standard/crownbay"
|
||||
KERNEL_FEATURES_append_crownbay-noemgd += " cfg/smp.scc"
|
||||
|
||||
SRCREV_machine_pn-linux-yocto_crownbay ?= "6b4b9acde5fb0ff66ae58fa98274bfe631501499"
|
||||
SRCREV_meta_pn-linux-yocto_crownbay ?= "5b535279e61197cb194bb2dfceb8b7a04128387c"
|
||||
|
||||
SRCREV_machine_pn-linux-yocto_crownbay-noemgd ?= "6b4b9acde5fb0ff66ae58fa98274bfe631501499"
|
||||
SRCREV_meta_pn-linux-yocto_crownbay-noemgd ?= "5b535279e61197cb194bb2dfceb8b7a04128387c"
|
||||
</literallayout>
|
||||
This append file contains statements used to support the Crown Bay BSP for both
|
||||
Intel EMGD and non-EMGD.
|
||||
The build process, in this case, recognizes and uses only the statements that
|
||||
apply to the defined machine name - <filename>crownbay</filename> in this case.
|
||||
So, the applicable statements in the <filename>linux-yocto_3.0.bbappend</filename>
|
||||
file are follows:
|
||||
<literallayout class='monospaced'>
|
||||
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
|
||||
|
||||
COMPATIBLE_MACHINE_crownbay = "crownbay"
|
||||
KMACHINE_crownbay = "yocto/standard/crownbay"
|
||||
KERNEL_FEATURES_append_crownbay += " cfg/smp.scc"
|
||||
|
||||
SRCREV_machine_pn-linux-yocto_crownbay ?= "6b4b9acde5fb0ff66ae58fa98274bfe631501499"
|
||||
SRCREV_meta_pn-linux-yocto_crownbay ?= "5b535279e61197cb194bb2dfceb8b7a04128387c"
|
||||
</literallayout>
|
||||
The append file defines <filename>crownbay</filename> as the compatible machine,
|
||||
defines the <filename>KMACHINE</filename>, points to some configuration fragments
|
||||
to use by setting the <filename>KERNEL_FEATURES</filename> variable, and then points
|
||||
to the specific commits in the Yocto Project files Git repository and the
|
||||
<filename>meta</filename> Git repository branches to identify the exact kernel needed
|
||||
to build the Crown Bay BSP.
|
||||
<programlisting>
|
||||
FILESEXTRAPATHS := "${THISDIR}/${PN}"
|
||||
COMPATIBLE_MACHINE_crownbay = "crownbay"
|
||||
KMACHINE_crownbay = "yocto/standard/crownbay"
|
||||
</programlisting>
|
||||
This append file adds "crownbay" as a compatible machine,
|
||||
and additionally sets a Yocto Kernel-specific variable that identifies the name of the
|
||||
BSP branch to use in the GIT repository to find configuration information.
|
||||
</para>
|
||||
<para>
|
||||
One thing missing in this particular BSP, which you will typically need when
|
||||
developing a BSP, is the kernel configuration file (<filename>.config</filename>) for your BSP.
|
||||
developing a BSP, is the kernel configuration (.config) for your BSP.
|
||||
When developing a BSP, you probably have a kernel configuration file or a set of kernel
|
||||
configuration files that, when taken together, define the kernel configuration for your BSP.
|
||||
You can accomplish this definition by putting the configurations in a file or a set of files
|
||||
inside a directory located at the same level as your append file and having the same name
|
||||
as the kernel.
|
||||
With all these conditions met simply reference those files in a
|
||||
<filename>SRC_URI</filename> statement in the append file.
|
||||
With all these conditions met simply reference those files in a SRC_URI statement in the append
|
||||
file.
|
||||
</para>
|
||||
<para>
|
||||
For example, suppose you had a set of configuration options in a file called
|
||||
<filename>defconfig</filename>.
|
||||
If you put that file inside a directory named
|
||||
<filename>/linux-yocto</filename> and then added
|
||||
a <filename>SRC_URI</filename> statement such as the following to the append file,
|
||||
those configuration
|
||||
<filename class='directory'>/linux-yocto</filename> and then added
|
||||
a SRC_URI statement such as the following to the append file, those configuration
|
||||
options will be picked up and applied when the kernel is built.
|
||||
<literallayout class='monospaced'>
|
||||
SRC_URI += "file://defconfig"
|
||||
</literallayout>
|
||||
<programlisting>
|
||||
SRC_URI += "file://defconfig"
|
||||
</programlisting>
|
||||
</para>
|
||||
<para>
|
||||
As mentioned earlier, you can group related configurations into multiple files and
|
||||
name them all in the <filename>SRC_URI</filename> statement as well.
|
||||
name them all in the SRC_URI statement as well.
|
||||
For example, you could group separate configurations specifically for Ethernet and graphics
|
||||
into their own files and add those by using a <filename>SRC_URI</filename> statement like the
|
||||
into their own files and add those by using a SRC_URI statement like the
|
||||
following in your append file:
|
||||
<literallayout class='monospaced'>
|
||||
SRC_URI += "file://defconfig \
|
||||
<programlisting>
|
||||
SRC_URI += "file://defconfig \
|
||||
file://eth.cfg \
|
||||
file://gfx.cfg"
|
||||
</literallayout>
|
||||
</programlisting>
|
||||
</para>
|
||||
<para>
|
||||
The <filename>FILESEXTRAPATHS</filename> variable is in boilerplate form here
|
||||
in order to make it easy to do that.
|
||||
The FILESEXTRAPATHS variable is in boilerplate form here in order to make it easy
|
||||
to do that.
|
||||
It basically allows those configuration files to be found by the build process.
|
||||
</para>
|
||||
<note>
|
||||
<para>
|
||||
<note><para>
|
||||
Other methods exist to accomplish grouping and defining configuration options.
|
||||
For example, you could directly add configuration options to the Yocto kernel
|
||||
<filename>meta</filename> branch for your BSP.
|
||||
<filename class='directory'>meta</filename> branch for your BSP.
|
||||
The configuration options will likely end up in that location anyway if the BSP gets
|
||||
added to the Yocto Project.
|
||||
For information on how to add these configurations directly, see
|
||||
<ulink url='http://yoctoproject.org/docs/latest/kernel-manual/kernel-manual.html'>
|
||||
The Yocto Project Kernel Architecture and Use Manual</ulink>.</para>
|
||||
<para>
|
||||
In general, however, the Yocto Project maintainers take care of moving the
|
||||
<filename>SRC_URI</filename>-specified
|
||||
configuration options to the <filename>meta</filename> branch.
|
||||
For information on how to add these configurations directly, see the
|
||||
"Yocto Project Kernel Architecture and Use Manual" on the
|
||||
<ulink url="http://yoctoproject.org/community/documentation">Yocto Project website
|
||||
Documentation Page</ulink>
|
||||
</para>
|
||||
<para>
|
||||
In general, however, the Yocto Project maintainers take care of moving the SRC_URI-specified
|
||||
configuration options to the <filename class='directory'>meta</filename> branch.
|
||||
Not only is it easier for BSP developers to not have to worry about putting those
|
||||
configurations in the branch, but having the maintainers do it allows them to apply
|
||||
'global' knowledge about the kinds of common configuration options multiple BSPs in
|
||||
the tree are typically using.
|
||||
This allows for promotion of common configurations into common features.</para>
|
||||
</note>
|
||||
This allows for promotion of common configurations into common features.
|
||||
</para></note>
|
||||
</section>
|
||||
|
||||
<!-- <section id='bsp-filelayout-packages'>
|
||||
<title>Other Software (meta-<bsp_name>/recipes-kernel/*)</title>
|
||||
|
||||
<para>
|
||||
This section describes other pieces of software that the hardware might need for best
|
||||
operation.
|
||||
Examples show some of the things you could encounter.
|
||||
The examples are standard <filename>.bb</filename> file recipes in the
|
||||
usual Poky format.
|
||||
You can include the source directly by referring to it in the source control system or
|
||||
the released tarballs of external software projects.
|
||||
You only need to provide these types of files if the platform requires them.
|
||||
</para>
|
||||
<para>
|
||||
The following file is a bootloader recipe that can be used to generate a new
|
||||
bootloader binary.
|
||||
Sometimes these files are included in the final image format and are needed to re-flash hardware.
|
||||
</para>
|
||||
<para>
|
||||
<programlisting>
|
||||
meta-Emenlow/recipes-kernel/bootloader/bootloader_0.1.bb
|
||||
</programlisting>
|
||||
</para>
|
||||
<para>
|
||||
These next two files are examples of a hardware driver and a hardware daemon that might need
|
||||
to be included in images to make the hardware useful.
|
||||
Although the example uses "modem" there may be other components needed, such as firmware.
|
||||
</para>
|
||||
<para>
|
||||
<programlisting>
|
||||
meta-Emenlow/recipes-Emenlow/modem/modem-driver_0.1.bb
|
||||
meta-Emenlow/recipes-Emenlow/modem/modem-daemon_0.1.bb
|
||||
</programlisting>
|
||||
</para>
|
||||
<para>
|
||||
Sometimes the device needs an image in a very specific format so that the update
|
||||
mechanism can accept and re-flash it.
|
||||
Recipes to build the tools needed to do this can be included with the BSP.
|
||||
Following is an example.
|
||||
</para>
|
||||
<para>
|
||||
<programlisting>
|
||||
meta-Emenlow/recipes-Emenlow/image-creator/image-creator-native_0.1.bb
|
||||
</programlisting>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id='bs-filelayout-bbappend'>
|
||||
<title>Append BSP-Specific Information to Existing Recipes</title>
|
||||
<para>
|
||||
Suppose you have a recipe such as "pointercal" that requires machine-specific information.
|
||||
At the same time, you have your new BSP code nicely partitioned into a layer through which
|
||||
you would also like to specify any machine-specific information associated with your new machine.
|
||||
Before the <filename>.bbappend</filename> extension was introduced, you would have to copy the whole
|
||||
pointercal recipe and files into your layer and then add the single file for your machine.
|
||||
</para>
|
||||
<para>
|
||||
With the <filename>.bbappend</filename> extension, however, your work becomes much easier.
|
||||
This extension allows you to easily merge BSP-specific information with the original recipe.
|
||||
Whenever BitBake finds any <filename>.bbappend</filename> files BitBake will include them after
|
||||
it loads the associated <filename>.bb</filename> file but before any finalize
|
||||
or anonymous methods are run.
|
||||
This allows the BSP layer to do whatever it might want to do to customize the original recipe.
|
||||
</para>
|
||||
<para>
|
||||
If your recipe needs to reference extra files it can use the FILESEXTRAPATHS variable
|
||||
to specify their location.
|
||||
The example below shows extra files contained in a folder called ${PN} (the package name).
|
||||
</para>
|
||||
<programlisting>
|
||||
FILESEXTRAPATHS := "${THISDIR}/${PN}"
|
||||
</programlisting>
|
||||
<para>
|
||||
This technique allows the BSP to add machine-specific configuration files to the layer directory,
|
||||
which will be picked up by BitBake.
|
||||
For an example see <filename>meta-emenlow/packages/formfactor</filename>.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="bsp-filelayout-prebuilds">
|
||||
<title>Pre-build Data (meta-<bsp_name>/prebuilds/*)</title>
|
||||
<para>
|
||||
This location can contain precompiled representations of the source code
|
||||
contained elsewhere in the BSP layer.
|
||||
Assuming a compatible configuration is used, Poky can process and use these optional pre-compiled
|
||||
representations to provide much faster build times.
|
||||
</para>
|
||||
</section> -->
|
||||
</section>
|
||||
|
||||
<section id='bsp-click-through-licensing'>
|
||||
<title>BSP 'Click-Through' Licensing Procedure</title>
|
||||
|
||||
<note> This section describes how
|
||||
<note><para> This section describes how
|
||||
click-through licensing is expected to work.
|
||||
Currently, this functionality is not yet implemented.
|
||||
</note>
|
||||
</para></note>
|
||||
|
||||
<para>
|
||||
In some cases, a BSP contains separately licensed IP
|
||||
@@ -571,7 +542,7 @@
|
||||
upon the user a requirement to accept the terms of a
|
||||
'click-through' license.
|
||||
Once the license is accepted the
|
||||
Yocto Project build system can then build and include the
|
||||
Poky build system can then build and include the
|
||||
corresponding component in the final BSP image.
|
||||
Some affected components might be essential to the normal
|
||||
functioning of the system and have no 'free' replacement
|
||||
@@ -603,7 +574,7 @@
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Several methods exist within the Yocto Project build system to satisfy the licensing
|
||||
Several methods exist within the Poky build system to satisfy the licensing
|
||||
requirements for an encumbered BSP.
|
||||
The following list describes them in preferential order:
|
||||
</para>
|
||||
@@ -617,6 +588,19 @@
|
||||
through a web form.
|
||||
</para>
|
||||
|
||||
<!--
|
||||
<ulink url='https://pokylinux.org/bsp-keys.html'>https://pokylinux.org/bsp-keys.html</ulink>
|
||||
and give the name of the BSP and your e-mail address in the web form.
|
||||
</para>
|
||||
|
||||
COMMENT: This link is not implemented at this point.
|
||||
|
||||
<programlisting>
|
||||
[screenshot of dialog box]
|
||||
</programlisting>
|
||||
|
||||
-->
|
||||
|
||||
<para>
|
||||
After agreeing to any applicable license terms, the
|
||||
BSP key(s) will be immediately sent to the address
|
||||
@@ -624,9 +608,9 @@
|
||||
environment variables when building the image:
|
||||
</para>
|
||||
|
||||
<literallayout class='monospaced'>
|
||||
$ BSPKEY_<keydomain>=<key> bitbake core-image-sato
|
||||
</literallayout>
|
||||
<programlisting>
|
||||
$ BSPKEY_<keydomain>=<key> bitbake poky-image-sato
|
||||
</programlisting>
|
||||
|
||||
<para>
|
||||
These steps allow the encumbered image to be built
|
||||
@@ -636,8 +620,7 @@
|
||||
<para>
|
||||
Equivalently and probably more conveniently, a line
|
||||
for each key can instead be put into the user's
|
||||
<filename>local.conf</filename> file found in the Yocto Project file's
|
||||
build directory.
|
||||
<filename>local.conf</filename> file.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
@@ -661,7 +644,7 @@
|
||||
These prompts usually take the form of instructions
|
||||
needed to manually fetch the encumbered package(s)
|
||||
and md5 sums into the required directory
|
||||
(e.g. the <filename>yocto/build/downloads</filename>).
|
||||
(e.g. the <filename>poky/build/downloads</filename>).
|
||||
Once the manual package fetch has been
|
||||
completed, restart the build to continue where
|
||||
it left off.
|
||||
@@ -672,9 +655,9 @@
|
||||
<listitem>
|
||||
<para>
|
||||
Get a full-featured BSP recipe rather than a key.
|
||||
You can do this by visiting the Yocto Project website's
|
||||
<ulink url='http://www.yoctoproject.org/download'>Download</ulink> page and
|
||||
clicking on "BSP Downloads".
|
||||
You can do this by visiting the applicable BSP download page from the Yocto
|
||||
Project website at
|
||||
<ulink url='http://yoctoproject.org/download/board-support-package-bsp-downloads'></ulink>.
|
||||
BSP tarballs that have proprietary information can be downloaded after agreeing
|
||||
to licensing requirements as part of the download process.
|
||||
Obtaining the code this way allows you to build an encumbered image with
|
||||
|
||||
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 15 KiB |
@@ -956,9 +956,3 @@ table {
|
||||
color: #fff;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.footnote {
|
||||
font-size: small;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,673 +0,0 @@
|
||||
<!DOCTYPE appendix PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
|
||||
|
||||
<appendix id='dev-manual-bsp-appendix'>
|
||||
|
||||
<title>BSP Development Example</title>
|
||||
|
||||
<para>
|
||||
This appendix provides a complete BSP development example.
|
||||
The example assumes the following:
|
||||
<itemizedlist>
|
||||
<listitem><para>No previous preparation or use of the Yocto Project.</para></listitem>
|
||||
<listitem><para>Use of the Crown Bay Board Support Package (BSP) as a "base" BSP from
|
||||
which to work.
|
||||
The example begins with the Crown Bay BSP as the starting point
|
||||
but ends by building a new 'atom-pc' BSP, which was based on the Crown Bay BSP.
|
||||
</para></listitem>
|
||||
<listitem><para>Shell commands assume <filename>bash</filename></para></listitem>
|
||||
<listitem><para>Example was developed on an Intel-based Core i7 platform running
|
||||
Ubuntu 10.04 LTS released in April of 2010.</para></listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
|
||||
<section id='getting-local-yocto-project-files-and-bsp-files'>
|
||||
<title>Getting Local Yocto Project Files and BSP Files</title>
|
||||
|
||||
<para>
|
||||
You need to have the Yocto Project files available on your host system.
|
||||
You can get files through tarball extraction or by cloning the <filename>poky</filename>
|
||||
Git repository.
|
||||
The following paragraphs describe both methods.
|
||||
For additional information, see the bulleted item
|
||||
"<link linkend='local-yp-release'>Yocto Project Release</link>".
|
||||
</para>
|
||||
|
||||
<para>
|
||||
As mentioned, one way to get the Yocto Project files is to use Git to clone the
|
||||
<filename>poky</filename> repository:
|
||||
<literallayout class='monospaced'>
|
||||
$ git clone git://git.yoctoproject.org/poky
|
||||
$ cd poky
|
||||
</literallayout>
|
||||
Alternatively, you can start with the downloaded Poky "edison" tarball:
|
||||
<literallayout class='monospaced'>
|
||||
$ tar xfj poky-edison-6.0.tar.bz2
|
||||
$ cd poky
|
||||
</literallayout>
|
||||
<note>If you're using the tarball method, you can ignore all the following steps that
|
||||
ask you to carry out Git operations.
|
||||
You already have the results of those operations
|
||||
in the form of the edison release tarballs.
|
||||
Consequently, there is nothing left to do other than extract those tarballs into the
|
||||
proper locations.</note>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Once you have the local <filename>poky</filename> Git repository set up,
|
||||
you have many development branches from which you can work.
|
||||
From inside the repository you can see the branch names and the tag names used
|
||||
in the Git repository using either of the following two commands:
|
||||
<literallayout class='monospaced'>
|
||||
$ git branch -a
|
||||
$ git tag -l
|
||||
</literallayout>
|
||||
For this example we are going to use the Yocto Project 1.1 Release, which is code
|
||||
named "edison".
|
||||
These commands create a local branch named <filename>edison</filename>
|
||||
that tracks the remote branch of the same name.
|
||||
<literallayout class='monospaced'>
|
||||
$ git checkout -b edison origin/edison
|
||||
Switched to a new branch 'edison'
|
||||
</literallayout>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id='choosing-a-base-bsp-app'>
|
||||
<title>Choosing a Base BSP</title>
|
||||
|
||||
<para>
|
||||
For this example, the base BSP is the <trademark class='registered'>Intel</trademark>
|
||||
<trademark class='trade'>Atom</trademark> Processor E660 with Intel Platform
|
||||
Controller Hub EG20T Development Kit, which is otherwise referred to as "Crown Bay."
|
||||
The BSP layer is <filename>meta-crownbay</filename>.
|
||||
The base BSP is simply the BSP
|
||||
we will be using as a starting point, so don't worry if you don't actually have Crown Bay
|
||||
hardware.
|
||||
The remainder of the example transforms the base BSP into a BSP that should be
|
||||
able to boot on generic atom-pc (netbook) hardware.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
For information on how to choose a base BSP, see
|
||||
"<link linkend='developing-a-board-support-package-bsp'>Developing a Board Support Package (BSP)</link>".
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id='getting-your-base-bsp-app'>
|
||||
<title>Getting Your Base BSP</title>
|
||||
|
||||
<para>
|
||||
You need to have the base BSP layer on your development system.
|
||||
Similar to the local Yocto Project files, you can get the BSP
|
||||
layer in a couple of different ways:
|
||||
download the BSP tarball and extract it, or set up a local Git repository that
|
||||
has the Yocto Project BSP layers.
|
||||
You should use the same method that you used to get the local Yocto Project files earlier.
|
||||
See "<link linkend='getting-setup'>Getting Setup</link>" for information on how to get
|
||||
the BSP files.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
This example assumes the BSP layer will be located within a directory named
|
||||
<filename>meta-intel</filename> contained within the <filename>poky</filename>
|
||||
parent directory.
|
||||
The following steps will automatically create the
|
||||
<filename>meta-intel</filename> directory and the contained
|
||||
<filename>meta-crownbay</filename> starting point in both the Git and the tarball cases.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
If you're using the Git method, you could do the following to create
|
||||
the starting layout after you have made sure you are in the <filename>poky</filename>
|
||||
directory created in the previous steps:
|
||||
<literallayout class='monospaced'>
|
||||
$ git clone git://git.yoctoproject.org/meta-intel.git
|
||||
$ cd meta-intel
|
||||
</literallayout>
|
||||
Alternatively, you can start with the downloaded Crown Bay tarball.
|
||||
You can download the edison version of the BSP tarball from the
|
||||
<ulink url='http://www.yoctoproject.org/download'>Download</ulink> page of the
|
||||
Yocto Project website.
|
||||
Here is the specific link for the tarball needed for this example:
|
||||
<ulink url='http://downloads.yoctoproject.org/releases/yocto/yocto-1.1/machines/crownbay-noemgd/crownbay-noemgd-edison-6.0.0.tar.bz2'></ulink>.
|
||||
Again, be sure that you are already in the <filename>poky</filename> directory
|
||||
as described previously before installing the tarball:
|
||||
<literallayout class='monospaced'>
|
||||
$ tar xfj crownbay-noemgd-edison-6.0.0.tar.bz2
|
||||
$ cd meta-intel
|
||||
</literallayout>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The <filename>meta-intel</filename> directory contains all the metadata
|
||||
that supports BSP creation.
|
||||
If you're using the Git method, the following
|
||||
step will switch to the edison metadata.
|
||||
If you're using the tarball method, you already have the correct metadata and can
|
||||
skip to the next step.
|
||||
Because <filename>meta-intel</filename> is its own Git repository, you will want
|
||||
to be sure you are in the appropriate branch for your work.
|
||||
For this example we are going to use the <filename>edison</filename> branch.
|
||||
<literallayout class='monospaced'>
|
||||
$ git checkout -b edison origin/edison
|
||||
Switched to a new branch 'edison'
|
||||
</literallayout>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id='making-a-copy-of-the-base bsp-to-create-your-new-bsp-layer-app'>
|
||||
<title>Making a Copy of the Base BSP to Create Your New BSP Layer</title>
|
||||
|
||||
<para>
|
||||
Now that you have the local Yocto Project files and the base BSP files, you need to create a
|
||||
new layer for your BSP.
|
||||
To create your BSP layer, you simply copy the <filename>meta-crownbay</filename>
|
||||
layer to a new layer.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
For this example, the new layer will be named <filename>meta-mymachine</filename>.
|
||||
The name should follow the BSP layer naming convention, which is
|
||||
<filename>meta-<name></filename>.
|
||||
The following assumes your working directory is <filename>meta-intel</filename>
|
||||
inside the local Yocto Project files.
|
||||
To start your new layer, just copy the new layer alongside the existing
|
||||
BSP layers in the <filename>meta-intel</filename> directory:
|
||||
<literallayout class='monospaced'>
|
||||
$ cp -a meta-crownbay/ meta-mymachine
|
||||
</literallayout>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id='making-changes-to-your-bsp-app'>
|
||||
<title>Making Changes to Your BSP</title>
|
||||
|
||||
<para>
|
||||
Right now you have two identical BSP layers with different names:
|
||||
<filename>meta-crownbay</filename> and <filename>meta-mymachine</filename>.
|
||||
You need to change your configurations so that they work for your new BSP and
|
||||
your particular hardware.
|
||||
The following sections look at each of these areas of the BSP.
|
||||
</para>
|
||||
|
||||
<section id='changing-the-bsp-configuration'>
|
||||
<title>Changing the BSP Configuration</title>
|
||||
|
||||
<para>
|
||||
We will look first at the configurations, which are all done in the layer’s
|
||||
<filename>conf</filename> directory.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
First, since in this example the new BSP will not support EMGD, we will get rid of the
|
||||
<filename>crownbay.conf</filename> file and then rename the
|
||||
<filename>crownbay-noemgd.conf</filename> file to <filename>mymachine.conf</filename>.
|
||||
Much of what we do in the configuration directory is designed to help the Yocto Project
|
||||
build system work with the new layer and to be able to find and use the right software.
|
||||
The following two commands result in a single machine configuration file named
|
||||
<filename>mymachine.conf</filename>.
|
||||
<literallayout class='monospaced'>
|
||||
$ rm meta-mymachine/conf/machine/crownbay.conf
|
||||
$ mv meta-mymachine/conf/machine/crownbay-noemgd.conf \
|
||||
meta-mymachine/conf/machine/mymachine.conf
|
||||
</literallayout>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Next, we need to make changes to the <filename>mymachine.conf</filename> itself.
|
||||
The only changes we want to make for this example are to the comment lines.
|
||||
Changing comments, of course, is never strictly necessary, but it's alway good form to make
|
||||
them reflect reality as much as possible.
|
||||
|
||||
Here, simply substitute the Crown Bay name with an appropriate name for the BSP
|
||||
(<filename>mymachine</filename> in this case) and change the description to
|
||||
something that describes your hardware.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Note that inside the <filename>mymachine.conf</filename> is the
|
||||
<filename>PREFERRED_PROVIDER_virtual/kernel</filename> statement.
|
||||
This statement identifies the kernel that the BSP is going to use.
|
||||
In this case, the BSP is using <filename>linux-yocto</filename>, which is the
|
||||
current Linux Yocto kernel based on the Linux 3.0 release.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The next configuration file in the new BSP layer we need to edit is
|
||||
<filename>meta-mymachine/conf/layer.conf</filename>.
|
||||
This file identifies build information needed for the new layer.
|
||||
You can see the
|
||||
"<ulink url='http://www.yoctoproject.org/docs/latest/bsp-guide/bsp-guide.html#bsp-filelayout-layer'>Layer Configuration File</ulink>" section in
|
||||
<ulink url='http://www.yoctoproject.org/docs/latest/bsp-guide/bsp-guide.html'>The Board
|
||||
Support Packages (BSP) Development Guide</ulink>
|
||||
for more information on this configuration file.
|
||||
Basically, we are changing the existing statements to work with our BSP.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The file contains these statements that reference the Crown Bay BSP:
|
||||
<literallayout class='monospaced'>
|
||||
BBFILE_COLLECTIONS += "crownbay"
|
||||
BBFILE_PATTERN_crownbay := "^${LAYERDIR}/"
|
||||
BBFILE_PRIORITY_crownbay = "6"
|
||||
</literallayout>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Simply substitute the machine string name <filename>crownbay</filename>
|
||||
with the new machine name <filename>mymachine</filename> to get the following:
|
||||
<literallayout class='monospaced'>
|
||||
BBFILE_COLLECTIONS += "mymachine"
|
||||
BBFILE_PATTERN_mymachine := "^${LAYERDIR}/"
|
||||
BBFILE_PRIORITY_mymachine = "6"
|
||||
</literallayout>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id='changing-the-recipes-in-your-bsp'>
|
||||
<title>Changing the Recipes in Your BSP</title>
|
||||
|
||||
<para>
|
||||
Now we will take a look at the recipes in your new layer.
|
||||
The standard BSP structure has areas for BSP, graphics, core, and kernel recipes.
|
||||
When you create a BSP, you use these areas for appropriate recipes and append files.
|
||||
Recipes take the form of <filename>.bb</filename> files.
|
||||
If you want to leverage the existing recipes the Yocto Project build system uses
|
||||
but change those recipes, you can use <filename>.bbappend</filename> files.
|
||||
All new recipes and append files for your layer must go in the layer’s
|
||||
<filename>recipes-bsp</filename>, <filename>recipes-kernel</filename>,
|
||||
<filename>recipes-core</filename>, and
|
||||
<filename>recipes-graphics</filename> directories.
|
||||
</para>
|
||||
|
||||
<section id='changing-recipes-bsp'>
|
||||
<title>Changing <filename>recipes-bsp</filename></title>
|
||||
|
||||
<para>
|
||||
First, let's look at <filename>recipes-bsp</filename>.
|
||||
For this example we are not adding any new BSP recipes.
|
||||
And, we only need to remove the formfactor we do not want and change the name of
|
||||
the remaining one that doesn't support EMGD.
|
||||
These commands take care of the <filename>recipes-bsp</filename> recipes:
|
||||
<literallayout class='monospaced'>
|
||||
$ rm -rf meta-mymachine/recipes-bsp/formfactor/formfactor/crownbay
|
||||
$ mv meta-mymachine/recipes-bsp/formfactor/formfactor/crownbay-noemgd/ \
|
||||
meta-mymachine/recipes-bsp/formfactor/formfactor/mymachine
|
||||
</literallayout>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id='changing-recipes-graphics'>
|
||||
<title>Changing <filename>recipes-graphics</filename></title>
|
||||
|
||||
<para>
|
||||
Now let's look at <filename>recipes-graphics</filename>.
|
||||
For this example we want to remove anything that supports EMGD and
|
||||
be sure to rename remaining directories appropriately.
|
||||
The following commands clean up the <filename>recipes-graphics</filename> directory:
|
||||
<literallayout class='monospaced'>
|
||||
$ rm -rf meta-mymachine/recipes-graphics/xorg-xserver/xserver-xf86-config/crownbay
|
||||
$ mv meta-mymachine/recipes-graphics/xorg-xserver/xserver-xf86-config/crownbay-noemgd \
|
||||
meta-mymachine/recipes-graphics/xorg-xserver/xserver-xf86-config/mymachine
|
||||
</literallayout>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
At this point the <filename>recipes-graphics</filename> directory just has files that
|
||||
support Video Electronics Standards Association (VESA) graphics modes and not EMGD.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id='changing-recipes-core'>
|
||||
<title>Changing <filename>recipes-core</filename></title>
|
||||
|
||||
<para>
|
||||
Now let's look at changes in <filename>recipes-core</filename>.
|
||||
The file <filename>task-core-tools.bbappend</filename> in
|
||||
<filename>recipes-core/tasks</filename> appends the similarly named recipe
|
||||
located in the local Yocto Project files at
|
||||
<filename>meta/recipes-core/tasks</filename>.
|
||||
The "append" file in our layer right now is Crown Bay-specific and supports
|
||||
EMGD and non-EMGD.
|
||||
Here are the contents of the file:
|
||||
<literallayout class='monospaced'>
|
||||
RRECOMMENDS_task-core-tools-profile_append_crownbay = " systemtap"
|
||||
RRECOMMENDS_task-core-tools-profile_append_crownbay-noemgd = " systemtap"
|
||||
</literallayout>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The <filename>RRECOMMENDS</filename> statements list packages that
|
||||
extend usability.
|
||||
The first <filename>RRECOMMENDS</filename> statement can be removed, while the
|
||||
second one can be changed to reflect <filename>meta-mymachine</filename>:
|
||||
<literallayout class='monospaced'>
|
||||
RRECOMMENDS_task-core-tools-profile_append_mymachine = " systemtap"
|
||||
</literallayout>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id='changing-recipes-kernel'>
|
||||
<title>Changing <filename>recipes-kernel</filename></title>
|
||||
|
||||
<para>
|
||||
Finally, let's look at <filename>recipes-kernel</filename> changes.
|
||||
Recall that the BSP uses the <filename>linux-yocto</filename> kernel as determined
|
||||
earlier in the <filename>mymachine.conf</filename>.
|
||||
The recipe for that kernel is not located in the
|
||||
BSP layer but rather in the local Yocto Project files at
|
||||
<filename>meta/recipes-kernel/linux</filename> and is
|
||||
named <filename>linux-yocto_3.0.bb</filename>.
|
||||
The <filename>SRCREV_machine</filename> and <filename>SRCREV_meta</filename>
|
||||
statements point to the exact commits used by the Yocto Project development team
|
||||
in their source repositories that identify the right kernel for our hardware.
|
||||
In other words, the <filename>SRCREV</filename> values are simply Git commit
|
||||
IDs that identify which commit on each
|
||||
of the kernel branches (machine and meta) will be checked out and used to build
|
||||
the kernel.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
However, in the <filename>meta-mymachine</filename> layer in
|
||||
<filename>recipes-kernel/linux</filename> resides a <filename>.bbappend</filename>
|
||||
file named <filename>linux-yocto_3.0.bbappend</filename> that
|
||||
is appended to the recipe of the same name in <filename>meta/recipes-kernel/linux</filename>.
|
||||
Thus, the <filename>SRCREV</filename> statements in the "append" file override
|
||||
the more general statements found in <filename>meta</filename>.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The <filename>SRCREV</filename> statements in the "append" file currently identify
|
||||
the kernel that supports the Crown Bay BSP with and without EMGD support.
|
||||
Here are the statements:
|
||||
<literallayout class='monospaced'>
|
||||
SRCREV_machine_pn-linux-yocto_crownbay ?= \
|
||||
"2247da9131ea7e46ed4766a69bb1353dba22f873"
|
||||
SRCREV_meta_pn-linux-yocto_crownbay ?= \
|
||||
"d05450e4aef02c1b7137398ab3a9f8f96da74f52"
|
||||
|
||||
SRCREV_machine_pn-linux-yocto_crownbay-noemgd ?= \
|
||||
"2247da9131ea7e46ed4766a69bb1353dba22f873"
|
||||
SRCREV_meta_pn-linux-yocto_crownbay-noemgd ?= \
|
||||
"d05450e4aef02c1b7137398ab3a9f8f96da74f52"
|
||||
</literallayout>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
You will notice that there are two pairs of <filename>SRCREV</filename> statements.
|
||||
The top pair identifies the kernel that supports
|
||||
EMGD, which we don’t care about in this example.
|
||||
The bottom pair identifies the kernel that we will use:
|
||||
<filename>linux-yocto</filename>.
|
||||
At this point though, the unique commit strings all are still associated with
|
||||
Crown Bay and not <filename>meta-mymachine</filename>.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
To fix this situation in <filename>linux-yocto_3.0.bbappend</filename>,
|
||||
we delete the two <filename>SRCREV</filename> statements that support
|
||||
EMGD (the top pair).
|
||||
We also change the remaining pair to specify <filename>mymachine</filename>
|
||||
and insert the commit identifiers to identify the kernel in which we
|
||||
are interested, which will be based on the <filename>atom-pc-standard</filename>
|
||||
kernel.
|
||||
In this case, because we're working with the edison branch of everything, we
|
||||
need to use the <filename>SRCREV</filename> values for the atom-pc branch
|
||||
that are associated with the edison release.
|
||||
To find those values, we need to find the <filename>SRCREV</filename>
|
||||
values that edison uses for the atom-pc branch, which we find in the
|
||||
<filename>poky/meta-yocto/recipes-kernel/linux/linux-yocto_3.0.bbappend</filename>
|
||||
file.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The machine <filename>SRCREV</filename> we want is in the
|
||||
<filename>SRCREV_machine_atom-pc</filename> variable.
|
||||
The meta <filename>SRCREV</filename> isn't specified in this file, so it must be
|
||||
specified in the base kernel recipe in the
|
||||
<filename>poky/meta/recipes-kernel/linux/linux-yocto_3.0.bb</filename>
|
||||
file, in the <filename>SRCREV_meta variable</filename> found there.
|
||||
It happens to be the same as the value we already inherited from the
|
||||
<filename>meta-crownbay</filename> BSP.
|
||||
Here are the final <filename>SRCREV</filename> statements:
|
||||
<literallayout class='monospaced'>
|
||||
SRCREV_machine_pn-linux-yocto_mymachine ?= \
|
||||
"1e18e44adbe79b846e382370eb29bc4b8cd5a1a0"
|
||||
SRCREV_meta_pn-linux-yocto_mymachine ?= \
|
||||
"d05450e4aef02c1b7137398ab3a9f8f96da74f52"
|
||||
</literallayout>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
In this example, we're using the <filename>SRCREV</filename> values we
|
||||
found already captured in the edison release because we're creating a BSP based on
|
||||
edison.
|
||||
If, instead, we had based our BSP on the master branches, we would want to use
|
||||
the most recent <filename>SRCREV</filename> values taken directly from the kernel repo.
|
||||
We will not be doing that for this example.
|
||||
However, if you do base a future BSP on master and
|
||||
if you are familiar with Git repositories, you probably won’t have trouble locating the
|
||||
exact commit strings in the Yocto Project source repositories you need to change
|
||||
the <filename>SRCREV</filename> statements.
|
||||
You can find all the <filename>machine</filename> and <filename>meta</filename>
|
||||
branch points (commits) for the <filename>linux-yocto-3.0</filename> kernel at
|
||||
<ulink url='http://git.yoctoproject.org/cgit/cgit.cgi/linux-yocto-3.0'></ulink>.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
If you need a little more assistance after going to the link then do the following:
|
||||
<orderedlist>
|
||||
<listitem><para>Expand the list of branches by clicking <filename>[…]</filename></para></listitem>
|
||||
<listitem><para>Click on the <filename>yocto/standard/common-pc/atom-pc</filename>
|
||||
branch</para></listitem>
|
||||
<listitem><para>Click on the commit column header to view the top commit</para></listitem>
|
||||
<listitem><para>Copy the commit string for use in the
|
||||
<filename>linux-yocto_3.0.bbappend</filename> file</para></listitem>
|
||||
</orderedlist>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
For the <filename>SRCREV</filename> statement that points to the <filename>meta</filename>
|
||||
branch use the same procedure except expand the <filename>meta</filename>
|
||||
branch in step 2 above.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Also in the <filename>linux-yocto_3.0.bbappend</filename> file are
|
||||
<filename>COMPATIBLE_MACHINE</filename>, <filename>KMACHINE</filename>,
|
||||
and <filename>KERNEL_FEATURES</filename> statements.
|
||||
Two sets of these exist: one set supports EMGD and one set does not.
|
||||
Because we are not interested in supporting EMGD those three can be deleted.
|
||||
The remaining three must be changed so that <filename>mymachine</filename> replaces
|
||||
<filename>crownbay-noemgd</filename> and <filename>crownbay</filename>.
|
||||
Because we are using the atom-pc branch for this new BSP, we can also find
|
||||
the exact branch we need for the KMACHINE variable in our new BSP from the value
|
||||
we find in the
|
||||
<filename>poky/meta-yocto/recipes-kernel/linux/linux-yocto_3.0.bbappend</filename>
|
||||
file we looked at in a previous step.
|
||||
In this case, the value we want is in the KMACHINE_atom-pc variable in that file.
|
||||
Here is the final <filename>linux-yocto_3.0.bbappend</filename> file after all
|
||||
the edits:
|
||||
<literallayout class='monospaced'>
|
||||
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
|
||||
|
||||
COMPATIBLE_MACHINE_mymachine = "mymachine"
|
||||
KMACHINE_mymachine = "yocto/standard/common-pc/atom-pc"
|
||||
KERNEL_FEATURES_append_mymachine += " cfg/smp.scc"
|
||||
|
||||
SRCREV_machine_pn-linux-yocto_mymachine ?= \
|
||||
"1e18e44adbe79b846e382370eb29bc4b8cd5a1a0"
|
||||
SRCREV_meta_pn-linux-yocto_mymachine ?= \
|
||||
"d05450e4aef02c1b7137398ab3a9f8f96da74f52"
|
||||
</literallayout>
|
||||
</para>
|
||||
</section>
|
||||
</section>
|
||||
|
||||
<section id='bsp-recipe-change-summary'>
|
||||
<title>BSP Recipe Change Summary</title>
|
||||
|
||||
<para>
|
||||
In summary, the edits to the layer’s recipe files result in removal of any files and
|
||||
statements that do not support your targeted hardware in addition to the inclusion
|
||||
of any new recipes you might need.
|
||||
In this example, it was simply a matter of ridding the new layer
|
||||
<filename>meta-mymachine</filename> of any code that supported the EMGD features
|
||||
and making sure we were identifying the kernel that supports our example, which
|
||||
is the <filename>atom-pc-standard</filename> kernel.
|
||||
We did not introduce any new recipes to the layer.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Finally, it is also important to update the layer’s <filename>README</filename>
|
||||
file so that the information in it reflects your BSP.
|
||||
</para>
|
||||
</section>
|
||||
</section>
|
||||
|
||||
<section id='preparing-for-the-build-app'>
|
||||
<title>Preparing for the Build</title>
|
||||
|
||||
<para>
|
||||
To get ready to build your image that uses the new layer you need to do the following:
|
||||
<orderedlist>
|
||||
<listitem><para>Get the environment ready for the build by sourcing the environment
|
||||
script.
|
||||
The environment script is in the top-level of the local Yocto Project files
|
||||
directory structure.
|
||||
The script has the string
|
||||
<filename>init-build-env</filename> in the file’s name.
|
||||
For this example, the following command gets the build environment ready:
|
||||
<literallayout class='monospaced'>
|
||||
$ source oe-init-build-env yocto-build
|
||||
</literallayout>
|
||||
When you source the script a build directory is created in the current
|
||||
working directory.
|
||||
In our example we were in the <filename>poky</filename> directory.
|
||||
Thus, entering the previous command created the <filename>yocto-build</filename> directory.
|
||||
If you do not provide a name for the build directory it defaults to
|
||||
<filename>build</filename>.
|
||||
The <filename>yocto-build</filename> directory contains a
|
||||
<filename>conf</filename> directory that has
|
||||
two configuration files you will need to check: <filename>bblayers.conf</filename>
|
||||
and <filename>local.conf</filename>.</para></listitem>
|
||||
<listitem><para>Check and edit the resulting <filename>local.conf</filename> file.
|
||||
This file minimally identifies the machine for which to build the image by
|
||||
configuring the <filename>MACHINE</filename> variable.
|
||||
For this example you must set the variable to mymachine as follows:
|
||||
<literallayout class='monospaced'>
|
||||
MACHINE ??= “mymachine”
|
||||
</literallayout>
|
||||
You should also be sure any other variables in which you are interested are set.
|
||||
Some variables to consider are <filename>BB_NUMBER_THREADS</filename>
|
||||
and <filename>PARALLEL_MAKE</filename>, both of which can greatly reduce your build time
|
||||
if your development system supports multiple cores.
|
||||
For development systems that support multiple cores, a good rule of thumb is to set
|
||||
both the <filename>BB_NUMBER_THREADS</filename> and <filename>PARALLEL_MAKE</filename>
|
||||
variables to twice the number of cores your system supports.</para></listitem>
|
||||
<listitem><para>Update the <filename>bblayers.conf</filename> file so that it includes
|
||||
the path to your new BSP layer.
|
||||
In this example you need to include the pathname to <filename>meta-mymachine</filename>.
|
||||
For this example the
|
||||
<filename>BBLAYERS</filename> variable in the file would need to include the following path:
|
||||
<literallayout class='monospaced'>
|
||||
$HOME/poky/meta-intel/meta-mymachine
|
||||
</literallayout></para></listitem>
|
||||
</orderedlist>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The appendix
|
||||
<ulink url='http://www.yoctoproject.org/docs/latest/poky-ref-manual/poky-ref-manual.html#ref-variables-glos'>
|
||||
Reference: Variables Glossary</ulink> in the Yocto Project Reference Manual has more information
|
||||
on configuration variables.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id='building-the-image-app'>
|
||||
<title>Building and Booting the Image</title>
|
||||
|
||||
<para>
|
||||
To build the image for our <filename>meta-mymachine</filename> BSP enter the following command
|
||||
from the same shell from which you ran the setup script.
|
||||
You should run the <filename>bitbake</filename> command without any intervening shell commands.
|
||||
For example, moving your working directory around could cause problems.
|
||||
Here is the command for this example:
|
||||
<literallayout class='monospaced'>
|
||||
$ bitbake -k core-image-sato
|
||||
</literallayout>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
This command specifies an image that has Sato support and that can be run from a USB device or
|
||||
from a CD without having to first install anything.
|
||||
The build process takes significant time and includes thousands of tasks, which are reported
|
||||
at the console.
|
||||
If the build results in any type of error you should check for misspellings in the
|
||||
files you changed or problems with your host development environment such as missing packages.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Finally, once you have an image, you can try booting it from a device
|
||||
(e.g. a USB device).
|
||||
To prepare a bootable USB device, insert a USB flash drive into your build system and
|
||||
copy the <filename>.hddimg</filename> file, located in the
|
||||
<filename>poky/build/tmp/deploy/images</filename>
|
||||
directory after a successful build to the flash drive.
|
||||
Assuming the USB flash drive takes device <filename>/dev/sdf</filename>,
|
||||
use <filename>dd</filename> to copy the live image to it.
|
||||
For example:
|
||||
<literallayout class='monospaced'>
|
||||
# dd if=core-image-sato-mymachine-20111101223904.hddimg of=/dev/sdf
|
||||
# sync
|
||||
# eject /dev/sdf
|
||||
</literallayout>
|
||||
You should now have a bootable USB flash device.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Insert the device
|
||||
into a bootable USB socket on the target, and power it on.
|
||||
The system should boot to the Sato graphical desktop.
|
||||
<footnote><para>Because
|
||||
this new image is not in any way tailored to the system you're
|
||||
booting it on, which is assumed to be some sort of atom-pc (netbook) system for this
|
||||
example, it might not be completely functional though it should at least boot to a text
|
||||
prompt.
|
||||
Specifically, it might fail to boot into graphics without some tweaking.
|
||||
If this ends up being the case, a possible next step would be to replace the
|
||||
<filename>mymachine.conf</filename>
|
||||
contents with the contents of <filename>atom-pc.conf</filename> and replace
|
||||
<filename>xorg.conf</filename> with <filename>atom-pc xorg.conf</filename>
|
||||
in <filename>meta-yocto</filename> and see if it fares any better.
|
||||
In any case, following the previous steps will give you a buildable image that
|
||||
will probably boot on most systems.
|
||||
Getting things working like you want
|
||||
them to for your hardware will normally require some amount of experimentation with
|
||||
configuration settings.</para></footnote>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
For reference, the sato image produced by the previous steps for edison
|
||||
should look like the following in terms of size.
|
||||
If your sato image is much different from this,
|
||||
you probably made a mistake in one of the above steps:
|
||||
<literallayout class='monospaced'>
|
||||
358715392 2011-11-01 19:11 core-image-sato-mymachine-20111101223904.hddimg
|
||||
</literallayout>
|
||||
<note>The previous instructions are also present in the README that was copied
|
||||
from meta-crownbay, which should also be updated to reflect the specifics of your
|
||||
new BSP.
|
||||
That file and the <filename>README.hardware</filename> file in the top-level
|
||||
<filename>poky</filename> directory
|
||||
also provides some suggestions for things to try if booting fails and produces
|
||||
strange error messages.</note>
|
||||
</para>
|
||||
</section>
|
||||
</appendix>
|
||||
|
||||
|
||||
<!--
|
||||
vim: expandtab tw=80 ts=4
|
||||
-->
|
||||
@@ -1,8 +0,0 @@
|
||||
<?xml version='1.0'?>
|
||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml" xmlns:fo="http://www.w3.org/1999/XSL/Format" version="1.0">
|
||||
|
||||
<xsl:import href="http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl" />
|
||||
|
||||
<!-- <xsl:param name="generate.toc" select="'article nop'"></xsl:param> -->
|
||||
|
||||
</xsl:stylesheet>
|
||||
@@ -1,182 +0,0 @@
|
||||
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
|
||||
|
||||
<chapter id='dev-manual-intro'>
|
||||
|
||||
<title>The Yocto Project Development Manual</title>
|
||||
<section id='intro'>
|
||||
<title>Introduction</title>
|
||||
|
||||
<para>
|
||||
Welcome to the Yocto Project Development Manual!
|
||||
This manual gives you an idea of how to use the Yocto Project to develop embedded Linux
|
||||
images and user-space applications to run on targeted devices.
|
||||
Reading this manual gives you an overview of image, kernel, and user-space application development
|
||||
using the Yocto Project.
|
||||
Because much of the information in this manual is general, it contains many references to other
|
||||
sources where you can find more detail.
|
||||
For example, detailed information on Git, repositories and open source in general
|
||||
can be found in many places.
|
||||
Another example is how to get set up to use the Yocto Project, which our Yocto Project Quick Start covers.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The Yocto Project Development Manual, however, does provide detailed examples on how to create a
|
||||
Board Support Package (BSP), change the kernel source code, and re-configure the kernel.
|
||||
You can find this information in the appendices of the manual.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id='what-this-manual-provides'>
|
||||
<title>What this Manual Provides</title>
|
||||
|
||||
<para>
|
||||
The following list describes what you can get from this guide:
|
||||
<itemizedlist>
|
||||
<listitem><para>Information that lets you get set
|
||||
up to develop using the Yocto Project.</para></listitem>
|
||||
<listitem><para>Information to help developers who are new to the open source environment
|
||||
and to the distributed revision control system Git, which the Yocto Project
|
||||
uses.</para></listitem>
|
||||
<listitem><para>An understanding of common end-to-end development models.</para></listitem>
|
||||
<listitem><para>Development case overviews for both system development and user-space
|
||||
applications.</para></listitem>
|
||||
<listitem><para>An overview and understanding of the emulation environment used with
|
||||
the Yocto Project (QEMU).</para></listitem>
|
||||
<!-- <listitem><para>A discussion of target-level analysis techniques, tools, tips,
|
||||
and tricks.</para></listitem>
|
||||
<listitem><para>Considerations for deploying your final product.</para></listitem> -->
|
||||
<listitem><para>An understanding of basic kernel architecture and
|
||||
concepts.</para></listitem>
|
||||
<!-- <listitem><para>Information that will help you migrate an existing project to the
|
||||
Yocto Project development environment.</para></listitem> -->
|
||||
<listitem><para>Many references to other sources of related information.</para></listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id='what-this-manual-does-not-provide'>
|
||||
<title>What this Manual Does Not Provide</title>
|
||||
|
||||
<para>
|
||||
This manual will not give you the following:
|
||||
<itemizedlist>
|
||||
<listitem><para>Step-by-step instructions if those instructions exist in other Yocto
|
||||
Project documentation.
|
||||
For example, the Application Development Toolkit (ADT) User’s Guide contains detailed
|
||||
instruction on how to obtain and configure the
|
||||
<trademark class='trade'>Eclipse</trademark> Yocto Plug-in.</para></listitem>
|
||||
<listitem><para>Reference material.
|
||||
This type of material resides in an appropriate reference manual.
|
||||
For example, system variables are documented in the
|
||||
<ulink url='http://www.yoctoproject.org/docs/latest/poky-ref-manual/poky-ref-manual.html'>
|
||||
Yocto Project Reference Manual</ulink>.</para></listitem>
|
||||
<listitem><para>Detailed public information that is not specific to the Yocto Project.
|
||||
For example, exhaustive information on how to use Git is covered better through the
|
||||
Internet than in this manual.</para></listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id='other-information'>
|
||||
<title>Other Information</title>
|
||||
|
||||
<para>
|
||||
Because this manual presents overview information for many different topics, you will
|
||||
need to supplement it with other information.
|
||||
The following list presents other sources of information you might find helpful:
|
||||
<itemizedlist>
|
||||
<listitem><para><emphasis>The <ulink url='http://www.yoctoproject.org'>Yocto Project Website</ulink>:
|
||||
</emphasis> The home page for the Yocto Project provides lots of information on the project
|
||||
as well as links to software and documentation.</para></listitem>
|
||||
<listitem><para><emphasis>
|
||||
<ulink url='http://www.yoctoproject.org/docs/latest/yocto-project-qs/yocto-project-qs.html'>
|
||||
The Yocto Project Quick Start</ulink>:</emphasis> This short document lets you get started
|
||||
with the Yocto Project quickly and start building an image.</para></listitem>
|
||||
<listitem><para><emphasis>
|
||||
<ulink url='http://www.yoctoproject.org/docs/latest/poky-ref-manual/poky-ref-manual.html'>
|
||||
The Yocto Project Reference Manual</ulink>:</emphasis> This manual is a reference
|
||||
guide to the Yocto Project build component known as "Poky."
|
||||
The manual also contains a reference chapter on Board Support Package (BSP)
|
||||
layout.</para></listitem>
|
||||
<listitem><para><emphasis>
|
||||
<ulink url='http://www.yoctoproject.org/docs/latest/adt-manual/adt-manual.html'>
|
||||
The Yocto Project Application Development Toolkit (ADT) User's Guide</ulink>:</emphasis>
|
||||
This guide provides information that lets you get going with the ADT to
|
||||
develop projects using the Yocto Project.</para></listitem>
|
||||
<listitem><para><emphasis>
|
||||
<ulink url='http://www.yoctoproject.org/docs/latest/bsp-guide/bsp-guide.html'>
|
||||
The Yocto Project Board Support Package (BSP) Developer's Guide</ulink>:</emphasis>
|
||||
This guide defines the structure for BSP components.
|
||||
Having a commonly understood structure encourages standardization.</para></listitem>
|
||||
<listitem><para><emphasis>
|
||||
<ulink url='http://www.yoctoproject.org/docs/latest/kernel-manual/kernel-manual.html'>
|
||||
The Yocto Project Kernel Architecture and Use Manual</ulink>:</emphasis>
|
||||
This manual describes the architecture of the Yocto Project kernel and provides
|
||||
some work flow examples.</para></listitem>
|
||||
<listitem><para><emphasis>
|
||||
<ulink url='http://www.youtube.com/watch?v=3ZlOu-gLsh0'>
|
||||
Yocto Eclipse Plug-in</ulink>:</emphasis> A step-by-step instructional video that
|
||||
demonstrates how an application developer uses Yocto Plug-in features within
|
||||
the Eclipse IDE.</para></listitem>
|
||||
<listitem><para><emphasis>
|
||||
<ulink url='http://wiki.yoctoproject.org/wiki/FAQ'>FAQ</ulink>:</emphasis>
|
||||
A list of commonly asked questions and their answers.</para></listitem>
|
||||
<listitem><para><emphasis>
|
||||
<ulink url='http://www.yoctoproject.org/download/yocto/yocto-project-1.1-release-notes-poky-6.0'>
|
||||
Release Notes</ulink>:</emphasis> Features, updates and known issues for the current
|
||||
release of the Yocto Project.</para></listitem>
|
||||
<listitem><para><emphasis>
|
||||
<ulink url='http://bugzilla.yoctoproject.org/'>Bugzilla</ulink>:</emphasis>
|
||||
The bug tracking application the Yocto Project uses.
|
||||
If you find problems with the Yocto Project, you should report them using this
|
||||
application.</para></listitem>
|
||||
<listitem><para><emphasis>
|
||||
Yocto Project Mailing Lists:</emphasis> To subscribe to the Yocto Project mailing
|
||||
lists, click on the following URLs and follow the instructions:
|
||||
<itemizedlist>
|
||||
<listitem><para><ulink url='http://lists.yoctoproject.org/listinfo/yocto'></ulink> for a
|
||||
Yocto Project Discussions mailing list.</para></listitem>
|
||||
<listitem><para><ulink url='http://lists.yoctoproject.org/listinfo/poky'></ulink> for a
|
||||
Yocto Project Discussions mailing list about the Poky build system.</para></listitem>
|
||||
<listitem><para><ulink url='http://lists.yoctoproject.org/listinfo/yocto-announce'></ulink>
|
||||
for a mailing list to receive offical Yocto Project announcements for developments and
|
||||
as well as Yocto Project milestones.</para></listitem>
|
||||
</itemizedlist></para></listitem>
|
||||
<listitem><para><emphasis>Internet Relay Chat (IRC):</emphasis>
|
||||
Two IRC channels on freenode are available
|
||||
for Yocto Project and Poky discussions: <filename>#yocto</filename> and
|
||||
<filename>#poky</filename>.</para></listitem>
|
||||
<listitem><para><emphasis>
|
||||
<ulink url='http://www.openedhand.com/'>OpenedHand</ulink>:</emphasis>
|
||||
The company where the Yocto Project build system Poky was first developed.
|
||||
OpenedHand has since been acquired by Intel Corporation.</para></listitem>
|
||||
<listitem><para><emphasis>
|
||||
<ulink url='http://www.intel.com/'>Intel Corporation</ulink>:</emphasis>
|
||||
The company that acquired OpenedHand in 2008 and continues development on the
|
||||
Yocto Project.</para></listitem>
|
||||
<listitem><para><emphasis>
|
||||
<ulink url='http://www.openembedded.org/'>OpenEmbedded</ulink>:</emphasis>
|
||||
The upstream, generic, embedded distribution the Yocto Project build system (Poky) derives
|
||||
from and to which it contributes.</para></listitem>
|
||||
<listitem><para><emphasis>
|
||||
<ulink url='http://developer.berlios.de/projects/bitbake/'>
|
||||
BitBake</ulink>:</emphasis> The tool used to process Yocto Project metadata.</para></listitem>
|
||||
<listitem><para><emphasis>
|
||||
<ulink url='http://bitbake.berlios.de/manual/'>
|
||||
BitBake User Manual</ulink>:</emphasis> A comprehensive guide to the BitBake tool.
|
||||
</para></listitem>
|
||||
<listitem><para><emphasis>
|
||||
<ulink url='http://pimlico-project.org/'>Pimlico</ulink>:</emphasis>
|
||||
A suite of lightweight Personal Information Management (PIM) applications designed
|
||||
primarily for handheld and mobile devices.</para></listitem>
|
||||
<listitem><para><emphasis>
|
||||
<ulink url='http://wiki.qemu.org/Index.html'>QEMU</ulink>:
|
||||
</emphasis> An open-source machine emulator and virtualizer.</para></listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
</section>
|
||||
</chapter>
|
||||
<!--
|
||||
vim: expandtab tw=80 ts=4
|
||||
-->
|
||||
@@ -1,683 +0,0 @@
|
||||
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
|
||||
|
||||
<chapter id='dev-manual-model'>
|
||||
|
||||
<title>Common Development Models</title>
|
||||
|
||||
<para>
|
||||
Many development models exist for which you can use the Yocto Project.
|
||||
However, for the purposes of this manual we are going to focus on two common ones:
|
||||
System Development and User Application Development.
|
||||
System Development covers Board Support Package (BSP) development and kernel modification
|
||||
or configuration.
|
||||
User Application Development covers development of applications that you intend to run on some
|
||||
target hardware.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
This chapter presents overviews of both system and application models.
|
||||
If you want to examine specific examples of the system development models,
|
||||
see the "<link linkend='dev-manual-bsp-appendix'>BSP Development Example</link>"
|
||||
appendix and the
|
||||
"<link linkend='dev-manual-kernel-appendix'>Kernel Modification Example</link>" appendix.
|
||||
For a user-space application development example that uses the
|
||||
<trademark class='trade'>Eclipse</trademark> IDE,
|
||||
see the
|
||||
<ulink url='http://www.yoctoproject.org/docs/latest/adt-manual/adt-manual.html'>
|
||||
The Yocto Project Application Development Toolkit (ADT) User's Guide</ulink>.
|
||||
</para>
|
||||
|
||||
<section id='system-development-model'>
|
||||
<title>System Development</title>
|
||||
|
||||
<para>
|
||||
System development involves modification or creation of an image that you want to run on
|
||||
a specific hardware target.
|
||||
Usually, when you want to create an image that runs on embedded hardware, the image does
|
||||
not require the same number of features that a full-fledged Linux distribution provides.
|
||||
Thus, you can create a much smaller image that is designed to use only the hardware
|
||||
features for your particular hardware.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
To help you understand how system development works in the Yocto Project, this section
|
||||
covers two types of image development: BSP creation and kernel modification or
|
||||
configuration.
|
||||
</para>
|
||||
|
||||
<section id='developing-a-board-support-package-bsp'>
|
||||
<title>Developing a Board Support Package (BSP)</title>
|
||||
|
||||
<para>
|
||||
A BSP is a package of recipes that, when applied, during a build results in
|
||||
an image that you can run on a particular board.
|
||||
Thus, the package, when compiled into the new image, supports the operation of the board.
|
||||
</para>
|
||||
|
||||
<note>
|
||||
For a brief list of terms used when describing the development process in the Yocto Project,
|
||||
see the "<link linkend='yocto-project-terms'>Yocto Project Terms</link>" section.
|
||||
</note>
|
||||
|
||||
<para>
|
||||
The remainder of this section presents the basic steps used to create a BSP
|
||||
based on an existing BSP that ships with the Yocto Project.
|
||||
You can reference the "<link linkend='dev-manual-bsp-appendix'>BSP Development Example</link>"
|
||||
appendix for a detailed example that uses the Crown Bay BSP as a base BSP from which to start.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The following illustration and list summarize the BSP creation general workflow.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
<imagedata fileref="figures/bsp-dev-flow.png" width="6in" depth="7in" align="center" scalefit="1" />
|
||||
</para>
|
||||
|
||||
<para>
|
||||
<orderedlist>
|
||||
<listitem><para><emphasis>Set up your host development system to support
|
||||
development using the Yocto Project</emphasis>: See the
|
||||
"<ulink url='http://www.yoctoproject.org/docs/latest/yocto-project-qs/yocto-project-qs.html#the-linux-distro'>The Linux Distributions</ulink>" and the
|
||||
"<ulink url='http://www.yoctoproject.org/docs/latest/yocto-project-qs/yocto-project-qs.html#packages'>The Packages</ulink>" sections both
|
||||
in the Yocto Project Quick Start for requirements.</para></listitem>
|
||||
<listitem><para><emphasis>Establish a local copy of the Yocto Project files on your
|
||||
system</emphasis>: You need to have the Yocto Project files available on your host system.
|
||||
Having the Yocto Project files on your system gives you access to the build
|
||||
process and to the tools you need.
|
||||
For information on how to get these files, see the
|
||||
"<link linkend='getting-setup'>Getting Setup</link>" section.</para></listitem>
|
||||
<listitem><para><emphasis>Establish a local copy of the base BSP files</emphasis>: Having
|
||||
the BSP files on your system gives you access to the build
|
||||
process and to the tools you need for creating a BSP.
|
||||
For information on how to get these files, see the
|
||||
"<link linkend='getting-setup'>Getting Setup</link>" section.</para></listitem>
|
||||
<listitem><para><emphasis>Choose a Yocto Project-supported BSP as your base BSP</emphasis>:
|
||||
The Yocto Project ships with several BSPs that support various hardware.
|
||||
It is best to base your new BSP on an existing BSP rather than create all the
|
||||
recipes and configuration files from scratch.
|
||||
While it is possible to create everything from scratch, basing your new BSP
|
||||
on something that is close is much easier.
|
||||
Or, at a minimum, leveraging off an existing BSP
|
||||
gives you some structure with which to start.</para>
|
||||
<para>At this point you need to understand your target hardware well enough to determine which
|
||||
existing BSP it most closely matches.
|
||||
Things to consider are your hardware’s on-board features, such as CPU type and graphics support.
|
||||
You should look at the README files for supported BSPs to get an idea of which one
|
||||
you could use.
|
||||
A generic <trademark class='registered'>Intel</trademark>
|
||||
<trademark class='trade'>Atom</trademark>-based BSP to consider is the
|
||||
Crown Bay that does not support the <trademark class='registered'>Intel</trademark>
|
||||
Embedded Media Graphics Driver (EMGD).
|
||||
The remainder of this example uses that base BSP.</para>
|
||||
<para>To see the supported BSPs, go to the Yocto Project
|
||||
<ulink url='http://www.yoctoproject.org/download'>download page</ulink> and click
|
||||
on “BSP Downloads.”</para></listitem>
|
||||
<listitem><para><emphasis>Create your own BSP layer</emphasis>: Layers are ideal for
|
||||
isolating and storing work for a given piece of hardware.
|
||||
A layer is really just a location or area in which you place the recipes for your BSP.
|
||||
In fact, a BSP is, in itself, a special type of layer.
|
||||
Another example that illustrates a layer is an application.
|
||||
Suppose you are creating an application that has library or other dependencies in
|
||||
order for it to compile and run.
|
||||
The layer, in this case, would be where all the recipes that define those dependencies
|
||||
are kept.
|
||||
The key point for a layer is that it is an isolated area that contains
|
||||
all the relevant information for the project that the Yocto Project build
|
||||
system knows about.</para>
|
||||
<note>The Yocto Project supports four BSPs that are part of the
|
||||
Yocto Project release: <filename>atom-pc</filename>, <filename>beagleboard</filename>,
|
||||
<filename>mpc8315e</filename>, and <filename>routerstationpro</filename>.
|
||||
The recipes and configurations for these four BSPs are located and dispersed
|
||||
within the local Yocto Project files.
|
||||
Consequently, they are not totally isolated in the spirit of layers unless you think
|
||||
of <filename>meta-yocto</filename> as a layer itself.
|
||||
On the other hand, BSP layers for Crown Bay, Emenlow, Jasper Forest,
|
||||
N450, and Sugar Bay are isolated.</note>
|
||||
<para>When you set up a layer for a new BSP, you should follow a standard layout.
|
||||
This layout is described in the section
|
||||
"<ulink url='http://www.yoctoproject.org/docs/latest/bsp-guide/bsp-guide.html#bsp-filelayout'>Example Filesystem Layout</ulink>" section of the Board Support Package (BSP) Development Guide.
|
||||
In the standard layout, you will notice a suggested structure for recipes and
|
||||
configuration information.
|
||||
You can see the standard layout for the Crown Bay BSP in this example by examining the
|
||||
directory structure of the <filename>meta-crownbay</filename> layer inside the
|
||||
local Yocto Project files.</para></listitem>
|
||||
<listitem><para><emphasis>Make configuration changes to your new BSP
|
||||
layer</emphasis>: The standard BSP layer structure organizes the files you need to edit in
|
||||
<filename>conf</filename> and several <filename>recipes-*</filename> directories within the
|
||||
BSP layer.
|
||||
Configuration changes identify where your new layer is on the local system
|
||||
and identify which kernel you are going to use.
|
||||
</para></listitem>
|
||||
<listitem><para><emphasis>Make recipe changes to your new BSP layer</emphasis>: Recipe
|
||||
changes include altering recipes (<filename>.bb</filename> files), removing
|
||||
recipes you don't use, and adding new recipes that you need to support your hardware.
|
||||
</para></listitem>
|
||||
<listitem><para><emphasis>Prepare for the build</emphasis>: Once you have made all the
|
||||
changes to your BSP layer, there remains a few things
|
||||
you need to do for the Yocto Project build system in order for it to create your image.
|
||||
You need to get the build environment ready by sourcing an environment setup script
|
||||
and you need to be sure two key configuration files are configured appropriately.</para>
|
||||
<para>The entire process for building an image is overviewed in the section
|
||||
"<ulink url='http://www.yoctoproject.org/docs/latest/yocto-project-qs/yocto-project-qs.html#building-image'>Building an Image</ulink>" section of the Yocto Project Quick Start.
|
||||
You might want to reference this information.</para></listitem>
|
||||
<listitem><para><emphasis>Build the image</emphasis>: The Yocto Project uses the BitBake
|
||||
tool to build images based on the type of image you want to create.
|
||||
You can find more information on BitBake
|
||||
<ulink url='http://bitbake.berlios.de/manual/'>here</ulink>.</para>
|
||||
<para>The build process supports several types of images to satisfy different needs.
|
||||
See the
|
||||
"<ulink url='http://www.yoctoproject.org/docs/latest/poky-ref-manual/poky-ref-manual.html#ref-images'>Reference: Images</ulink>" appendix in the
|
||||
<ulink url='http://www.yoctoproject.org/docs/latest/poky-ref-manual/poky-ref-manual.html'>
|
||||
Yocto Project Reference Manual</ulink>for information on supported images.</para></listitem>
|
||||
</orderedlist>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
You can view a video presentation on "Building Custom Embedded Images with Yocto"
|
||||
at <ulink url='http://free-electrons.com/blog/elc-2011-videos'>Free Electrons</ulink>.
|
||||
You can also find supplemental information in
|
||||
<ulink url='http://yoctoproject.org/docs/latest/bsp-guide/bsp-guide.html'>
|
||||
The Board Support Package (BSP) Development Guide</ulink>.
|
||||
Finally, there is wiki page write up of the example also located
|
||||
<ulink url='https://wiki.yoctoproject.org/wiki/Transcript:_creating_one_generic_Atom_BSP_from_another'>
|
||||
here</ulink> that you might find helpful.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id='modifying-the-kernel'>
|
||||
<title><anchor id='kernel-spot' />Modifying the Kernel</title>
|
||||
|
||||
<para>
|
||||
Kernel modification involves changing the Linux Yocto kernel, which could involve changing
|
||||
configuration options as well as adding new kernel recipes.
|
||||
Configuration changes can be added in the form of configuration fragments, while recipe
|
||||
modification comes through the kernel's <filename>recipes-kernel</filename> area
|
||||
in a kernel layer you create.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The remainder of this section presents a high-level overview of the Linux Yocto
|
||||
kernel architecture and the steps to modify the Linux Yocto kernel.
|
||||
For a complete discussion of the kernel, see
|
||||
<ulink url='http://www.yoctoproject.org/docs/latest/kernel-manual/kernel-manual.html'>
|
||||
The Yocto Project Kernel Architecture and Use Manual</ulink>.
|
||||
You can reference the appendix
|
||||
"<link linkend='dev-manual-kernel-appendix'>Kernel Modification Example</link>"
|
||||
for a detailed example that changes the configuration of a kernel.
|
||||
</para>
|
||||
|
||||
<section id='kernel-overview'>
|
||||
<title>Kernel Overview</title>
|
||||
|
||||
<para>
|
||||
Traditionally, when one thinks of a patched kernel, they think of a base kernel
|
||||
source tree and a fixed structure that contains kernel patches.
|
||||
The Yocto Project, however, employs mechanisms, that in a sense, result in a kernel source
|
||||
generator.
|
||||
By the end of this section, this analogy will become clearer.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
You can find a web interface to the Linux Yocto kernel source repositories at
|
||||
<ulink url='http://git.yoctoproject.org/'></ulink>.
|
||||
If you look at the interface, you will see to the left a grouping of
|
||||
Git repositories titled "Yocto Linux Kernel."
|
||||
Within this group, you will find the four different kernels supported by
|
||||
the Yocto Project:
|
||||
<itemizedlist>
|
||||
<listitem><para><emphasis><filename>linux-yocto-2.6.34</filename></emphasis> - The
|
||||
stable Linux Yocto kernel that is based on the Linux 2.6.34 release.</para></listitem>
|
||||
<listitem><para><emphasis><filename>linux-yocto-2.6.37</filename></emphasis> - The
|
||||
stable Linux Yocto kernel that is based on the Linux 2.6.37 release.</para></listitem>
|
||||
<listitem><para><emphasis><filename>linux-yocto-3.0</filename></emphasis> - The current
|
||||
Linux Yocto kernel that is based on the Linux 3.0 release.</para></listitem>
|
||||
<listitem><para><emphasis><filename>linux-yocto-dev</filename></emphasis> - A development
|
||||
kernel based on the latest upstream release candidate available.</para></listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The kernels are maintained using the Git revision control system
|
||||
that structures them using the familiar "tree", "branch", and "leaf" scheme.
|
||||
Branches represent diversions from general code to more specific code, while leaves
|
||||
represent the end-points for a complete and unique kernel whose source files
|
||||
when gathered from the root of the tree to the leaf accumulate to create the files
|
||||
necessary for a specific piece of hardware and its features.
|
||||
The following figure displays this concept:
|
||||
<para>
|
||||
<imagedata fileref="figures/kernel-overview-1.png"
|
||||
width="6in" depth="6in" align="center" scale="100" />
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Within the figure, the "Kernel.org Branch Point" represents the point in the tree
|
||||
where a supported base kernel is modified from the Linux kernel.
|
||||
For example, this could be the branch point for the <filename>linux-yocto-3.0</filename>
|
||||
kernel.
|
||||
Thus, everything further to the right in the structure is based on the
|
||||
<filename>linux-yocto-3.0</filename> kernel.
|
||||
Branch points to right in the figure represent where the
|
||||
<filename>linux-yocto-3.0</filename> kernel is modified for specific hardware
|
||||
or types of kernels, such as real-time kernels.
|
||||
Each leaf thus represents the end-point for a kernel designed to run on a specific
|
||||
targeted device.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The overall result is a Git-maintained repository from which all the supported
|
||||
Yocto Project kernel types can be derived for all the supported Yocto Project devices.
|
||||
A big advantage to this scheme is the sharing of common features by keeping them in
|
||||
"larger" branches within the tree.
|
||||
This practice eliminates redundant storage of similar features shared among kernels.
|
||||
</para>
|
||||
|
||||
<note>
|
||||
Keep in mind the figure does not take into account all four supported Linux Yocto
|
||||
kernel types, but rather shows a single generic kernel just for conceptual purposes.
|
||||
Also keep in mind that this structure represents the Yocto Project source repositories
|
||||
that are either pulled from during the build or established on the host development system
|
||||
prior to the build by either cloning a particular kernel's Git repository or by
|
||||
downloading and unpacking a tarball.
|
||||
</note>
|
||||
|
||||
<para>
|
||||
Storage of all the available kernel source code is one thing, while representing the
|
||||
code on your host development system is another.
|
||||
Conceptually, you can think of the Yocto Project kernel source repositories as all the
|
||||
source files necessary for all the supported kernels.
|
||||
As a developer, you are just interested in the source files for the kernel on
|
||||
on which you are working.
|
||||
And, furthermore, you need them available on your host system.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
You make kernel source code available on your host development system by using
|
||||
Git to create a bare clone of the Linux Yocto kernel Git repository
|
||||
in which you are interested.
|
||||
Then, you use Git again to clone a copy of that bare clone.
|
||||
This copy represents the directory structure on your host system that is particular
|
||||
to the kernel you want.
|
||||
These are the files you actually modify to change the kernel.
|
||||
See the <link linkend='local-kernel-files'>Linux Yocto Kernel</link> item earlier
|
||||
in this manual for an example of how to set up the kernel source directory
|
||||
structure on your host system.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
This next figure illustrates how the kernel source files might be arranged on
|
||||
your host system.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
<imagedata fileref="figures/kernel-overview-3.png"
|
||||
width="6in" depth="4in" align="center" scale="100" />
|
||||
</para>
|
||||
|
||||
<para>
|
||||
In the previous figure, the file structure on the left represents the bare clone
|
||||
set up to track the Yocto Project kernel Git repository.
|
||||
The structure on the right represents the copy of the bare clone.
|
||||
When you make modifcations to the kernel source code, this is the area in which
|
||||
you work.
|
||||
Once you make corrections, you must use Git to push the committed changes to the
|
||||
bare clone.
|
||||
The example in <xref linkend='modifying-the-kernel-source-code'>
|
||||
Modifying the Kernel Source Code</xref> provides a detailed example.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
What happens during the build?
|
||||
When you build the kernel on your development system all files needed for the build
|
||||
are taken from the Yocto Project source repositories pointed to by the
|
||||
<filename>SRC_URI</filename> variable and gathered in a temporary work area
|
||||
where they are subsequently used to create the unique kernel.
|
||||
Thus, in a sense, the process constructs a local source tree specific to your
|
||||
kernel to generate the new kernel image - a source generator if you will.
|
||||
</para>
|
||||
The following figure shows the temporary file structure
|
||||
created on your host system when the build occurs.
|
||||
This build directory contains all the source files used during the build.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
<imagedata fileref="figures/kernel-overview-2.png"
|
||||
width="6in" depth="5in" align="center" scale="100" />
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Again, for a complete discussion of the Yocto Project kernel's architcture and its
|
||||
branching strategy,
|
||||
see the <ulink url='http://www.yoctoproject.org/docs/latest/kernel-manual/kernel-manual.html'>
|
||||
The Yocto Project Kernel Architecture and Use Manual</ulink>.
|
||||
Also, you can reference
|
||||
<xref linkend='modifying-the-kernel-source-code'>Modifying the Kernel Source Code</xref>
|
||||
for a detailed example that modifies the kernel.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id='kernel-modification-workflow'>
|
||||
<title>Kernel Modification Workflow</title>
|
||||
|
||||
<para>
|
||||
This illustration and the following list summarizes the kernel modification general workflow.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
<imagedata fileref="figures/kernel-dev-flow.png"
|
||||
width="6in" depth="7.5in" align="center" scalefit="1" />
|
||||
</para>
|
||||
|
||||
<para>
|
||||
<orderedlist>
|
||||
<listitem><para><emphasis>Set up your host development system to support
|
||||
development using the Yocto Project</emphasis>: See
|
||||
"<ulink url='http://www.yoctoproject.org/docs/latest/yocto-project-qs/yocto-project-qs.html#the-linux-distro'>The Linux Distributions</ulink>" and
|
||||
"<ulink url='http://www.yoctoproject.org/docs/latest/yocto-project-qs/yocto-project-qs.html#packages'>The Packages</ulink>" sections both
|
||||
in the Yocto Project Quick Start for requirements.</para></listitem>
|
||||
<listitem><para><emphasis>Establish a local copy of the Yocto Project files on your
|
||||
system</emphasis>: Having the Yocto Project files on your system gives you access to
|
||||
the build process and tools you need.
|
||||
For information on how to get these files, see the bulleted item
|
||||
"<link linkend='local-yp-release'>Yocto Project Release</link>" earlier in this manual.
|
||||
</para></listitem>
|
||||
<listitem><para><emphasis>Set up the <filename>poky-extras</filename> Git
|
||||
repository</emphasis>: This repository is the area for your configuration
|
||||
fragments, new kernel recipes, and the kernel <filename>.bbappend</filename>
|
||||
file used during the build.
|
||||
It is good practice to set this repository up inside the local Yocto
|
||||
Project files Git repository.
|
||||
For information on how to get these files, see the bulleted item
|
||||
"<link linkend='poky-extras-repo'>The <filename>poky-extras</filename> Git Repository</link>"
|
||||
earlier in this manual.
|
||||
<note>While it is certainly possible to modify the kernel without involving
|
||||
a local Git repository, the suggested workflow for kernel modification
|
||||
using the Yocto Project does use a Git repository.</note></para></listitem>
|
||||
<listitem><para><emphasis>Establish a local copy of the Linux Yocto kernel files on your
|
||||
system</emphasis>: In order to make modifications to the kernel you need two things:
|
||||
a bare clone of the Linux Yocto kernel you are modifying and
|
||||
a copy of that bare clone.
|
||||
The bare clone is required by the build process and is the area to which you
|
||||
push your kernel source changes (pulling does not work with bare clones).
|
||||
The copy of the bare clone is a local Git repository that contains all the kernel's
|
||||
source files.
|
||||
You make your changes to the files in this copy of the bare clone.
|
||||
For information on how to set these two items up, see the bulleted item
|
||||
"<link linkend='local-kernel-files'>Linux Yocto Kernel</link>"
|
||||
earlier in this manual.</para></listitem>
|
||||
<listitem><para><emphasis>Make changes to the kernel source code if
|
||||
applicable</emphasis>: Modifying the kernel does not always mean directly
|
||||
changing source files.
|
||||
However, if you have to do this, you make the changes in the local
|
||||
Git repository you set up to hold the source files (i.e. the copy of the
|
||||
bare clone).
|
||||
Once the changes are made, you need to use Git commands to commit the changes
|
||||
and then push them to the bare clone.</para></listitem>
|
||||
<listitem><para><emphasis>Make kernel configuration changes
|
||||
if applicable</emphasis>:
|
||||
If your situation calls for changing the kernel's configuration, you can
|
||||
use <filename>menuconfig</filename>
|
||||
to enable and disable kernel configurations.
|
||||
Using <filename>menuconfig</filename> allows you to interactively develop and test the
|
||||
configuration changes you are making to the kernel.
|
||||
When saved, changes using <filename>menuconfig</filename> update the kernel's
|
||||
<filename>.config</filename>.
|
||||
Try to resist the temptation of directly editing the <filename>.config</filename>
|
||||
file found in the Yocto Project build directory at
|
||||
<filename>tmp/sysroots/<machine-name>/kernel</filename>.
|
||||
Doing so, can produce unexpected results when the Yocto Project build system
|
||||
regenerates the configuration file.</para>
|
||||
<para>Once you are satisfied with the configuration changes made using
|
||||
<filename>menuconfig</filename>, you can directly examine the
|
||||
<filename>.config</filename> file against a saved original and gather those
|
||||
changes into a config fragment to be placed inside a
|
||||
<filename>.bbappend</filename></para></listitem>
|
||||
<listitem><para><emphasis>Add or extend kernel recipes if applicable</emphasis>:
|
||||
The standard
|
||||
layer structure organizes recipe files inside the
|
||||
<filename>meta-kernel-dev</filename> layer that is within the
|
||||
<filename>poky-extras</filename> Git repository.
|
||||
If you need to add new kernel recipes, you add them within this layer.
|
||||
Also within this area, you will find the <filename>.bbappend</filename>
|
||||
file that appends information to the kernel's recipe file used during the
|
||||
build.
|
||||
</para></listitem>
|
||||
<listitem><para><emphasis>Prepare for the build</emphasis>: Once you have made all the
|
||||
changes to your kernel (configurations, source code changes, recipe additions,
|
||||
or recipe changes), there remains a few things
|
||||
you need to do in order for the Yocto Project build system to create your image.
|
||||
If you have not done so, you need to get the build environment ready by sourcing
|
||||
the environment setup script described earlier.
|
||||
You also need to be sure two key configuration files
|
||||
(<filename>local.conf</filename> and <filename>bblayers.conf</filename>)
|
||||
are configured appropriately.</para>
|
||||
<para>The entire process for building an image is overviewed in the
|
||||
"<ulink url='http://www.yoctoproject.org/docs/latest/yocto-project-qs/yocto-project-qs.html#building-image'>Building an Image</ulink>" section of the Yocto Project Quick Start.
|
||||
You might want to reference this information.
|
||||
Also, you should look at the detailed examples found in the appendices at
|
||||
at the end of this manual.</para></listitem>
|
||||
<listitem><para><emphasis>Build the image</emphasis>: The Yocto Project
|
||||
build system Poky uses the BitBake
|
||||
tool to build images based on the type of image you want to create.
|
||||
You can find more information on BitBake
|
||||
<ulink url='http://bitbake.berlios.de/manual/'>here</ulink>.</para>
|
||||
<para>The build process supports several types of images to satisfy different needs.
|
||||
See the appendix
|
||||
"<ulink url='http://www.yoctoproject.org/docs/latest/poky-ref-manual/poky-ref-manual.html#ref-images'>Reference: Images</ulink>" in the
|
||||
<ulink url='http://www.yoctoproject.org/docs/latest/poky-ref-manual/poky-ref-manual.html'>
|
||||
Yocto Project Reference Manual</ulink> for information on supported
|
||||
images.</para></listitem>
|
||||
<listitem><para><emphasis>Make your configuration changes available
|
||||
in the kernel layer</emphasis>: Up to this point, all the configuration changes to the
|
||||
kernel have been done and tested iteratively.
|
||||
Once they are tested and ready to go, you can move them into the kernel layer,
|
||||
which allows you to distribute the layer.</para></listitem>
|
||||
<listitem><para><emphasis>If applicable, share your in-tree changes</emphasis>:
|
||||
If the changes you made
|
||||
are suited for all Linux Yocto users, you might want to send them on for inclusion
|
||||
into the Linux Yocto Git repository.
|
||||
If the changes are accepted, the Yocto Project Maintainer pulls them into
|
||||
the master branch of the kernel tree.
|
||||
Doing so makes them available to everyone using the kernel.</para></listitem>
|
||||
</orderedlist>
|
||||
</para>
|
||||
</section>
|
||||
</section>
|
||||
</section>
|
||||
|
||||
<section id='place-holder-section-two'>
|
||||
<title>Application Development Workflow</title>
|
||||
|
||||
<para>
|
||||
Application development involves creation of an application that you want to be able
|
||||
to run on your target hardware, which is running a Linux Yocto image.
|
||||
The Yocto Project provides an Application Development Toolkit (ADT) that
|
||||
facilitates quick development and integration of your application into its run-time environment.
|
||||
Using the ADT you can employ cross-development toolchains designed for your target hardware
|
||||
to compile and link your application.
|
||||
You can then deploy your application to the actual hardware or to the QEMU emulator for testing.
|
||||
If you are familiar with the popular Eclipse IDE, you can use an Eclipse Yocto Plug-in to
|
||||
allow you to develop, deploy, and test your application all from within Eclipse.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
While we strongly suggest using the Yocto Project ADT to develop your application, you might
|
||||
not want to.
|
||||
If this is the case, you can still use pieces of the Yocto Project for your development process.
|
||||
However, because the process can vary greatly, this manual does not provide detail on the process.
|
||||
</para>
|
||||
|
||||
<section id='workflow-using-the-adt-and-eclipse'>
|
||||
<title>Workflow Using the ADT and <trademark class='trade'>Eclipse</trademark></title>
|
||||
|
||||
<para>
|
||||
To help you understand how application development works in the Yocto Project ADT
|
||||
environment, this section
|
||||
provides an overview of the general development process.
|
||||
If you want to see a detailed example of the process as it is used from within the Eclipse
|
||||
IDE, see
|
||||
<ulink url='http://www.yoctoproject.org/docs/latest/adt-manual/adt-manual.html'>
|
||||
The Application Development Toolkit (ADT) User's Manual</ulink>.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
This illustration and the following list summarizes the application development general workflow.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
<imagedata fileref="figures/app-dev-flow.png"
|
||||
width="7in" depth="8in" align="center" scale="100" />
|
||||
</para>
|
||||
|
||||
<para>
|
||||
<orderedlist>
|
||||
<listitem><para><emphasis>Prepare the Host System for the Yocto Project</emphasis>:
|
||||
See
|
||||
"<ulink url='http://www.yoctoproject.org/docs/latest/yocto-project-qs/yocto-project-qs.html#the-linux-distro'>The Linux Distributions</ulink>" and
|
||||
"<ulink url='http://www.yoctoproject.org/docs/latest/yocto-project-qs/yocto-project-qs.html#packages'>The Packages</ulink>" sections both
|
||||
in the Yocto Project Quick Start for requirements.</para></listitem>
|
||||
|
||||
<!--
|
||||
WRITER NOTE: The areas to get the kernel and root filesystem are located in the Index of
|
||||
downloads. There are many forms of each. The files that have "rootfs" are just the
|
||||
target root filesystems. The file that is very small and starts with bzImage is just
|
||||
the kernel image isolated so that it can be written to a special on-board area of
|
||||
flash memory. Some systems require this. In the machines directory there are
|
||||
files that combine the kernel image and the root filesystem. These files are the ISO
|
||||
and HDDIMG files. ISO images are designed to be deployed on a DVD or CD. The ISO
|
||||
images are designed to be deployed on a USB stick. There might be some relics in
|
||||
the machine directory. For example, there is the "emenlow-bernard-5.0.0.tar.bz2"
|
||||
file. Nobody seems to know what this is. If a developer needs the image and the
|
||||
root filesystem I think that they want the small kernel image and a matching root
|
||||
filesystem. Although, Paul Eggleton says that the HDDIMG types could be used to
|
||||
develop on. I am not sure that we can use one of those in the ADT though as they
|
||||
want you to point to the kernel image and the target root filesystem. Maybe you
|
||||
could just point to the same spot. I am not sure.
|
||||
-->
|
||||
|
||||
<listitem><para><emphasis>Secure the Linux Yocto Kernel Target Image</emphasis>:
|
||||
You must have a target kernel image that has been built using the Yocto Project.</para>
|
||||
<para>Depending on whether the Yocto Project has a pre-built image that matches your target
|
||||
architecture and where you are going to run the image while you develop your application
|
||||
(QEMU or real hardware), the area you get the image from differs.
|
||||
<itemizedlist>
|
||||
<listitem><para>Download the image from
|
||||
<ulink url='http://www.yoctoproject.org/downloads/yocto-1.1/machines/'>
|
||||
<filename>machines</filename></ulink> if your target architecture is supported
|
||||
and you are going to develop and test your application on actual hardware.
|
||||
</para></listitem>
|
||||
<listitem><para>Download the image from the
|
||||
<ulink url='http://www.yoctoproject.org/downloads/yocto-1.1/machines/qemu/'>
|
||||
<filename>machines/qemu</filename></ulink> if your target architecture is supported
|
||||
and you are going to develop and test your application using the QEMU
|
||||
emulator.</para></listitem>
|
||||
<listitem><para>Build your image if you cannot find a pre-built image that matches
|
||||
your target architecture.
|
||||
If your target architecture is similar to a supported architecture, you can
|
||||
modify the kernel image before you build it.
|
||||
See the
|
||||
"<link linkend='kernel-modification-workflow'>Kernel Modification Workflow</link>"
|
||||
section earlier in this manual for information on how to create a modified
|
||||
Linux Yocto kernel.</para></listitem>
|
||||
</itemizedlist></para>
|
||||
<para>For information on pre-built kernel image naming schemes for images
|
||||
that can run on the QEMU emulator, see the
|
||||
"<ulink url='http://www.yoctoproject.org/docs/latest/yocto-project-qs/yocto-project-qs.html#using-pre-built'>Using Pre-Built Binaries and QEMU</ulink>"
|
||||
section in
|
||||
<ulink url='http://www.yoctoproject.org/docs/latest/yocto-project-qs/yocto-project-qs.html'>
|
||||
The Yocto Project Quick Start</ulink>.</para></listitem>
|
||||
<listitem><para><emphasis>Install the ADT</emphasis>:
|
||||
The ADT provides a target-specific cross-development toolchain, the root filesystem,
|
||||
the QEMU emulator, and other tools that can help you develop your application.
|
||||
While it is possible to get these pieces separately, the Yocto Project provides an
|
||||
easy method.
|
||||
You can get these pieces by running an ADT installer script, which is configurable.
|
||||
For information on how to install the ADT, see the
|
||||
"<ulink url='http://www.yoctoproject.org/docs/latest/adt-manual/adt-manual.html#using-the-adt-installer'>Using the ADT Installer</ulink>" section in
|
||||
<ulink url='http://www.yoctoproject.org/docs/latest/adt-manual/adt-manual.html'>The Yocto Project
|
||||
Application Development (ADT) User's Manual</ulink>.</para></listitem>
|
||||
<listitem><para><emphasis>If Applicable, Secure the Target Root Filesystem</emphasis>:
|
||||
If you choose not to install the ADT using the ADT Installer,
|
||||
you need to find and download the
|
||||
appropriate root filesystems.
|
||||
You can find these tarballs in the same areas used for the kernel images.
|
||||
Depending on the type of image you are running, the root filesystem you need differs.
|
||||
For example, if you are developing an application that runs on an image that
|
||||
supports Sato, you need to get root filesystem that supports Sato.
|
||||
</para></listitem>
|
||||
<listitem><para><emphasis>Create and Build your Application</emphasis>:
|
||||
At this point, you need to have source files for your application.
|
||||
Once you have the files, you can use the Eclipse IDE to import them and build the
|
||||
project.
|
||||
If you are not using Eclipse, you need to use the cross-development tools you have
|
||||
installed to create the image.</para></listitem>
|
||||
<listitem><para><emphasis>Deploy the Image with the Application</emphasis>:
|
||||
If you are using the Eclipse IDE, you can deploy your image to the hardware or to
|
||||
QEMU through the project's preferences.
|
||||
If you are not using the Eclipse IDE, then you need to deploy the application using
|
||||
other methods to the hardware.
|
||||
Or, if you are using QEMU, you need to use that tool and load your image in for testing.
|
||||
</para></listitem>
|
||||
<listitem><para><emphasis>Test and Debug the Application</emphasis>:
|
||||
Once your application is deployed, you need to test it.
|
||||
Within the Eclipse IDE, you can use the debubbing environment along with the
|
||||
set of user-space tools installed along with the ADT to debug your application.
|
||||
Of course, the same user-space tools are available separately to use if you choose
|
||||
not to use the Eclipse IDE.</para></listitem>
|
||||
</orderedlist>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id='workflow-without-adt'>
|
||||
<title>Workflow Without ADT</title>
|
||||
|
||||
<para>
|
||||
If you want to develop an application outside of the Yocto Project ADT environment, you
|
||||
can still employ the cross-development toolchain, the QEMU emulator, and a number of supported
|
||||
target image files.
|
||||
You just need to follow these general steps:
|
||||
<orderedlist>
|
||||
<listitem><para><emphasis>Install the cross-development toolchain for your target hardware:</emphasis>
|
||||
For information on how to install the toolchain, see the
|
||||
"<ulink url='http://www.yoctoproject/docs/1.1/adt-manual/adt-manual.html#using-an-existing-toolchain-tarball'>Using a Cross-Toolchain Tarball</ulink>" section in
|
||||
<ulink url='http://www.yoctoproject/docs/1.1/adt-manual/adt-manual.html'>The Yocto Project
|
||||
Application Development (ADT) User's Manual</ulink>.</para></listitem>
|
||||
<listitem><para><emphasis>Download the Target Image:</emphasis> The Yocto Project supports
|
||||
several target architectures and has many pre-built kernel images and root filesystem
|
||||
images.</para>
|
||||
<para>If you are going to develop your application on hardware, go to the
|
||||
<ulink url='http://www.yoctoproject.org/downloads/yocto-1.1/machines/'>
|
||||
<filename>machines</filename></ulink> download area and choose a target machine area
|
||||
from which to download the kernel image and root filesystem.
|
||||
This download area could have several files in it that support development using
|
||||
actual hardware.
|
||||
For example, the area might contain <filename>.hddimg</filename> files that combine the
|
||||
kernel image with the filesystem, boot loaders, etc.
|
||||
Be sure to get the files you need for your particular development process.</para>
|
||||
<para>If you are going to develop your application and then run and test it using the QEMU
|
||||
emulator, go to the
|
||||
<ulink url='http://www.yoctoproject.org/downloads/yocto-1.1/machines/qemu/'>
|
||||
<filename>machines/qemu</filename></ulink> download area.
|
||||
From this area, go down into the directory for your target architecture
|
||||
(e.g. <filename>qemux86_64</filename> for an
|
||||
<trademark class='registered'>Intel</trademark>-based 64-bit architecture).
|
||||
Download kernel, root filesystem, and any other files you need for your process.
|
||||
<note>In order to use the root filesystem in QEMU, you need to extract it.
|
||||
See the
|
||||
"<ulink url='http://www.yoctoproject.org/docs/latest/adt-manual/adt-manual.html#extracting-the-root-filesystem'>Extracting the Root Filesystem</ulink>" section for information on how to extract the
|
||||
root filesystem.</note></para></listitem>
|
||||
<listitem><para><emphasis>Develop and Test your Application:</emphasis> At this point,
|
||||
you have the tools to develop your application.
|
||||
If you need to separately install and use the QEMU emulator, you can go to
|
||||
<ulink url='http://www.qemu.org'>QEMU Home Page</ulink> to download and learn about the
|
||||
emulator.</para></listitem>
|
||||
</orderedlist>
|
||||
</para>
|
||||
</section>
|
||||
</section>
|
||||
|
||||
</chapter>
|
||||
<!--
|
||||
vim: expandtab tw=80 ts=4
|
||||
-->
|
||||
@@ -1,852 +0,0 @@
|
||||
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
|
||||
|
||||
<chapter id='dev-manual-newbie'>
|
||||
|
||||
<title>The Yocto Project Open Source Development Environment</title>
|
||||
|
||||
<para>
|
||||
This chapter helps you understand the Yocto Project as an open source development project.
|
||||
In general, working in an open source environment is very different from working in a
|
||||
closed, proprietary environment.
|
||||
Additionally, the Yocto Project uses specific tools and constructs as part of its development
|
||||
environment.
|
||||
This chapter specifically addresses open source philosophy, licensing issues, code repositories,
|
||||
the open source distributed version control system Git, and best practices using the Yocto Project.
|
||||
</para>
|
||||
|
||||
<section id='open-source-philosophy'>
|
||||
<title>Open Source Philosophy</title>
|
||||
|
||||
<para>
|
||||
Open source philosophy is characterized by software development directed by peer production
|
||||
and collaboration through an active community of developers.
|
||||
Contrast this to the more standard centralized development models used by commercial software
|
||||
companies where a finite set of developers produce a product for sale using a defined set
|
||||
of procedures that ultimately result in an end product whose architecture and source material
|
||||
are closed to the public.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Open source projects conceptually have differing concurrent agendas, approaches, and production.
|
||||
These facets of the development process can come from anyone in the public (community) that has a
|
||||
stake in the software project.
|
||||
The open source environment contains new copyright, licensing, domain, and consumer issues
|
||||
that differ from the more traditional development environment.
|
||||
In an open source environment, the end product, source material, and documentation are
|
||||
all available to the public at no cost.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
A benchmark example of an open source project is the Linux Kernel, which was initially conceived
|
||||
and created by Finnish computer science student Linus Torvalds in 1991.
|
||||
Conversely, a good example of a non-open source project is the
|
||||
<trademark class='registered'>Windows</trademark> family of operating
|
||||
systems developed by <trademark class='registered'>Microsoft</trademark> Corporation.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Wikipedia has a good historical description of the Open Source Philosophy
|
||||
<ulink url='http://en.wikipedia.org/wiki/Open_source'>here</ulink>.
|
||||
You can also find helpful information on how to participate in the Linux Community
|
||||
<ulink url='http://ldn.linuxfoundation.org/book/how-participate-linux-community'>here</ulink>.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id='yocto-project-repositories'>
|
||||
<title>Yocto Project Source Repositories</title>
|
||||
|
||||
<para>
|
||||
The Yocto Project team maintains complete source repositories for all Yocto Project files
|
||||
<ulink url='http://git.yoctoproject.org/cgit/cgit.cgi'>here</ulink>.
|
||||
This web-based source code browser is organized into categories by function such as
|
||||
IDE Plugins, Matchbox, Poky, Yocto Linux Kernel, and so forth.
|
||||
From the interface, you can click on any particular item in the "Name" column and
|
||||
see the URL at the bottom of the page that you need to set up a Git repository for
|
||||
that particular item.
|
||||
Having a local Git repository of the Yocto Project files allows you to
|
||||
make changes, contribute to the history, and ultimately enhance the Yocto Project's
|
||||
tools, Board Support Packages, and so forth.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Conversely, if you are a developer that is not interested in contributing back to the
|
||||
Yocto Project, you have the ability to simply download and extract release tarballs
|
||||
and use them within the Yocto Project environment.
|
||||
All that is required is a particular release of the Yocto Project and
|
||||
your application source code.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
For any supported release of Yocto Project, you can go to the Yocto Project website’s
|
||||
<ulink url='http://www.yoctoproject.org/download'>download page</ulink> and get a
|
||||
tarball of the release.
|
||||
You can also go to this site to download any supported BSP tarballs.
|
||||
Unpacking the tarball gives you a hierarchical directory structure of Yocto Project
|
||||
files that lets you develop using the Yocto Project.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Once you are set up through either tarball extraction or creation of Git repositories,
|
||||
you are ready to develop.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
In summary, here is where you can get the Yocto Project files needed for development:
|
||||
<itemizedlist>
|
||||
<listitem><para><emphasis><ulink url='http://git.yoctoproject.org/cgit/cgit.cgi'>Source Repositories:</ulink></emphasis>
|
||||
This area contains IDE Plugins, Matchbox, Poky, Poky Support, Tools, Yocto Linux Kernel, and Yocto
|
||||
Metadata Layers.
|
||||
You can create Git repositories for each of these areas.</para>
|
||||
<para>
|
||||
<imagedata fileref="figures/source-repos.png" align="center" width="6in" depth="4in" />
|
||||
</para></listitem>
|
||||
<listitem><para><anchor id='index-downloads' /><emphasis><ulink url='http://downloads.yoctoproject.org/releases/'>Index of /releases:</ulink></emphasis>
|
||||
This area contains an index of downloads such as
|
||||
the <trademark class='trade'>Eclipse</trademark>
|
||||
Yocto Plug-in, miscellaneous support, Poky, pseudo, cross-development toolchains,
|
||||
and all released versions of Yocto Project in the form of images or tarballs.
|
||||
Downloading and extracting these files does not produce a Git repository but rather
|
||||
a snapshot of a particular release or image.</para>
|
||||
<para>
|
||||
<imagedata fileref="figures/index-downloads.png" align="center" width="6in" depth="4in" />
|
||||
</para></listitem>
|
||||
<listitem><para><emphasis><ulink url='http://www.yoctoproject.org/download'>Yocto Project Download Page</ulink></emphasis>
|
||||
This page on the Yocto Project website allows you to download any Yocto Project
|
||||
release or Board Support Package (BSP) in tarball form.
|
||||
The tarballs are similar to those found in the
|
||||
<ulink url='http://downloads.yoctoproject.org/releases/'>Index of /releases:</ulink> area.</para>
|
||||
<para>
|
||||
<imagedata fileref="figures/yp-download.png" align="center" width="6in" depth="4in" />
|
||||
</para></listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id='yocto-project-terms'>
|
||||
<title>Yocto Project Terms</title>
|
||||
|
||||
<para>
|
||||
Following is a list of terms and definitions users new to the Yocto Project development
|
||||
environment might find helpful.
|
||||
While some of these terms are universal, the list includes them just in case:
|
||||
<itemizedlist>
|
||||
<listitem><para><emphasis>Append Files:</emphasis> Files that append build information to
|
||||
a recipe file.
|
||||
Information in append files overrides the information in the similarly-named recipe file.
|
||||
Append files use the <filename>.bbappend</filename> filename suffix.</para></listitem>
|
||||
<listitem><para><emphasis>BitBake:</emphasis> The task executor and scheduler used by
|
||||
the Yocto Project to build images.
|
||||
For more information on BitBake, see the <ulink url='http://bitbake.berlios.de/manual/'>
|
||||
BitBake documentation</ulink>.</para></listitem>
|
||||
<listitem><para><emphasis>Classes:</emphasis> Files that provide for logic encapsulation
|
||||
and inheritance allowing commonly used patterns to be defined once and easily used
|
||||
in multiple recipes.
|
||||
Class files end with the <filename>.bbclass</filename> filename extension.</para></listitem>
|
||||
<listitem><para><emphasis>Configuration File:</emphasis> Configuration information in various
|
||||
<filename>.conf</filename> files provides global definitions of variables.
|
||||
The <filename>conf/local.conf</filename> configuration file in the Yocto Project
|
||||
build directory contains user-defined variables that affect each build.
|
||||
The <filename>meta-yocto/conf/distro/poky.conf</filename> configuration file
|
||||
defines Yocto ‘distro’ configuration
|
||||
variables used only when building with this policy.
|
||||
Machine configuration files, which
|
||||
are located throughout the Yocto Project file structure, define
|
||||
variables for specific hardware and are only used when building for that target
|
||||
(e.g. the <filename>machine/beagleboard.conf</filename> configuration file defines
|
||||
variables for the Texas Instruments ARM Cortex-A8 development board).
|
||||
Configuration files end with a <filename>.conf</filename> filename extension.</para></listitem>
|
||||
<listitem><para><emphasis>Cross-Development Toolchain:</emphasis> A collection of software development
|
||||
tools and utilities that allow you to develop software for targeted architectures.
|
||||
This toolchain contains cross-compilers, linkers, and debuggers that are specific to
|
||||
an architecture.
|
||||
You can use the Yocto Project to build cross-development toolchains in tarball form that when
|
||||
unpacked contain the development tools you need to cross-compile and test your software.
|
||||
The Yocto Project ships with images that contain toolchains for supported architectures
|
||||
as well.
|
||||
Sometimes this toolchain is referred to as the meta-toolchain.</para></listitem>
|
||||
<listitem><para><emphasis>Image:</emphasis> An image is the result produced when
|
||||
BitBake processes a given collection of recipes and related metadata.
|
||||
Images are the binary output that runs on specific hardware and for specific
|
||||
use cases.
|
||||
For a list of the supported image types that the Yocto Project provides, see the
|
||||
"<ulink url='http://www.yoctoproject.org/docs/latest/poky-ref-manual/poky-ref-manual.html#ref-images'>Reference: Images</ulink>"
|
||||
appendix in
|
||||
<ulink url='http://www.yoctoproject.org/docs/latest/poky-ref-manual/poky-ref-manual.html'>
|
||||
The Yocto Project Reference Manual</ulink>.</para></listitem>
|
||||
<listitem><para><emphasis>Layer:</emphasis> A collection of recipes representing the core,
|
||||
a BSP, or an application stack.</para></listitem>
|
||||
<listitem><para><emphasis>Metadata:</emphasis> The files that BitBake parses when building an image.
|
||||
Metadata includes recipes, classes, and configuration files.</para></listitem>
|
||||
<listitem><para><emphasis>OE-Core:</emphasis> A core set of metadata originating
|
||||
with OpenEmbedded (OE) that is shared between OE and the Yocto Project.
|
||||
This metadata is found in the <filename>meta</filename> directory of the Yocto Project
|
||||
files.</para></listitem>
|
||||
<listitem><para><emphasis>Package:</emphasis> The packaged output from a baked recipe.
|
||||
A package is generally the compiled binaries produced from the recipe's sources.
|
||||
You ‘bake’ something by running it through BitBake.</para></listitem>
|
||||
<listitem><para><emphasis>Poky:</emphasis> The build tool that the Yocto Project
|
||||
uses to create images.</para></listitem>
|
||||
<listitem><para><emphasis>Recipe:</emphasis> A set of instructions for building packages.
|
||||
A recipe describes where you get source code and which patches to apply.
|
||||
Recipes describe dependencies for libraries or for other recipes, and they
|
||||
also contain configuration and compilation options.
|
||||
Recipes contain the logical unit of execution, the software/images to build, and
|
||||
use the <filename>.bb</filename> file extension.</para></listitem>
|
||||
<listitem><para><emphasis>Tasks:</emphasis> Arbitrary groups of software Recipes.
|
||||
You simply use Tasks to hold recipes that, when built, usually accomplish a single task.
|
||||
For example, a task could contain the recipes for a company’s proprietary or value-add software.
|
||||
Or, the task could contain the recipes that enable graphics.
|
||||
A task is really just another recipe.
|
||||
Because task files are recipes, they end with the <filename>.bb</filename> filename
|
||||
extension.</para></listitem>
|
||||
<listitem><para><emphasis>Upstream:</emphasis> A reference to source code or repositories
|
||||
that are not local to the development system but located in a master area that is controlled
|
||||
by the maintainer of the source code.
|
||||
For example, in order for a developer to work on a particular piece of code, they need to
|
||||
first get a copy of it from an "upstream" source.</para></listitem>
|
||||
<listitem><para><emphasis>Yocto Project Files:</emphasis>
|
||||
This term refers to the directory structure created as a result of downloading
|
||||
and unpacking a Yocto Project release tarball or setting up a Git repository
|
||||
by cloning <filename>git://git.yoctoproject.org/poky</filename>.
|
||||
Sometimes the term "the Yocto Project Files structure" is used as well.</para>
|
||||
<para>The Yocto Project files contain BitBake, Documentation, metadata and
|
||||
other files that all support the development environment.
|
||||
Consequently, you must have the Yocto Project files in place on your development
|
||||
system in order to do any development using the Yocto Project.</para>
|
||||
<para>The name of the top-level directory of the Yocto Project file structure
|
||||
is derived from the Yocto Project release tarball.
|
||||
For example, downloading and unpacking <filename>poky-edison-6.0.tar.bz2</filename>
|
||||
results in a Yocto Project file structure whose Yocto Project source directory is named
|
||||
<filename>poky-edison-6.0</filename>.
|
||||
If you create a Git repository, then you can name the repository anything you like.</para>
|
||||
<para>You can find instruction on how to set up the Yocto Project files on your
|
||||
host development system by reading
|
||||
the
|
||||
"<ulink url='http://www.yoctoproject.org/docs/latest/dev-manual/dev-manual.html#getting-setup'>Getting
|
||||
Setup</ulink>" section.</para></listitem>
|
||||
<listitem><para><emphasis>Yocto Project Build Directory:</emphasis>
|
||||
This term refers to the area used by the Yocto Project for builds.
|
||||
The area is created when you <filename>source</filename> the Yocto Project setup
|
||||
environment script that is found in the Yocto Project files area.
|
||||
(e.g. <filename>oe-init-build-env</filename>).
|
||||
You can create the Yocto Project build directory anywhere you want on your
|
||||
development system.
|
||||
Here is an example that creates the directory in <filename>mybuilds</filename>
|
||||
and names the Yocto Project build directory <filename>YP-6.0</filename>:
|
||||
<literallayout class='monospaced'>
|
||||
$ source poky-edison-6.0/oe-init-build-env $HOME/mybuilds/YP-6.0
|
||||
</literallayout>
|
||||
If you don't specifically name the directory, BitBake creates it
|
||||
in the current directory and uses the name <filename>build</filename>.
|
||||
Also, if you supply an existing directory, then BitBake uses that
|
||||
directory as the Yocto Project build directory and populates the build hierarchy
|
||||
beneath it.</para></listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id='licensing'>
|
||||
<title>Licensing</title>
|
||||
|
||||
<para>
|
||||
Because open source projects are open to the public, they have different licensing structures in place.
|
||||
License evolution for both Open Source and Free Software has an interesting history.
|
||||
If you are interested in this history, you can find basic information here:
|
||||
<itemizedlist>
|
||||
<listitem><para><ulink url='http://en.wikipedia.org/wiki/Open-source_license'>Open source license history</ulink>
|
||||
</para></listitem>
|
||||
<listitem><para><ulink url='http://en.wikipedia.org/wiki/Free_software_license'>Free software license
|
||||
history</ulink></para></listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
In general, the Yocto Project is broadly licensed under the Massachusetts Institute of Technology
|
||||
(MIT) License.
|
||||
MIT licensing permits the reuse of software within proprietary software as long as the
|
||||
license is distributed with that software.
|
||||
MIT is also compatible with the GNU General Public License (GPL).
|
||||
Patches to the Yocto Project follow the upstream licensing scheme.
|
||||
You can find information on the MIT license at
|
||||
<ulink url='http://www.opensource.org/licenses/mit-license.php'>here</ulink>.
|
||||
You can find information on the GNU GPL <ulink url='http://www.opensource.org/licenses/LGPL-3.0'>
|
||||
here</ulink>.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
When you build an image using Yocto Project, the build process uses a known list of licenses to
|
||||
ensure compliance.
|
||||
You can find this list in the Yocto Project files directory at
|
||||
<filename>meta/files/common-licenses</filename>.
|
||||
Once the build completes, the list of all licenses found and used during that build are
|
||||
kept in the Yocto Project build directory at
|
||||
<filename>tmp/deploy/images/licenses</filename>.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
If a module requires a license that is not in the base list, the build process
|
||||
generates a warning during the build.
|
||||
These tools make it easier for a developer to be certain of the licenses with which
|
||||
their shipped products must comply.
|
||||
However, even with these tools it is still up to the developer to resolve potential licensing issues.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The base list of licenses used by the build process is a combination of the Software Package
|
||||
Data Exchange (SPDX) list and the Open Source Initiative (OSI) projects.
|
||||
<ulink url='http://spdx.org'>SPDX Group</ulink> is a working group of the Linux Foundation
|
||||
that maintains a specification
|
||||
for a standard format for communicating the components, licenses, and copyrights
|
||||
associated with a software package.
|
||||
<ulink url='http://opensource.org'>OSI</ulink> is a corporation dedicated to the Open Source
|
||||
Definition and the effort for reviewing and approving licenses that are OSD-conformant.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
You can find a list of the combined SPDX and OSI licenses that the Yocto Project uses
|
||||
<ulink url='http://git.yoctoproject.org/cgit/cgit.cgi/poky/tree/meta/files/common-licenses'>here</ulink>.
|
||||
This wiki page discusses the license infrastructure used by the Yocto Project.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id='git'>
|
||||
<title>Git</title>
|
||||
|
||||
<para>
|
||||
The Yocto Project uses Git, which is a free, open source distributed version control system.
|
||||
Git supports distributed development, non-linear development, and can handle large projects.
|
||||
It is best that you know how to work with Git if you are going to use Yocto Project for development.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Git has an extensive set of commands that lets you manage changes and perform
|
||||
collaboration over the life of a project.
|
||||
Conveniently though, you can manage with a small set of basic operations and workflows
|
||||
once you understand the basic philosophy behind Git.
|
||||
You do not have to be an expert in Git to be functional.
|
||||
A good place to look for instruction on a minimal set of Git commands is
|
||||
<ulink url='http://git-scm.com/documentation'>here</ulink>.
|
||||
If you need to download Git, you can do so
|
||||
<ulink url='http://git-scm.com/download'>here</ulink>.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Git works by using branching techniques that track content change (not files)
|
||||
within a project (e.g. a new feature or updated documentation).
|
||||
Creating a tree-like structure based on project divergence allows for excellent historical
|
||||
information over the life of a project.
|
||||
This methodology also allows for an environment in which you can do lots of
|
||||
experimentation on your project as you develop changes or new features.
|
||||
For example, you can create a “branch”, experiment with some feature, and then
|
||||
if you like the feature, you incorporate the branch into the tree.
|
||||
If you don’t, you cut the branch off by deleting it.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
If you don’t know much about Git, we suggest you educate
|
||||
yourself by visiting the links previously mentioned.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The following list briefly describes some basic Git operations as a way to get started.
|
||||
As with any set of commands, this list (in most cases) simply shows the base command and
|
||||
omits the many arguments they support.
|
||||
See the Git documentation for complete descriptions and strategies on how to use these commands:
|
||||
<itemizedlist>
|
||||
<listitem><para><emphasis><filename>git init</filename>:</emphasis> Initializes an empty Git repository.
|
||||
You cannot use Git commands unless you have a <filename>.git</filename> repository.</para></listitem>
|
||||
<listitem><para><emphasis><filename>git clone</filename>:</emphasis> Creates a clone of a repository.
|
||||
During collaboration, this command allows you to create a local repository that is on
|
||||
equal footing with a fellow developer’s repository.</para></listitem>
|
||||
<listitem><para><emphasis><filename>git add</filename>:</emphasis> Adds updated file contents
|
||||
to the index that
|
||||
Git uses to track changes.
|
||||
You must add all files that have changed before you can commit them.</para></listitem>
|
||||
<listitem><para><emphasis><filename>git commit</filename>:</emphasis> Creates a “commit” that documents
|
||||
the changes you made.
|
||||
Commits are used for historical purposes, for determining if a maintainer of a project
|
||||
will allow the change, and for ultimately pushing the change from your local Git repository
|
||||
into the project’s upstream (or master) repository.</para></listitem>
|
||||
<listitem><para><emphasis><filename>git status</filename>:</emphasis> Reports any modified files that
|
||||
possibly need to be added and committed.</para></listitem>
|
||||
<listitem><para><emphasis><filename>git checkout <branch-name></filename>:</emphasis> Changes
|
||||
your working branch.
|
||||
This command is analogous to “cd”.</para></listitem>
|
||||
<listitem><para><emphasis><filename>git checkout –b <working-branch></filename>:</emphasis> Creates
|
||||
a working branch on your local machine where you can isolate work.
|
||||
It is a good idea to use local branches when adding specific features or changes.
|
||||
This way if you don’t like what you have done you can easily get rid of the work.</para></listitem>
|
||||
<listitem><para><emphasis><filename>git branch</filename>:</emphasis> Reports existing branches and
|
||||
tells you which branch in which you are currently working.</para></listitem>
|
||||
<listitem><para><emphasis><filename>git branch -D <branch-name></filename>:</emphasis>
|
||||
Deletes an existing branch.
|
||||
You need to be in a branch other than the one you are deleting
|
||||
in order to delete <branch-name>.</para></listitem>
|
||||
<listitem><para><emphasis><filename>git pull</filename>:</emphasis> Retrieves information
|
||||
from an upstream Git
|
||||
repository and places it in your local Git repository.
|
||||
You use this command to make sure you are synchronized with the repository
|
||||
from which you are basing changes (.e.g. the master repository).</para></listitem>
|
||||
<listitem><para><emphasis><filename>git push</filename>:</emphasis> Sends all your local changes you
|
||||
have committed to an upstream Git repository (e.g. a contribution repository).
|
||||
The maintainer of the project draws from these repositories when adding your changes to the
|
||||
project’s master repository.</para></listitem>
|
||||
<listitem><para><emphasis><filename>git merge</filename>:</emphasis> Combines or adds changes from one
|
||||
local branch of your repository with another branch.
|
||||
When you create a local Git repository, the default branch is named “master”.
|
||||
A typical workflow is to create a temporary branch for isolated work, make and commit your
|
||||
changes, switch to your local master branch, merge the changes from the temporary branch into the
|
||||
local master branch, and then delete the temporary branch.</para></listitem>
|
||||
<listitem><para><emphasis><filename>git cherry-pick</filename>:</emphasis> Choose and apply specific
|
||||
commits from one branch into another branch.
|
||||
There are times when you might not be able to merge all the changes in one branch with
|
||||
another but need to pick out certain ones.</para></listitem>
|
||||
<listitem><para><emphasis><filename>gitk</filename>:</emphasis> Provides a GUI view of the branches
|
||||
and changes in your local Git repository.
|
||||
This command is a good way to graphically see where things have diverged in your
|
||||
local repository.</para></listitem>
|
||||
<listitem><para><emphasis><filename>git log</filename>:</emphasis> Reports a history of your changes to the
|
||||
repository.</para></listitem>
|
||||
<listitem><para><emphasis><filename>git diff</filename>:</emphasis> Displays line-by-line differences
|
||||
between your local working files and the same files in the upstream Git repository that your
|
||||
branch currently tracks.</para></listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id='workflows'>
|
||||
<title>Workflows</title>
|
||||
|
||||
<para>
|
||||
This section provides some overview on workflows using Git.
|
||||
In particular, the information covers basic practices that describe roles and actions in a
|
||||
collaborative development environment.
|
||||
Again, if you are familiar with this type of development environment, you might want to just
|
||||
skip this section.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The Yocto Project files are maintained using Git in a "master" branch whose Git history
|
||||
tracks every change and whose structure provides branches for all diverging functionality.
|
||||
Although there is no need to use Git, many open source projects do so.
|
||||
For the Yocto Project, a key individual called the "maintainer" is responsible for the "master"
|
||||
branch of the Git repository.
|
||||
The "master" branch is the “upstream” repository where the final builds of the project occur.
|
||||
The maintainer is responsible for allowing changes in from other developers and for
|
||||
organizing the underlying branch structure to reflect release strategies and so forth.
|
||||
<note>You can see who is the maintainer for Yocto Project files by examining the
|
||||
<filename>distro_tracking_fields.inc</filename> file in the Yocto Project
|
||||
<filename>meta/conf/distro/include</filename> directory.</note>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The project also has contribution repositories known as “contrib” areas.
|
||||
These areas temporarily hold changes to the project that have been submitted or committed
|
||||
by the Yocto Project development team and by community members that contribute to the project.
|
||||
The maintainer determines if the changes are qualified to be moved from the "contrib" areas
|
||||
into the "master" branch of the Git repository.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Developers (including contributing community members) create and maintain cloned repositories
|
||||
of the upstream "master" branch.
|
||||
These repositories are local to their development platforms and are used to develop changes.
|
||||
When a developer is satisfied with a particular feature or change, they “push” the changes
|
||||
to the appropriate "contrib" repository.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Developers are responsible for keeping their local repository up-to-date with "master".
|
||||
They are also responsible for straightening out any conflicts that might arise within files
|
||||
that are being worked on simultaneously by more than one person.
|
||||
All this work is done locally on the developer’s machine before anything is pushed to a
|
||||
"contrib" area and examined at the maintainer’s level.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
A somewhat formal method exists by which developers commit changes and push them into the
|
||||
"contrib" area and subsequently request that the maintainer include them into "master"
|
||||
This process is called “submitting a patch” or “submitting a change.”
|
||||
</para>
|
||||
|
||||
<para>
|
||||
To summarize the environment: we have a single point of entry for changes into the project’s
|
||||
"master" branch of the Git repository, which is controlled by the project’s maintainer.
|
||||
And, we have a set of developers who independently develop, test, and submit changes
|
||||
to "contrib" areas for the maintainer to examine.
|
||||
The maintainer then chooses which changes are going to become a permanent part of the project.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
<imagedata fileref="figures/git-workflow.png" width="6in" depth="3in" align="left" scalefit="1" />
|
||||
</para>
|
||||
|
||||
<para>
|
||||
While each development environment is unique, there are some best practices or methods
|
||||
that help development run smoothly.
|
||||
The following list describes some of these practices.
|
||||
For more detailed information about these strategies see
|
||||
<ulink url='http://www.kernel.org/pub/software/scm/git/docs/gitworkflows.html'>Git Workflows</ulink>.
|
||||
<itemizedlist>
|
||||
<listitem><para><emphasis>Make Small Changes:</emphasis> It is best to keep the changes you commit
|
||||
small as compared to bundling many disparate changes into a single commit.
|
||||
This practice not only keeps things manageable but also allows the maintainer
|
||||
to more easily include or refuse changes.</para>
|
||||
<para>It is also good practice to leave the repository in a state that allows you to
|
||||
still successfully build your project. In other words, do not commit half of a feature,
|
||||
then add the other half in a separate, later commit.
|
||||
Each commit should take you from one buildable project state to another
|
||||
buildable state.</para></listitem>
|
||||
<listitem><para><emphasis>Use Branches Liberally:</emphasis> It is very easy to create, use, and
|
||||
delete local branches in your working Git repository.
|
||||
You can name these branches anything you like.
|
||||
It is helpful to give them names associated with the particular feature or change
|
||||
on which you are working.
|
||||
Once you are done with a feature or change, simply discard the branch.</para></listitem>
|
||||
<listitem><para><emphasis>Merge Changes:</emphasis> The <filename>git merge</filename>
|
||||
command allows you to take the
|
||||
changes from one branch and fold them into another branch.
|
||||
This process is especially helpful when more than a single developer might be working
|
||||
on different parts of the same feature.
|
||||
Merging changes also automatically identifies any collisions or “conflicts”
|
||||
that might happen as a result of the same lines of code being altered by two different
|
||||
developers.</para></listitem>
|
||||
<listitem><para><emphasis>Manage Branches:</emphasis> Because branches are easy to use, you should
|
||||
use a system where branches indicate varying levels of code readiness.
|
||||
For example, you can have a “work” branch to develop in, a “test” branch where the code or
|
||||
change is tested, a “stage” branch where changes are ready to be committed, and so forth.
|
||||
As your project develops, you can merge code across the branches to reflect ever-increasing
|
||||
stable states of the development.</para></listitem>
|
||||
<listitem><para><emphasis>Use Push and Pull:</emphasis> The push-pull workflow is based on the
|
||||
concept of developers “pushing” local commits to a remote repository, which is
|
||||
usually a contribution repository.
|
||||
This workflow is also based on developers “pulling” known states of the project down into their
|
||||
local development repositories.
|
||||
The workflow easily allows you to pull changes submitted by other developers from the
|
||||
upstream repository into your work area ensuring that you have the most recent software
|
||||
on which to develop.
|
||||
The Yocto Project has two scripts named <filename>create-pull-request</filename> and
|
||||
<filename>send-pull-request</filename> that ship with the release to facilitate this
|
||||
workflow.
|
||||
You can find these scripts in the local Yocto Project files Git repository in
|
||||
the <filename>scripts</filename> directory.</para></listitem>
|
||||
<listitem><para><emphasis>Patch Workflow:</emphasis> This workflow allows you to notify the
|
||||
maintainer through an email that you have a change (or patch) you would like considered
|
||||
for the "master" branch of the Git repository.
|
||||
To send this type of change you format the patch and then send the email using the Git commands
|
||||
<filename>git format-patch</filename> and <filename>git send-email</filename>.
|
||||
You can find information on how to submit later in this chapter.</para></listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id='tracking-bugs'>
|
||||
<title>Tracking Bugs</title>
|
||||
|
||||
<para>
|
||||
The Yocto Project uses its own implementation of
|
||||
<ulink url='http://www.bugzilla.org/about/'>Bugzilla</ulink> to track bugs.
|
||||
Implementations of Bugzilla work well for group development because they track bugs and code
|
||||
changes, can be used to communicate changes and problems with developers, can be used to
|
||||
submit and review patches, and can be used to manage quality assurance.
|
||||
The home page for the Yocto Project implementation of Bugzilla is
|
||||
<ulink url='http://bugzilla.yoctoproject.org'>http://bugzilla.yoctoproject.org</ulink>.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Sometimes it is helpful to submit, investigate, or track a bug against the Yocto Project itself
|
||||
such as when discovering an issue with some component of the build system that acts contrary
|
||||
to the documentation or your expectations.
|
||||
Following is the general procedure for submitting a new bug using the Yocto Project
|
||||
Bugzilla.
|
||||
You can find more information on defect management, bug tracking, and feature request
|
||||
processes all accomplished through the Yocto Project Bugzilla on the wiki page
|
||||
<ulink url='https://wiki.yoctoproject.org/wiki/Bugzilla_Configuration_and_Bug_Tracking'>here</ulink>.
|
||||
<orderedlist>
|
||||
<listitem><para>Always use the Yocto Project implementation of Bugzilla to submit
|
||||
a bug.</para></listitem>
|
||||
<listitem><para>When submitting a new bug, be sure to choose the appropriate
|
||||
Classification, Product, and Component for which the issue was found.
|
||||
Defects for Yocto Project fall into one of four classifications: Yocto Projects,
|
||||
Infrastructure, Poky, and Yocto Metadata Layers.
|
||||
Each of these Classifications break down into multiple Products and, in some
|
||||
cases, multiple Components.</para></listitem>
|
||||
<listitem><para>Use the bug form to choose the correct Hardware and Architecture
|
||||
for which the bug applies.</para></listitem>
|
||||
<listitem><para>Indicate the Yocto Project version you were using when the issue
|
||||
occurred.</para></listitem>
|
||||
<listitem><para>Be sure to indicate the Severity of the bug.
|
||||
Severity communicates how the bug impacted your work.</para></listitem>
|
||||
<listitem><para>Provide a brief summary of the issue.
|
||||
Try to limit your summary to just a line or two and be sure to capture the
|
||||
essence of the issue.</para></listitem>
|
||||
<listitem><para>Provide a detailed description of the issue.
|
||||
You should provide as much detail as you can about the context, behavior, output,
|
||||
and so forth that surround the issue.
|
||||
You can even attach supporting files for output or log by using the "Add an attachment"
|
||||
button.</para></listitem>
|
||||
<listitem><para>Submit the bug by clicking the "Submit Bug" button.</para></listitem>
|
||||
</orderedlist>
|
||||
</para>
|
||||
|
||||
<note>
|
||||
Bugs in the Yocto Project Bugzilla follow naming convention:
|
||||
<filename>[YOCTO #<number>]</filename>, where <filename><number></filename> is the
|
||||
assigned defect ID used in Bugzilla.
|
||||
So, for example, a valid way to refer to a defect would be <filename>[YOCTO #1011]</filename>.
|
||||
This convention becomes important if you are submitting patches against the Yocto Project
|
||||
code itself.
|
||||
</note>
|
||||
</section>
|
||||
|
||||
<section id='how-to-submit-a-change'>
|
||||
<title>How to Submit a Change</title>
|
||||
|
||||
<para>
|
||||
Contributions to the Yocto Project are very welcome.
|
||||
You should send patches to the appropriate Yocto Project mailing list to get them
|
||||
in front of the Yocto Project Maintainer.
|
||||
For a list of the Yocto Project mailing lists, see the
|
||||
"<ulink url='http://www.yoctoproject.org/docs/latest/poky-ref-manual/poky-ref-manual.html#resources-mailinglist'>Mailing lists</ulink>" section in
|
||||
<ulink url='http://www.yoctoproject.org/docs/latest/poky-ref-manual/poky-ref-manual.html'> The
|
||||
Yocto Project Reference Manual</ulink>.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The following is some guidance on which mailing list to use for what type of defect:
|
||||
<itemizedlist>
|
||||
<listitem><para>For defects against the Yocto Project build system Poky, send
|
||||
your patch to the
|
||||
<ulink url='http://lists.yoctoproject.org/listinfo/poky'></ulink> mailing list.
|
||||
This mailing list corresponds to issues that are not specific to the Yocto Project but
|
||||
are part of the OE-core.
|
||||
For example, a defect against anything in the <filename>meta</filename> layer
|
||||
or the BitBake Manual could be sent to this mailing list.</para></listitem>
|
||||
<listitem><para>For defects against Yocto-specific layers, tools, and Yocto Project
|
||||
documentation use the
|
||||
<ulink url='http://lists.yoctoproject.org/listinfo/yocto'></ulink> mailing list.
|
||||
This mailing list corresponds to Yocto-specific areas such as
|
||||
<filename>meta-yocto</filename>, <filename>meta-intel</filename>,
|
||||
<filename>linux-yocto</filename>, and <filename>documentation</filename>.</para></listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
When you send a patch, be sure to include a "Signed-off-by:"
|
||||
line in the same style as required by the Linux kernel.
|
||||
Adding this line signifies the developer has agreed to the Developer's Certificate of Origin 1.1
|
||||
as follows:
|
||||
<literallayout class='monospaced'>
|
||||
Developer's Certificate of Origin 1.1
|
||||
|
||||
By making a contribution to this project, I certify that:
|
||||
|
||||
(a) The contribution was created in whole or in part by me and I
|
||||
have the right to submit it under the open source license
|
||||
indicated in the file; or
|
||||
|
||||
(b) The contribution is based upon previous work that, to the best
|
||||
of my knowledge, is covered under an appropriate open source
|
||||
license and I have the right under that license to submit that
|
||||
work with modifications, whether created in whole or in part
|
||||
by me, under the same open source license (unless I am
|
||||
permitted to submit under a different license), as indicated
|
||||
in the file; or
|
||||
|
||||
(c) The contribution was provided directly to me by some other
|
||||
person who certified (a), (b) or (c) and I have not modified
|
||||
it.
|
||||
|
||||
(d) I understand and agree that this project and the contribution
|
||||
are public and that a record of the contribution (including all
|
||||
personal information I submit with it, including my sign-off) is
|
||||
maintained indefinitely and may be redistributed consistent with
|
||||
this project or the open source license(s) involved.
|
||||
</literallayout>
|
||||
A Poky contributions tree (<filename>poky-contrib</filename>,
|
||||
<filename>git://git.yoctoproject.org/poky-contrib.git</filename>)
|
||||
exists for contributors to stage contributions.
|
||||
If people desire such access, please ask on the mailing list.
|
||||
Usually, the Yocto Project team will grant access to anyone with a proven track
|
||||
record of good patches.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
In a collaborative environment, it is necessary to have some sort of standard
|
||||
or method through which you submit changes.
|
||||
Otherwise, things could get quite chaotic.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
When you create a commit, you must follow certain standards established by the
|
||||
Yocto Project development team.
|
||||
For each commit, you must provide a single-line summary of the change and you
|
||||
almost always provide a more detailed description of what you did (i.e. the body
|
||||
of the commit).
|
||||
The only exceptions for not providing a detailed description would be if your
|
||||
change is a simple, self-explanatory change that needs no description.
|
||||
Here are the Yocto Project commit message guidelines:
|
||||
<itemizedlist>
|
||||
<listitem><para>Provide a single-line, short summary of the change.
|
||||
This summary is typically viewable by source control systems.
|
||||
Thus, providing something short and descriptive that gives the reader
|
||||
a summary of the change is useful when viewing a list of many commits.
|
||||
</para></listitem>
|
||||
<listitem><para>For the body of the commit message, provide detailed information
|
||||
that describes what you changed, why you made the change, and the approach
|
||||
you used.
|
||||
Provide as much detail as you can in the body of the commit message.
|
||||
</para></listitem>
|
||||
<listitem><para>If the change addresses a specific bug or issue that is
|
||||
associated with a bug-tracking ID, prefix your detailed description
|
||||
with the bug or issue ID.
|
||||
For example, the Yocto Project tracks bugs using a bug-naming convention.
|
||||
Any commits that address a bug must start with the bug ID in the description
|
||||
as follows:
|
||||
<literallayout class='monospaced'>
|
||||
YOCTO #<bug-id>: <Detailed description of commit>
|
||||
</literallayout></para></listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
You can find more guidance on creating well-formed commit messages at this OpenEmbedded
|
||||
wiki page:
|
||||
<ulink url='http://www.openembedded.org/wiki/Commit_Patch_Message_Guidelines'></ulink>.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Following are general instructions for both pushing changes upstream and for submitting changes as patches.
|
||||
</para>
|
||||
|
||||
<section id='pushing-a-change-upstream'>
|
||||
<title>Pushing a Change Upstream and Requesting a Pull</title>
|
||||
|
||||
<para>
|
||||
The basic flow for pushing a change to an upstream "contrib" Git repository is as follows:
|
||||
<itemizedlist>
|
||||
<listitem><para>Make your changes in your local Git repository.</para></listitem>
|
||||
<listitem><para>Stage your commit (or change) by using the <filename>git add</filename>
|
||||
command.</para></listitem>
|
||||
<listitem><para>Commit the change by using the <filename>git commit</filename>
|
||||
command and push it to the "contrib" repository.
|
||||
Be sure to provide a commit message that follows the project’s commit standards
|
||||
as described earlier.</para></listitem>
|
||||
<listitem><para>Notify the maintainer that you have pushed a change by making a pull
|
||||
request.
|
||||
The Yocto Project provides two scripts that conveniently let you generate and send
|
||||
pull requests to the Yocto Project.
|
||||
These scripts are <filename>create-pull-request</filename> and
|
||||
<filename>send-pull-request</filename>.
|
||||
You can find these scripts in the <filename>scripts</filename> directory of the
|
||||
Yocto Project file structure.</para>
|
||||
<para>For help on using these scripts, simply provide the
|
||||
<filename>--help</filename> argument as follows:
|
||||
<literallayout class='monospaced'>
|
||||
$ ~/poky/scripts/create-pull-request --help
|
||||
$ ~/poky/scripts/send-pull-request --help
|
||||
</literallayout></para></listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
You can find general Git information on how to push a change upstream
|
||||
<ulink url='http://www.kernel.org/pub/software/scm/git/docs/user-manual.html#Developing-With-git'>
|
||||
here</ulink>.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id='submitting-a-patch'>
|
||||
<title>Submitting a Patch Through Email</title>
|
||||
|
||||
<para>
|
||||
If you have a just a few changes, you can commit them and then submit them as an
|
||||
email to the maintainer.
|
||||
Here is a general procedure:
|
||||
<itemizedlist>
|
||||
<listitem><para>Make your changes in your local Git repository.</para></listitem>
|
||||
<listitem><para>Stage your commit (or change) by using the <filename>git add</filename>
|
||||
command.</para></listitem>
|
||||
<listitem><para>Commit the change by using the
|
||||
<filename>git commit --signoff</filename> command.
|
||||
Using the <filename>--signoff</filename> option identifies you as the person
|
||||
making the change and also satisfies the Developer's Certificate of
|
||||
Origin (DCO) shown earlier.</para>
|
||||
<para>When you form a commit you must follow certain standards established by the
|
||||
Yocto Project development team.
|
||||
See the earlier section
|
||||
"<link linkend='how-to-submit-a-change'>How to Submit a Change</link>"
|
||||
for Yocto Project commit message standards.</para></listitem>
|
||||
<listitem><para>Format the commit into an email messsage.
|
||||
To format commits, use the <filename>git format-patch</filename> command.
|
||||
When you provide the command, you must include a revision list or a number of patches
|
||||
as part of the command.
|
||||
For example, these two commands each take the most recent single commit and
|
||||
format it as an email message in the current directory:
|
||||
<literallayout class='monospaced'>
|
||||
$ git format-patch -1
|
||||
$ git format-patch HEAD~
|
||||
</literallayout></para>
|
||||
<para>After the command is run, the current directory contains a
|
||||
numbered <filename>.patch</filename> file for the commit.</para>
|
||||
<para>If you provide several commits as part of the command,
|
||||
the <filename>git format-patch</filename> command produces a numbered
|
||||
series of files in the current directory – one for each commit.
|
||||
If you have more than one patch, you should also use the
|
||||
<filename>--cover</filename> option with the command, which generates a
|
||||
cover letter as the first "patch" in the series.
|
||||
You can then edit the cover letter to provide a description for
|
||||
the series of patches.
|
||||
For information on the <filename>git format-patch</filename> command,
|
||||
see <filename>GIT_FORMAT_PATCH(1)</filename> displayed using the
|
||||
<filename>man git-format-patch</filename> command.</para></listitem>
|
||||
<listitem><para>Import the files into your mail client by using the
|
||||
<filename>git send-email</filename> command.
|
||||
<note>In order to use <filename>git send-email</filename>, you must have the
|
||||
the proper Git packages installed.
|
||||
For Ubuntu and Fedora the package is <filename>git-email</filename>.</note></para>
|
||||
<para>The <filename>git send-email</filename> command sends email by using a local
|
||||
or remote Mail Transport Agent (MTA) such as
|
||||
<filename>msmtp</filename>, <filename>sendmail</filename>, or through a direct
|
||||
<filename>smtp</filename> configuration in your Git <filename>config</filename>
|
||||
file.
|
||||
If you are submitting patches through email only, it is very important
|
||||
that you submit them without any whitespace or HTML formatting that
|
||||
either you or your mailer introduces.
|
||||
The maintainer that receives your patches needs to be able to save and
|
||||
apply them directly from your emails.
|
||||
A good way to verify that what you are sending will be applicable by the
|
||||
maintainer is to do a dry run and send them to yourself and then
|
||||
save and apply them as the maintainer would.</para>
|
||||
<para>The <filename>git send-email</filename> command is the preferred method
|
||||
for sending your patches since there is no risk of compromising whitespace
|
||||
in the body of the message, which can occur when you use your own mail client.
|
||||
The command also has several options that let you
|
||||
specify recipients and perform further editing of the email message.
|
||||
For information on how to use the <filename>git send-email</filename> command,
|
||||
use the <filename>man git-send-email</filename> command.</para></listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
</section>
|
||||
</section>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</chapter>
|
||||
<!--
|
||||
vim: expandtab tw=80 ts=4
|
||||
-->
|
||||
@@ -1,274 +0,0 @@
|
||||
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
|
||||
|
||||
<chapter id='dev-manual-start'>
|
||||
|
||||
<title>Getting Started with the Yocto Project</title>
|
||||
|
||||
<para>
|
||||
This chapter introduces the Yocto Project and gives you an idea of what you need to get started.
|
||||
You can find enough information to set up your development host and build or use images for
|
||||
hardware supported by the Yocto Project by reading
|
||||
<ulink url='http://www.yoctoproject.org/docs/latest/yocto-project-qs/yocto-project-qs.html'>
|
||||
The Yocto Project Quick Start</ulink>.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The remainder of this chapter summarizes what is in the Yocto Project Quick Start and provides
|
||||
some higher-level concepts you might want to consider.
|
||||
</para>
|
||||
|
||||
<section id='introducing-the-yocto-project'>
|
||||
<title>Introducing the Yocto Project</title>
|
||||
|
||||
<para>
|
||||
The Yocto Project is an open-source collaboration project focused on embedded Linux development.
|
||||
The project currently provides a build system, which is sometimes referred to as "Poky",
|
||||
and provides various ancillary tools suitable for the embedded developer.
|
||||
The Yocto Project also features the Sato reference User Interface, which is optimized for
|
||||
stylus driven, low-resolution screens.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
You can use the Yocto Project, which uses the BitBake build tool, to develop complete Linux
|
||||
images and associated user-space applications for architectures based on ARM, MIPS, PowerPC,
|
||||
x86 and x86-64.
|
||||
While the Yocto Project does not provide a strict testing framework,
|
||||
it does provide or generate for you artifacts that let you perform target-level and
|
||||
emulated testing and debugging.
|
||||
Additionally, if you are an <trademark class='trade'>Eclipse</trademark>
|
||||
IDE user, you can install an Eclipse Yocto Plug-in to allow you to
|
||||
develop within that familiar environment.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id='getting-setup'>
|
||||
<title>Getting Set Up</title>
|
||||
|
||||
<para>
|
||||
Here is what you need to get set up to use the Yocto Project:
|
||||
<itemizedlist>
|
||||
<listitem><para><emphasis>Host System:</emphasis> You should have a reasonably current
|
||||
Linux-based host system.
|
||||
You will have the best results with a recent release of Fedora,
|
||||
OpenSUSE, or Ubuntu as these releases are frequently tested against the Yocto Project
|
||||
and officially supported.
|
||||
You should also have about 100 gigabytes of free disk space for building images.
|
||||
</para></listitem>
|
||||
<listitem><para><emphasis>Packages:</emphasis> The Yocto Project requires certain packages
|
||||
exist on your development system (e.g. Python 2.6 or 2.7).
|
||||
See "<ulink url='http://www.yoctoproject.org/docs/latest/yocto-project-qs/yocto-project-qs.html#packages'>The Packages</ulink>"
|
||||
section in the Yocto Project Quick start for the exact package
|
||||
requirements and the installation commands to install them
|
||||
for the supported distributions.</para></listitem>
|
||||
<listitem id='local-yp-release'><para><emphasis>Yocto Project Release:</emphasis>
|
||||
You need a release of the Yocto Project.
|
||||
You can get set up with local Yocto Project files one of two ways depending on whether you
|
||||
are going to be contributing back into the Yocto Project source repository or not.
|
||||
<note>
|
||||
Regardless of the method you use, this manual refers to the resulting
|
||||
hierarchical set of files as "the Yocto Project files" or "the Yocto Project file
|
||||
structure."
|
||||
</note>
|
||||
<itemizedlist>
|
||||
<listitem><para><emphasis>Tarball Extraction:</emphasis> If you are not going to contribute
|
||||
back into the Yocto Project, you can simply download the Yocto Project release you want
|
||||
from the website’s <ulink url='http://yoctoproject.org/download'>download page</ulink>.
|
||||
Once you have the tarball, just extract it into a directory of your choice.</para>
|
||||
<para>For example, the following command extracts the Yocto Project 1.1 release tarball
|
||||
into the current working directory and sets up the Yocto Project file structure
|
||||
with a top-level directory named <filename>poky-edison-6.0</filename>:
|
||||
<literallayout class='monospaced'>
|
||||
$ tar xfj poky-edison-6.0.tar.bz2
|
||||
</literallayout></para>
|
||||
<para>This method does not produce a Git repository.
|
||||
Instead, you simply end up with a local snapshot of the
|
||||
Yocto Project files that are based on the particular release in the
|
||||
tarball.</para></listitem>
|
||||
<listitem><para><emphasis>Git Repository Method:</emphasis> If you are going to be contributing
|
||||
back into the Yocto Project, you should use Git commands to set up a local
|
||||
Git repository of the Yocto Project files.
|
||||
Doing so creates a Git repository with a complete history of changes and allows
|
||||
you to easily submit your changes upstream to the project.</para>
|
||||
<para>The following transcript shows how to clone the Yocto Project files'
|
||||
Git repository into the current working directory.
|
||||
The command creates the repository in a directory named <filename>poky</filename>.
|
||||
For information on the Yocto Project and Git, see the
|
||||
"<link linkend='git'>Git</link>" section.
|
||||
<literallayout class='monospaced'>
|
||||
$ git clone git://git.yoctoproject.org/poky
|
||||
Initialized empty Git repository in /home/scottrif/poky/.git/
|
||||
remote: Counting objects: 116882, done.
|
||||
remote: Compressing objects: 100% (35987/35987), done.
|
||||
remote: Total 116882 (delta 80651), reused 113045 (delta 77578)
|
||||
Receiving objects: 100% (116882/116882), 72.13 MiB | 2.68 MiB/s, done.
|
||||
Resolving deltas: 100% (80651/80651), done. </literallayout></para>
|
||||
<para>For another example of how to set up your own local Git repositories, see this
|
||||
<ulink url='https://wiki.yoctoproject.org/wiki/Transcript:_from_git_checkout_to_meta-intel_BSP'>
|
||||
wiki page</ulink>, which describes how to create both <filename>poky</filename>
|
||||
and <filename>meta-intel</filename> Git repositories.</para></listitem>
|
||||
</itemizedlist></para></listitem>
|
||||
<listitem id='local-kernel-files'><para><emphasis>Linux Yocto Kernel:</emphasis>
|
||||
If you are going to be making modifications to a supported Linux Yocto kernel, you
|
||||
need to establish local copies of the source.
|
||||
This setup involves creating a bare clone of the Linux Yocto kernel and then cloning
|
||||
that repository.
|
||||
You can create the bare clone and the copy of the bare clone anywhere you like.
|
||||
For simplicity, it is recommended that you create these structures outside of the
|
||||
Yocto Project files' Git repository.</para>
|
||||
<para>As an example, the following transcript shows how to create the bare clone
|
||||
of the <filename>linux-yocto-3.0</filename> kernel and then create a copy of
|
||||
that clone.
|
||||
<note>When you have a local Linux Yocto kernel Git repository, you can
|
||||
reference that repository rather than the upstream Git repository as
|
||||
part of the <filename>clone</filename> command.
|
||||
Doing so can speed up the process.</note></para>
|
||||
<para>In the following example, the bare clone is named
|
||||
<filename>linux-yocto-3.0.git</filename>, while the
|
||||
copy is named <filename>linux-yocto-3.0</filename>:
|
||||
<literallayout class='monospaced'>
|
||||
$ git clone --bare git://git.yoctoproject.org/linux-yocto-3.0 linux-yocto-3.0.git
|
||||
Initialized empty Git repository in /home/scottrif/linux-yocto-3.0.git/
|
||||
remote: Counting objects: 2123870, done.
|
||||
remote: Compressing objects: 100% (341338/341338), done.
|
||||
remote: Total 2123870 (delta 1778780), reused 2107534 (delta 1762583)
|
||||
Receiving objects: 100% (2123870/2123870), 445.72 MiB | 2.06 MiB/s, done.
|
||||
Resolving deltas: 100% (1778780/1778780), done. </literallayout></para>
|
||||
<para>Now create a clone of the bare clone just created:
|
||||
<literallayout class='monospaced'>
|
||||
$ git clone linux-yocto-3.0.git linux-yocto-3.0
|
||||
Initialized empty Git repository in /home/scottrif/linux-yocto-3.0/.git/
|
||||
Checking out files: 100% (36898/36898), done. </literallayout></para></listitem>
|
||||
<listitem id='poky-extras-repo'><para><emphasis>
|
||||
The <filename>poky-extras</filename> Git Repository</emphasis>:
|
||||
The <filename>poky-extras</filename> Git repository contains metadata needed
|
||||
only if you are modifying and building the kernel image.
|
||||
In particular, it contains the kernel <filename>.bbappend</filename> files that you
|
||||
edit to point to your locally modified kernel source files and to build the kernel
|
||||
image.
|
||||
Pointing to these local files is much more efficient than requiring a download of the
|
||||
source files from upstream each time you make changes to the kernel.</para>
|
||||
<para>It is good practice to create this Git repository inside the Yocto Project
|
||||
files Git repository.
|
||||
Following is an example that creates the <filename>poky-extras</filename> Git
|
||||
repository inside the Yocto Project files Git repository, which is named
|
||||
<filename>poky</filename> in this case:
|
||||
<literallayout class='monospaced'>
|
||||
$ cd ~/poky
|
||||
$ git clone git://git.yoctoproject.org/poky-extras poky-extras
|
||||
Initialized empty Git repository in /home/scottrif/poky/poky-extras/.git/
|
||||
remote: Counting objects: 543, done.
|
||||
remote: Compressing objects: 100% (483/483), done.
|
||||
remote: Total 543 (delta 144), reused 307 (delta 39)
|
||||
Receiving objects: 100% (543/543), 520.55 KiB, done.
|
||||
Resolving deltas: 100% (144/144), done. </literallayout></para></listitem>
|
||||
<listitem><para><emphasis>Supported Board Support Packages (BSPs):</emphasis>
|
||||
Similar considerations exist for BSPs.
|
||||
You can get set up for BSP development one of two ways: tarball extraction or
|
||||
with a local Git repository.
|
||||
Regardless of the method you use, the Yocto Project uses the following BSP layer
|
||||
naming scheme:
|
||||
<literallayout class='monospaced'>
|
||||
meta-<BSP_name>
|
||||
</literallayout>
|
||||
where <BSP_name> is the recognized BSP name.
|
||||
Here are some examples:
|
||||
<literallayout class='monospaced'>
|
||||
meta-crownbay
|
||||
meta-emenlow
|
||||
meta-n450
|
||||
</literallayout>
|
||||
<itemizedlist>
|
||||
<listitem><para><emphasis>Tarball Extraction:</emphasis> You can download any released
|
||||
BSP tarball from the same
|
||||
<ulink url='http://yoctoproject.org/download'>download site</ulink> used
|
||||
to get the Yocto Project release.
|
||||
Once you have the tarball, just extract it into a directory of your choice.
|
||||
Again, this method just produces a snapshot of the BSP layer in the form
|
||||
of a hierarchical directory structure.</para></listitem>
|
||||
<listitem><para><emphasis>Git Repository Method:</emphasis> If you are working
|
||||
with a Yocto Project files Git repository, you should also set up a
|
||||
<filename>meta-intel</filename> Git repository.
|
||||
Typically, you set up the <filename>meta-intel</filename> Git repository inside
|
||||
the Yocto Project files Git repository.</para>
|
||||
<para>For example, the following transcript shows the steps to clone the
|
||||
<filename>meta-intel</filename>
|
||||
Git repository inside the <filename>poky</filename> Git repository.
|
||||
<literallayout class='monospaced'>
|
||||
$ cd poky
|
||||
$ git clone git://git.yoctoproject.org/meta-intel.git
|
||||
Initialized empty Git repository in /home/scottrif/poky/meta-intel/.git/
|
||||
remote: Counting objects: 1325, done.
|
||||
remote: Compressing objects: 100% (1078/1078), done.
|
||||
remote: Total 1325 (delta 546), reused 85 (delta 27)
|
||||
Receiving objects: 100% (1325/1325), 1.56 MiB | 330 KiB/s, done.
|
||||
Resolving deltas: 100% (546/546), done.
|
||||
</literallayout></para>
|
||||
<para>The same
|
||||
<ulink url='https://wiki.yoctoproject.org/wiki/Transcript:_from_git_checkout_to_meta-intel_BSP'>
|
||||
wiki page</ulink> referenced earlier covers how to
|
||||
set up the <filename>meta-intel</filename> Git repository.</para></listitem>
|
||||
</itemizedlist></para></listitem>
|
||||
<listitem><para><emphasis>Eclipse Yocto Plug-in:</emphasis> If you are developing
|
||||
applications using the Eclipse Integrated Development Environment (IDE),
|
||||
you will need this plug-in.
|
||||
See the
|
||||
"<ulink url='http://www.yoctoproject.org/docs/latest/adt-manual/adt-manual.html#setting-up-the-eclipse-ide'>Setting up the Eclipse IDE</ulink>"
|
||||
section in the Yocto Application Development Toolkit (ADT)
|
||||
User’s Guide for more information.</para></listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id='building-images'>
|
||||
<title>Building Images</title>
|
||||
|
||||
<para>
|
||||
The build process creates an entire Linux distribution, including the toolchain, from source.
|
||||
For more information on this topic, see the
|
||||
"<ulink url='http://www.yoctoproject.org/docs/latest/yocto-project-qs/yocto-project-qs.html#building-image'>Building an Image</ulink>"
|
||||
section in the Yocto Project Quick Start.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The build process is as follows:
|
||||
<orderedlist>
|
||||
<listitem><para>Make sure you have the Yocto Project files as described in the
|
||||
previous section.</para></listitem>
|
||||
<listitem><para>Initialize the build environment by sourcing a build environment
|
||||
script.</para></listitem>
|
||||
<listitem><para>Optionally ensure the <filename>conf/local.conf</filename> configuration file is set
|
||||
up how you want it.
|
||||
This file defines the target machine architecture and other build options.</para></listitem>
|
||||
<listitem><para>Build the image using the <command>bitbake</command> command.
|
||||
If you want information on BitBake, see the user manual at
|
||||
<ulink url='http://docs.openembedded.org/bitbake/html'></ulink>.</para></listitem>
|
||||
<listitem><para>Run the image either on the actual hardware or using the QEMU
|
||||
emulator.</para></listitem>
|
||||
</orderedlist>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id='using-pre-built-binaries-and-qemu'>
|
||||
<title>Using Pre-Built Binaries and QEMU</title>
|
||||
|
||||
<para>
|
||||
Another option you have to get started is to use pre-built binaries.
|
||||
This scenario is ideal for developing software applications to run on your target hardware.
|
||||
To do this, you need to install the stand-alone Yocto Project cross-toolchain tarball and
|
||||
then download the pre-built kernel that you will boot in the QEMU emulator.
|
||||
Next, you must download and extract the target root filesystem for your target
|
||||
machine’s architecture.
|
||||
Finally, you set up the environment to emulate the hardware and then start the QEMU emulator.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
You can find details on all these steps in the
|
||||
"<ulink url='http://www.yoctoproject.org/docs/latest/yocto-project-qs/yocto-project-qs.html#using-pre-built'>Using Pre-Built Binaries and QEMU</ulink>"
|
||||
section of the Yocto Project Quick Start.
|
||||
</para>
|
||||
</section>
|
||||
</chapter>
|
||||
<!--
|
||||
vim: expandtab tw=80 ts=4
|
||||
-->
|
||||
@@ -1,78 +0,0 @@
|
||||
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
|
||||
|
||||
<book id='dev-manual' lang='en'
|
||||
xmlns:xi="http://www.w3.org/2003/XInclude"
|
||||
xmlns="http://docbook.org/ns/docbook"
|
||||
>
|
||||
<bookinfo>
|
||||
|
||||
<mediaobject>
|
||||
<imageobject>
|
||||
<imagedata fileref='figures/dev-title.png'
|
||||
format='SVG'
|
||||
align='left' scalefit='1' width='100%'/>
|
||||
</imageobject>
|
||||
</mediaobject>
|
||||
|
||||
<title></title>
|
||||
|
||||
<authorgroup>
|
||||
<author>
|
||||
<firstname>Scott</firstname> <surname>Rifenbark</surname>
|
||||
<affiliation>
|
||||
<orgname>Intel Corporation</orgname>
|
||||
</affiliation>
|
||||
<email>scott.m.rifenbark@intel.com</email>
|
||||
</author>
|
||||
</authorgroup>
|
||||
|
||||
<revhistory>
|
||||
<revision>
|
||||
<revnumber>1.1</revnumber>
|
||||
<date>6 October 2011</date>
|
||||
<revremark>The initial document released with the Yocto Project 1.1 Release.</revremark>
|
||||
</revision>
|
||||
</revhistory>
|
||||
|
||||
<copyright>
|
||||
<year>2010-2011</year>
|
||||
<holder>Linux Foundation</holder>
|
||||
</copyright>
|
||||
|
||||
<legalnotice>
|
||||
<para>
|
||||
Permission is granted to copy, distribute and/or modify this document under
|
||||
the terms of the <ulink type="http" url="http://creativecommons.org/licenses/by-sa/2.0/uk/">
|
||||
Creative Commons Attribution-Share Alike 2.0 UK: England & Wales</ulink> as published by
|
||||
Creative Commons.
|
||||
</para>
|
||||
|
||||
<note>
|
||||
Due to production processes, there could be differences between the Yocto Project
|
||||
documentation bundled in the release tarball and
|
||||
<ulink url='http://www.yoctoproject.org/docs/latest/dev-manual/dev-manual.html'>
|
||||
The Yocto Project Development Manual</ulink> on
|
||||
the <ulink url='http://www.yoctoproject.org'>Yocto Project</ulink> website.
|
||||
For the latest version of this manual, see the manual on the website.
|
||||
</note>
|
||||
</legalnotice>
|
||||
|
||||
</bookinfo>
|
||||
|
||||
<xi:include href="dev-manual-intro.xml"/>
|
||||
|
||||
<xi:include href="dev-manual-start.xml"/>
|
||||
|
||||
<xi:include href="dev-manual-newbie.xml"/>
|
||||
|
||||
<xi:include href="dev-manual-model.xml"/>
|
||||
|
||||
<xi:include href="dev-manual-bsp-appendix.xml"/>
|
||||
|
||||
<xi:include href="dev-manual-kernel-appendix.xml"/>
|
||||
|
||||
</book>
|
||||
<!--
|
||||
vim: expandtab tw=80 ts=4
|
||||
-->
|
||||
|
Before Width: | Height: | Size: 51 KiB |
|
Before Width: | Height: | Size: 56 KiB |
|
Before Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 26 KiB |
|
Before Width: | Height: | Size: 96 KiB |
|
Before Width: | Height: | Size: 60 KiB |
|
Before Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 35 KiB |
|
Before Width: | Height: | Size: 33 KiB |
|
Before Width: | Height: | Size: 28 KiB |
|
Before Width: | Height: | Size: 185 KiB |