你的浏览器版本过低,可能导致网站不能正常访问!
为了你能正常使用网站功能,请使用这些浏览器。

STM32MP1 Distribution Package一些总结

[复制链接]
STMCU小助手 发布时间:2022-10-3 22:00
1.必须的依赖包/ D+ v& Y0 a% k2 U" P  g
( @2 C" Q, W# T
  1. PC gt; sudo apt-get update- u  A2 K0 {3 {$ a
  2. PC gt; sudo apt-get install bison flex sed wget curl cvs subversion git-core coreutils unzip texi2html 1 m% ]6 X' q; r
  3. texinfo docbook-utils gawk python-pysqlite2 diffstat help2man make gcc build-essential g++ desktop-file-utils chrpath libxml2-utils xmlto docbook 0 y  Z- @( G. Z! ]. z
  4. bsdmainutils iputils-ping cpio python-wand python-pycryptopp python-crypto$ T+ |* i: A( ]3 l$ R& O; q* w% \
  5. PC gt; sudo apt-get install libsdl1.2-dev xterm corkscrew nfs-common nfs-kernel-server device-tree-compiler mercurial u-boot-tools libarchive-zip-perl
    ( B7 H' N3 V' r+ d8 ^: H( U
  6. PC gt; sudo apt-get install ncurses-dev bc linux-headers-generic gcc-multilib libncurses5-dev libncursesw5-dev lrzsz dos2unix lib32ncurses5 repo libssl-dev
复制代码
7 X7 c- v- l4 O- ^/ v8 v3 B" ], M, E
2.repo 获取源码
! P! t5 O8 m. \! a1 g5 D
$ T1 C7 I3 F* q' V; O6 o8 t#repo init -u -b refs/tags/openstlinux-5.4-dunfell-mp1-20-06-24# ?9 D  D- N/ m$ N$ G7 p9 A0 ]
8 c& ?, F) N" Z+ a
  1. repo init -u  -b refs/tags/openstlinux-20-02-19
复制代码

! c% ^# T3 }( J' h4 t* `+ Wfatal: Cannot get
$ g# j5 k4 y" B1 ~; R: P* J4 qfatal: error [Errno 101] Network is unreachable; g) c4 I# d: K' r
解决方法:先单独克隆repo# w: w/ {% K9 d$ h8 E; _
: L' e# |. N4 O& j$ v7 n
  1. git clone
    8 X5 n, e" v0 j: `% G
  2. mkdir .repo
    . x& [9 X% F" Q; T* I" p( J
  3. mv git-repo/ repo$ \) ~$ C0 a: P" w$ E* k1 t
  4. mv repo .repo
    + w* K4 v$ `, P
  5. repo sync -c -j8
复制代码
9 r7 w+ v  D% P; T  P; ~
单独更新+ d  l& o) J5 z4 E% t
) N4 Q2 C3 U  {  S6 |( i
  1. repo sync --force-sync layers/meta-openembedded/
    9 q( K# e3 s4 O) N8 F2 t- @
  2. repo sync --force-sync layers/meta-openembedded/+ e- c: v* f, V% |
  3. repo sync --force-sync layers/meta-st/meta-st-openstlinux/, P) p  H" U' X
  4. repo sync --force-sync layers/openembedded-core/% r( a8 c& H1 Q
  5. repo sync --force-sync layers/openembedded-core/bitbake/1 W- u3 ^1 f8 F7 a3 R
  6. repo sync
复制代码
  G$ ], R  E- Y0 X
源码获取完成,编译Distribution Package。( f3 N7 |, W' m: e( g3 b0 P# ~7 v
  1. PC gt; DISTRO=openstlinux-weston MACHINE=stm32mp1 source layers/meta-st/scripts/envsetup.sh- T1 s  S: N5 r0 u" ~
  2. PC gt; bitbake st-image-wseton    //编译镜像PC gt; bitbake st-image-weston  -c fetchall  //编译镜像
复制代码

. y% }/ {+ k+ C4.bitbake常用的一些命令9 n& q( m- _' o, j* r
& s) Q9 S# e7 Z  O! E
  1. bitbake st-image-wseton -f //忽略某个包的错误,执行下去。可以减少编译等待时间。
    " T, s  v" O* @7 l7 ^
  2. bitbake st-image-wseton -c fetchall  //-C用于执行特定命令,这里fetchall.
    7 D7 u4 ^) J  P+ d
  3. bitbake -e linux-imx | grep ^SRC_URI=  //软件包下载地址* A1 A) L1 F( g6 ]: ^! A: Z& i
  4. bitbake -s | grep linux      //查找所有包并显示包含有linux名字的包
    ' Z: m7 e" v% U) X
  5. bitbake -e linux-imx  | grep ^S=    //编译目录
    ) B- v9 {7 p7 B% ]$ X7 L  s& y  S
  6. bitbake linux-imx -C compile   //编译内核和dtb,-C的C是大写
    & r% U6 Y- K3 X/ S9 D9 Z+ C
  7. bitbake opencv -c fetch% s7 Q9 m8 G; f
  8. bitbake opencv -c clean3 m; W1 X! [. ]' p$ \2 q" j0 P

  9. * Z% ^, A. W/ N$ W2 o
  10. bitbake -k core-image-minimal
    ! O6 t) d6 h3 i2 p4 T& D3 A
  11. bitbake xx-image -c listtasks
    # J6 q, x/ E# I4 l
  12. bitbake -s | grep packagename6 N3 _  i3 K  v# F) |
  13. bitbake -e xxx-image | grep ^SRC_URI=3 t- K+ o6 i) w
  14. 查看软件依赖% G3 V: n. k( w
  15. bitbake -g  packagename
复制代码
  1. bitbake -c clean -v u-boot' y' E  \; }! L! |1 |1 t0 w6 u
  2. bitbake -c cleanall     xx-image            #清除所有编译中间
    ) q; m- c1 ?/ X! h5 ~  R
  3. bitbake -c cleansstate   xx-image            #清除编译         
    1 g+ D; u# j# z0 L/ B
  4. 生成编译中的配置文件和类文件
    + ~$ Q  A4 z+ @2 Y3 T
  5. bitbake -e > mybuild.log
    1 d5 A  E2 d5 _3 m" x, N. Z
  6. ! z2 }5 {  z0 |* ~3 N& @
  7. bitbake -b 加上.bb文件的路径,即可以直接执行这个.bb文件7 q8 C0 B- {2 u+ `% e/ q, R7 Z4 t1 @# s
  8. #查找包的原路径' }% h: w; b6 f! J
  9. bitbake -e linux-stm32mp | grep ^SRC_URI=) _' c1 r1 E- H/ a  M
  10. #查找包的bblayer
    * ?, }" m; z/ m! S! V6 z! M+ D
  11. bitbake -e linux-stm32mp | grep ^S
复制代码
/ E) H& I& b& @
5.bitbake 命令续
& w% n, J# C9 d
  1. bitbake -e linux-stm32mp | grep ^S=
    4 Q3 s' p# Z; O, i2 j& D
  2. S="/home/fdw/32mp1/openstlinux-200219/build-openstlinuxweston-stm32mp1/tmp-glibc/work/stm32mp1-ostl-linux-gnueabi/linux-stm32mp/4.19-r0/linux-4.19.94"
    . a4 X' R' e5 h+ d
  3. bitbake -e m4projects-stm32mp1 | grep ^S=
    : T( u- Y% `% h8 S
  4. S="/home/fdw/32mp1/openstlinux-200219/build-openstlinuxweston-stm32mp1/tmp-glibc/work/stm32mp1-ostl-linux-gnueabi/m4projects-stm32mp1/1.2.0-r0/git1 s% x8 [/ k; e2 f: G2 p0 T& F7 ^
  5. $ i* U; Z# M  A+ _. Q1 `$ B
  6. bitbake -s | grep opencv% X* C4 ~/ n8 k7 w2 {
  7. PC gt;  find . -type f -iname "opencv*.bb"2 }2 A1 P- G  n
  8. ./layers/meta-openembedded/meta-oe/recipes-support/opencv/opencv_3.4.3.bb
复制代码

) g; X" g; p, |5 _+ ]4 @6.linux 内核实例
1 }8 z1 J: @. e6 V6 @
  1. PC gt; devtool modify virtual/kernel
    ; [7 k5 f/ {, j3 U$ Y6 b
  2. PC gt; ls workspace/sources/linux-stm32mp/6 G+ ]6 x) @$ E

  3. : _1 z/ v% T. x+ Q
  4. Board gt; dmesg | grep -i cma" Y( d! k" p: ], ~7 v$ P, P
  5. PC gt;grep -i CONFIG_CMA_SIZE_MBYTES ./workspace/sources/linux-stm32mp/ -nr
    0 I4 L% |4 O. p$ t. y/ @# z
  6. 8 x* R+ W/ w' b# l/ j. H6 S
  7. PC gt; bitbake virtual/kernel -c menuconfig 3 p4 B+ g& |) U7 F8 y+ w+ |
  8. PC gt; bitbake virtual/kernel -C compile- V' c3 \5 A7 \0 b5 y% R

  9. 3 y3 R  B3 _6 o7 R: }/ v6 v& [8 C2 F
  10. $ bitbake -c menuconfig virtual/kernel
    ( a, `: W  E  F- Y
  11. $ bitbake -c compile -f -v virtual/kernel 单独编译内核1 f  L2 R6 W- }
  12. $ bitbake -c compile_kernelmodules -f -v virtual/kernel 单独编译模块, k) n. z, _5 G0 W
  13. $ bitbake -c deploy -f -v virtual/kernel  然后部署编译输出镜像
复制代码
  1. #devtool build because the build makes compile,
    0 S* c# F2 B5 T8 d" b4 H
  2. #compile_kernemodules and install commands# K/ z1 x5 M" Z. }9 i
  3. Board gt; mount /dev/mmcblk0p4 /boot
    4 l3 W; a+ _- @! J6 t
  4. PC gt; scp <build dir>/../../*.dtb root@<board ip address>:/boot
    3 |# b/ T/ B$ ~  @& P
  5. Board gt; cd /boot; sync; systemctl reboot
    . H0 O$ g% A3 q. I$ `
  6. ! X* @% ~" f: b- z1 b- o0 O' K. k
  7. vim workspace/sources/linux-stm32mp/arch/arm/boot/dts/stm32mp157a-dk1.dts
    , h! w% ]/ `  F0 M6 c4 _% G
  8. bitbake virtual/kernel -C compile
复制代码
  1. PC gt; vim workspace/sources/linux-stm32mp/drivers/media/platform/vivid/vivid-core.c 9 z1 j6 C' p8 A. f) }# s* A5 J5 o
  2. PC gt; bitbake virtual/kernel -C compile' S) S) ?4 O" T. n. ]: T& C
  3. #Update the vivid kernel module on the board& f/ K% u  a. @1 q
  4. PC gt; devtool deploy-target -Ss linux-stm32mp  :/, i; }- J- f/ i
  5. Board gt; /sbin/depmod -a
    ' s0 j* A% Z4 `8 B& ^
  6. Board gt; sync: Q' ]" h2 X+ j* l
  7. Board gt; modprobe vivid     
复制代码
  1. scp tmp-glibc/deploy/images/stm32mp1/stm32mp157*.dtb :/boot3 k4 t2 @: x, Q" E
  2. scp tmp-glibc/deploy/images/stm32mp1/uImage*:/boot1 w% v' D" I* c* X' u# ]: N: H
  3. rm -rf /home/fdw/.ssh/known_hosts
复制代码
: I  ?, y+ t& I
6.uboot实例  x! x" u- M% M1 k
  1. PC gt; devtool search u-boot*$ I! M. W6 W$ {8 V
  2. PC gt; devtool modify u-boot-stm32mp
    1 r& l* j& u4 m7 O
  3. #cd <build dir>/workspace/sources/u-boot-stm32mp
    & O) h$ g& j& {, O+ w
  4. PC gt; devtool build u-boot-stm32mp- U0 K% V3 x; B3 ?
  5. PC gt; bitbake u-boot-stm32mp -c deploy
    6 T5 Q# z* C6 u8 p* A; H
  6. #ums 0 mmc 0
    2 i% c" N* x8 k
  7. PC gt; dd if=u-boot-<board name>-trusted.stm32 of=/dev/sdc3 bs=1M conv=fdatasync
复制代码

# A5 W3 Q8 X5 j3 f7.tf-A实例3 a) ?3 M$ [+ k4 ]' C+ _
  1. PC gt; devtool search tf-a*
    3 ]) s2 h: `) V
  2. PC gt; devtool modify tf-a-stm32mp
    1 M! m& s( H$ F+ u8 U
  3. #PC gt; cd <build dir>/workspace/sources/tf-a-stm32mp' h2 p6 F* E8 i! o, i, K8 V8 U. V& r
  4. PC gt; vim ./plat/st/stm32mp1/bl2_io_storage.c , p% U; C  h* V% S
  5. PC gt; devtool build tf-a-stm32mp# f1 A' j, v8 ]( e; Y  L+ m
  6. #bitbake tf-a-stm32mp( W% f5 s, Y+ d: `$ Q0 f) z
  7. PC gt; bitbake tf-a-stm32mp -c deploy
    , J/ P! b7 b3 u5 C$ V8 G# w8 D4 D
  8. PC gt; dd if=tf-a-<board name>-trusted.stm32 of=/dev/sdc1 bs=1M conv=fdatasync
复制代码
# E, a% {/ ]  v
8.应用程序 “hello world”
) j1 I, J6 X4 J0 D/ n3 P; C6 W' z- `( ^0 t, Z  A
  1. PC gt; mkdir hello_world_example
    # t6 E9 e$ ^  L1 y6 ?
  2. PC gt; cd hello_world_example" M! M/ k7 A, h5 r8 x: E0 v( ^" [
  3. PC gt; vim hello_world_example.c) V$ ^$ j! j8 U- B( z3 ]
  4. PC gt; cd <build dir>
    7 ^) ?) J! E9 X2 c
  5. #Add a new recipe to the workspace
      O# k/ }: a1 L1 K$ `+ H
  6. PC gt; devtool add myhelloworld hello_world_example/
    - d7 W/ u% h- r
  7. #Adapt recipe
    ; q& Z* _/ o! U- e
  8. PC gt; devtool edit-recipe myhelloworld
    * j; W" H2 P( _& f, I
  9. PC gt; devtool build myhelloworld
    & p% q- O1 g5 Z0 F1 e
  10. PC gt; devtool deploy-target -s myhelloworld
复制代码
' t" t. g) n3 j7 @$ ~
9.m4projects-stm32
7 \8 C$ N5 d" ]. \
  1. Board gt; cd <path_to_your_workspace>/build-<name_of_distro>
    " F3 \: S# D/ [9 q2 z& d
  2. 3 ]. H6 B* `- W& O3 u
  3. Clean the m4projects build folder: V- f; j2 E2 }5 T4 w  G& W
  4. Board gt; bitbake m4projects-stm32mp1 -f -c cleanall $ H4 d) D1 x  g$ ?1 d, N% s

  5. 4 r, |5 n( p% b- B/ x
  6. Rebuild the recipe m4projects1 g" y  R( }8 r2 m
  7. Board gt; bitbake m4projects-stm32mp1 6 l9 i$ q+ l& X% |/ k
  8. 9 B5 \8 g# F! w+ x9 U* N" G6 b
  9. Rebuild the image
    / V! |# V# R4 ?( Y1 Y; |$ s: C; A
  10. Board gt; bitbake st-image-weston
复制代码

$ ?9 Y1 F4 }& o' B/ K: _! F8 g( D二.devtool的总结
6 S# Z2 P. y5 Z) f
9 v. y+ n2 W7 J9 F7 i( ?
  1. devtool modify tf-a-stm32mp % S% Y8 [8 G) z9 _1 |, Z9 M
  2. bitbake tf-a-stm32mp, e8 e, z- L" E1 P% W3 ]/ Z5 G

  3. ; E4 I, Q3 X) c; |
  4. devtool search u-boot*
    - L2 b* f' A9 Q; u
  5. devtool modify u-boot-stm32mp
    7 l) {; p' |6 s2 d( N. J
  6. bitbake u-boot-stm32mp
    4 y2 j3 r6 _- d" z* |

  7. : [; @1 ^! [" ~4 Z+ I" D
  8. devtool modify linux-stm32mp. R5 l( L7 D" ]6 K6 H
  9. bitbake linux-stm32mp
复制代码
  1. NOTE: Starting bitbake server...
      x) b0 w3 m" W! U2 e9 U
  2. usage: devtool [--basepath BASEPATH] [--bbpath BBPATH] [-d] [-q]
    ) z6 h0 {8 ?& K! L+ f* @; l0 D
  3.                [--color COLOR] [-h]
    ; m: D' d" i- `' u3 c: S
  4.                <subcommand> ...
    " K8 M% p( k; C  T6 s

  5. : Z% b: c* K/ ]  E3 Z
  6. OpenEmbedded development tool
    * d2 _; b, B3 T/ g
  7. ! Y: H) s7 w' |& v+ o
  8. options:
    9 W+ v; b6 C% X
  9.   --basepath BASEPATH  Base directory of SDK / build directory
    6 c- t% x2 a! A3 Q( b
  10.   --bbpath BBPATH      Explicitly specify the BBPATH, rather than getting it
    ( l5 [2 E4 y( H" l
  11.                        from the metadata
    % ^0 c3 V. T5 h+ C! x/ s" d
  12.   -d, --debug          Enable debug output
      h+ T8 t5 N1 v/ |; \
  13.   -q, --quiet          Print only errors' I+ @; l& Q; }( C8 B; S, l
  14.   --color COLOR        Colorize output (where COLOR is auto, always, never); s1 H! S- {& G
  15.   -h, --help           show this help message and exit0 F$ n! U, K  {# T" B) f9 p9 p# x

  16. + h% ^% o$ h; Y, l& q3 m
  17. subcommands:0 S( y, ~  A! a
  18.   Beginning work on a recipe:
    % {5 t  m* L# n5 C
  19.     add                  Add a new recipe
    % U, s  V: k' z
  20.     modify               Modify the source for an existing recipe
    : i: d0 B, N8 G5 r( S# _6 }
  21.     upgrade              Upgrade an existing recipe( U+ m! U# {9 \  ]! v4 q3 c& d8 V/ S
  22.   Getting information:
    - H3 |! N( D/ W  X# _' N3 Z( ~
  23.     status               Show workspace status4 L8 J# Q- _/ I  Y5 d# r  a
  24.     search               Search available recipes6 J( n# P6 O1 p" V& I
  25.   Working on a recipe in the workspace:/ E' |: s& {3 s  }8 I
  26.     build                Build a recipe
    ! h, f, ~& C/ t1 u% Z* W9 s& b; ?
  27.     rename               Rename a recipe file in the workspace. K8 w" i" P2 P4 w. g* C/ n4 s* |
  28.     edit-recipe          Edit a recipe file in your workspace
    # o$ Y+ J! d/ T* @6 E/ y
  29.     find-recipe          Find a recipe file in your workspace1 U4 D$ d' x6 L1 E+ o
  30.     configure-help       Get help on configure script options! o) Q  f0 i% k- E) j
  31.     update-recipe        Apply changes from external source tree to recipe, `- ~$ i# s& w' s9 w
  32.     reset                Remove a recipe from your workspace
    - f5 Z) D. o6 ~/ @
  33.     finish               Finish working on a recipe in your workspace& z8 s8 V; @5 a1 H
  34.   Testing changes on target:9 ]! W' e6 N4 i) D% X( S; c
  35.     deploy-target        Deploy recipe output files to live target machine% x* L- e  ?0 o. J
  36.     undeploy-target      Undeploy recipe output files in live target machine* e# E( D5 w9 L! B, I" Q2 `
  37.     build-image          Build image including workspace recipe packages
    , a+ h2 K# {, Z# d
  38.   Advanced:
    % z+ T% n/ M! x( S
  39.     create-workspace     Set up workspace in an alternative location: i( u0 N; S9 L4 m  F- o
  40.     import               Import exported tar archive into workspace1 a( j/ N/ G- M
  41.     extract              Extract the source for an existing recipe/ x' H- X% v) [6 B1 v$ J
  42.     sync                 Synchronize the source tree for an existing recipe
    ) _' K, a0 i5 y3 G
  43.     export               Export workspace into a tar archive
    + a; f, x3 V; Q& ]6 @4 g
  44. Use devtool <subcommand> --help to get help on a specific command
复制代码

; S0 W/ v. g$ i& _2 ^$ a* e5 Y' y
6 R% [  n& I0 E7 I5 r————————————————
5 f* a( \  }& J& s9 S7 |版权声明:jacob杰克爸4 \* Z# v) v/ s9 n) W( a# o

) _* R( Z2 X2 e- ?, _
赞 收藏 评论0 发布时间:2022-10-3 22:00

举报

0个回答

所属标签

相似技术帖

官网相关资源

关于
我们是谁
投资者关系
意法半导体可持续发展举措
创新与技术
意法半导体官网
联系我们
联系ST分支机构
寻找销售人员和分销渠道
社区
媒体中心
活动与培训
隐私策略
隐私策略
Cookies管理
行使您的权利
官方最新发布
人形机器人运动控制、感知与智能配电
半导体创新技术与应用方向
EE架构与软件定义汽车
12V/48V 汽车智能配电(SPD)
区域控制单元(ZCU)与分区架构
关注我们
st-img 微信公众号
st-img 手机版