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

STM32MP1 Distribution Package一些总结

[复制链接]
STMCU小助手 发布时间:2022-10-3 22:00
1.必须的依赖包* r* m. G2 I8 k% b# Q7 A8 N2 ^
4 [3 D& c5 m. M8 _" I3 J
  1. PC gt; sudo apt-get update
    0 k9 H/ J( d3 L+ b
  2. PC gt; sudo apt-get install bison flex sed wget curl cvs subversion git-core coreutils unzip texi2html
    4 Z3 y2 c6 J' L' p$ L' `% d
  3. texinfo docbook-utils gawk python-pysqlite2 diffstat help2man make gcc build-essential g++ desktop-file-utils chrpath libxml2-utils xmlto docbook
    1 f' Z& F% B, k/ S) w$ |. _0 o
  4. bsdmainutils iputils-ping cpio python-wand python-pycryptopp python-crypto) W) c. c3 |+ u8 J% b% y
  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
    4 q6 r- M- _( n, [
  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
复制代码
) f, S- _% r) F2 g/ R
2.repo 获取源码+ q# _: j2 z: _! j/ N% A4 D9 [$ I
( B3 ]7 i4 M& a, Y$ w
#repo init -u -b refs/tags/openstlinux-5.4-dunfell-mp1-20-06-241 ]7 `4 e  V. \8 B0 c

8 Q7 `3 z7 ], v$ G( \- @
  1. repo init -u  -b refs/tags/openstlinux-20-02-19
复制代码
6 H+ I7 Z* z: E4 N+ k8 ~
fatal: Cannot get % m* M: v" q. B! x3 Z
fatal: error [Errno 101] Network is unreachable
) n( T  s1 G7 T5 ?' R解决方法:先单独克隆repo
" H9 ^2 |. e/ ]8 {5 C4 W9 v9 i  }  v& w- i+ b
  1. git clone
    1 s4 o! g- v8 T, t5 s: A  V( |
  2. mkdir .repo
    & J( R4 c5 T  ~( E* Q5 c! F
  3. mv git-repo/ repo1 C% }& C& p* W& `
  4. mv repo .repo
    1 A+ Z) r2 y/ K/ h, K
  5. repo sync -c -j8
复制代码

! T2 k, z- l0 H  T% {# R6 U" Z单独更新
' s2 x4 `7 d8 i% M) L
/ n' s) V1 K3 j8 g
  1. repo sync --force-sync layers/meta-openembedded/! j  {1 {6 e/ q0 n3 j" v' ^
  2. repo sync --force-sync layers/meta-openembedded/1 s6 B. ^. |, _+ d& C3 B; E# l3 W
  3. repo sync --force-sync layers/meta-st/meta-st-openstlinux/
    - c1 k) N/ i- I( R
  4. repo sync --force-sync layers/openembedded-core/. g. ?" W" ]7 w5 n& T- A. D  M
  5. repo sync --force-sync layers/openembedded-core/bitbake/+ k& f' Y1 X0 k' r/ u
  6. repo sync
复制代码
" f- j( t, @' c) g7 i. V3 i/ o
源码获取完成,编译Distribution Package。( t: H, ^) ?( N3 F# H
  1. PC gt; DISTRO=openstlinux-weston MACHINE=stm32mp1 source layers/meta-st/scripts/envsetup.sh
    ! ~/ m# \/ x6 K( b  Z: g) G, X7 l
  2. PC gt; bitbake st-image-wseton    //编译镜像PC gt; bitbake st-image-weston  -c fetchall  //编译镜像
复制代码

2 I& G9 h7 l- g! n/ M4.bitbake常用的一些命令
7 O/ t! I0 [8 @" v% s9 C( h! s6 ~7 G0 n
  1. bitbake st-image-wseton -f //忽略某个包的错误,执行下去。可以减少编译等待时间。
    . M! \' w# q! {$ _" \
  2. bitbake st-image-wseton -c fetchall  //-C用于执行特定命令,这里fetchall.9 x2 P9 ^( y6 C. H! S
  3. bitbake -e linux-imx | grep ^SRC_URI=  //软件包下载地址- w* u$ l0 l+ w8 [* R6 ^
  4. bitbake -s | grep linux      //查找所有包并显示包含有linux名字的包
    ) w+ i  {4 e+ }3 b
  5. bitbake -e linux-imx  | grep ^S=    //编译目录9 a# C% R  ^: A2 ~2 }- o
  6. bitbake linux-imx -C compile   //编译内核和dtb,-C的C是大写- q5 k& o9 V$ [' G3 w; l, G8 ^' A5 r
  7. bitbake opencv -c fetch0 B  o. z8 A& k+ M# i+ }
  8. bitbake opencv -c clean3 R- t1 a' d. |
  9. 8 l% E9 e" j- b/ s3 n9 ^6 T8 P
  10. bitbake -k core-image-minimal9 v! W6 J* D1 l& Z5 _
  11. bitbake xx-image -c listtasks
    0 H7 s/ S0 ]! W3 A* y; ~+ M* i; |
  12. bitbake -s | grep packagename
      U/ y/ s% }0 ]  ~9 d
  13. bitbake -e xxx-image | grep ^SRC_URI=
    ! w2 w) X. b: N" ~
  14. 查看软件依赖
    / o' y3 D" p4 @8 L! Q+ K
  15. bitbake -g  packagename
复制代码
  1. bitbake -c clean -v u-boot
    5 P7 d5 h  o: T1 \3 P; H/ k
  2. bitbake -c cleanall     xx-image            #清除所有编译中间8 X/ M$ f8 \1 p5 p7 a8 B/ b# Y
  3. bitbake -c cleansstate   xx-image            #清除编译         
    ! Z$ @- U: n5 T( N# a/ H
  4. 生成编译中的配置文件和类文件5 A* p* O. }* \8 {$ p% r. s1 p2 G
  5. bitbake -e > mybuild.log9 i; x. x5 b1 a
  6. ' p# n% H) ]% u
  7. bitbake -b 加上.bb文件的路径,即可以直接执行这个.bb文件
    ! N0 B" T$ C2 e# {# B3 R. q* m
  8. #查找包的原路径
      J, m+ ^5 V4 n/ x' I$ f
  9. bitbake -e linux-stm32mp | grep ^SRC_URI=
    9 U1 y' X8 U* {7 b, V! b2 Q
  10. #查找包的bblayer! M* b, d# b" q* b# s2 c$ x/ e
  11. bitbake -e linux-stm32mp | grep ^S
复制代码

: J% `8 v( f/ C5.bitbake 命令续/ m4 x( ^6 u2 h) S
  1. bitbake -e linux-stm32mp | grep ^S=! q: A) Q% E% H3 K
  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"6 ?2 f$ u3 @9 N* P
  3. bitbake -e m4projects-stm32mp1 | grep ^S=
    $ r2 S; y' R- [
  4. S="/home/fdw/32mp1/openstlinux-200219/build-openstlinuxweston-stm32mp1/tmp-glibc/work/stm32mp1-ostl-linux-gnueabi/m4projects-stm32mp1/1.2.0-r0/git
    & g' ]; T5 j4 c% L' ~' L1 E# Y! E3 n
  5. % W+ X. A- q9 C% m
  6. bitbake -s | grep opencv
    : M% _+ F3 c# d3 v  b0 Q- q
  7. PC gt;  find . -type f -iname "opencv*.bb"
    0 _4 n& H$ z+ {& A$ w
  8. ./layers/meta-openembedded/meta-oe/recipes-support/opencv/opencv_3.4.3.bb
复制代码

$ E; e7 p7 I% n6.linux 内核实例
" b/ X2 A4 t2 J- q' l1 O
  1. PC gt; devtool modify virtual/kernel7 D8 {) B7 E; z3 F1 E
  2. PC gt; ls workspace/sources/linux-stm32mp/+ J& T- \6 B" X8 L7 h4 N- G
  3. * d4 }3 E! y) y! l! w: w) e* u( r# A
  4. Board gt; dmesg | grep -i cma
    0 j( P7 s9 @8 m' H& r1 n
  5. PC gt;grep -i CONFIG_CMA_SIZE_MBYTES ./workspace/sources/linux-stm32mp/ -nr
    $ J: a0 l& }2 j
  6. : n$ t; ~* T: e7 m0 p( o. ?/ B
  7. PC gt; bitbake virtual/kernel -c menuconfig
    2 h0 t& [; ]! M4 b0 h
  8. PC gt; bitbake virtual/kernel -C compile) q( Q- d' f, |. H; ?: P# W( u

  9. 2 Z3 o4 `1 a6 p) l9 @8 ]8 Q
  10. $ bitbake -c menuconfig virtual/kernel
    " f1 A. \; L5 ]8 g; F5 Q
  11. $ bitbake -c compile -f -v virtual/kernel 单独编译内核
    ; U2 C, Q6 U- }0 _
  12. $ bitbake -c compile_kernelmodules -f -v virtual/kernel 单独编译模块6 w  b  ]' l+ u
  13. $ bitbake -c deploy -f -v virtual/kernel  然后部署编译输出镜像
复制代码
  1. #devtool build because the build makes compile,
    3 V& A: }+ L  B. @8 A
  2. #compile_kernemodules and install commands
    & k  H" ?; t* e7 M" K9 c, Q
  3. Board gt; mount /dev/mmcblk0p4 /boot1 t% b0 U5 V# Z7 M1 _
  4. PC gt; scp <build dir>/../../*.dtb root@<board ip address>:/boot) h+ S- e; {' v- E
  5. Board gt; cd /boot; sync; systemctl reboot
    0 f3 J. G! j+ s
  6. . v$ z, ?5 t$ Q2 a4 \# q+ e3 V
  7. vim workspace/sources/linux-stm32mp/arch/arm/boot/dts/stm32mp157a-dk1.dts
    " Z4 c# F3 g/ |; c
  8. bitbake virtual/kernel -C compile
复制代码
  1. PC gt; vim workspace/sources/linux-stm32mp/drivers/media/platform/vivid/vivid-core.c , E. N3 e6 T, S. A% g
  2. PC gt; bitbake virtual/kernel -C compile
    4 x' y7 C; W$ Z5 A+ W+ c
  3. #Update the vivid kernel module on the board6 u& A' R+ r5 k
  4. PC gt; devtool deploy-target -Ss linux-stm32mp  :/: m' v5 T3 c1 a: m( g
  5. Board gt; /sbin/depmod -a
    5 G0 U! j' Q) u# v/ Z" f0 g
  6. Board gt; sync8 B0 o2 K& ^4 Q1 s$ `# U
  7. Board gt; modprobe vivid     
复制代码
  1. scp tmp-glibc/deploy/images/stm32mp1/stm32mp157*.dtb :/boot8 r& b9 g# N  B8 G0 u7 O8 Y. O+ c
  2. scp tmp-glibc/deploy/images/stm32mp1/uImage*:/boot: L. X3 N7 D! |1 [# F
  3. rm -rf /home/fdw/.ssh/known_hosts
复制代码
' A0 P7 G7 v9 U  A9 L1 {7 P
6.uboot实例
  `4 O& I( U4 ?* w0 x2 c6 y# y
  1. PC gt; devtool search u-boot*
    + i; g7 R# {* ~- C! Q2 Q
  2. PC gt; devtool modify u-boot-stm32mp
    5 S) b+ e& _( \0 ~  Z4 ~$ ^+ H% i0 [
  3. #cd <build dir>/workspace/sources/u-boot-stm32mp
    0 l4 G3 k: M8 J& p
  4. PC gt; devtool build u-boot-stm32mp4 W8 K9 U' M1 |+ e
  5. PC gt; bitbake u-boot-stm32mp -c deploy
    1 P% F1 m$ H1 d" h
  6. #ums 0 mmc 0
    5 n9 e/ _3 ~& X8 J- ~
  7. PC gt; dd if=u-boot-<board name>-trusted.stm32 of=/dev/sdc3 bs=1M conv=fdatasync
复制代码
$ p: G. _; X0 W$ m) Q2 ?& B
7.tf-A实例: J! o% O/ Y) t" K2 B# x5 ]) \
  1. PC gt; devtool search tf-a*
    % C7 Y& o# k+ Y+ M2 ^" q- d2 s7 `
  2. PC gt; devtool modify tf-a-stm32mp4 I( R! E+ [; c0 R2 H/ B
  3. #PC gt; cd <build dir>/workspace/sources/tf-a-stm32mp
    / g4 y. e1 `1 P' w/ g1 F, x5 x
  4. PC gt; vim ./plat/st/stm32mp1/bl2_io_storage.c
    / Q. Z% k( f1 L" o9 x5 \
  5. PC gt; devtool build tf-a-stm32mp
    / J+ X+ K+ z( ~, v( t
  6. #bitbake tf-a-stm32mp6 B. C, m! R% [5 ?
  7. PC gt; bitbake tf-a-stm32mp -c deploy9 M  l" S! T! L1 }
  8. PC gt; dd if=tf-a-<board name>-trusted.stm32 of=/dev/sdc1 bs=1M conv=fdatasync
复制代码

0 U# |9 |3 V  m8 b2 X- l7 a8.应用程序 “hello world”/ f4 W* m3 B, b& }" c; V+ D+ E* T( }
' ^8 L4 k6 t$ d2 o, t/ G; q
  1. PC gt; mkdir hello_world_example
    " U0 g( C; d; K
  2. PC gt; cd hello_world_example" X; {; Q6 X% P: ~, L9 y8 ~
  3. PC gt; vim hello_world_example.c
    5 o# u4 F# c7 c6 ^4 Z: c5 B5 k- r- D
  4. PC gt; cd <build dir>
    5 E0 I  O5 ^" t* `" }8 R: t
  5. #Add a new recipe to the workspace
    # J( k9 ~# _# }1 L3 X. j: O8 V
  6. PC gt; devtool add myhelloworld hello_world_example/
    * ~4 O3 a5 S* ^7 n
  7. #Adapt recipe( `: a$ x  u" O* f: R
  8. PC gt; devtool edit-recipe myhelloworld
    1 C7 O9 l1 P% X' W
  9. PC gt; devtool build myhelloworld
    " G# k8 Q* K1 S0 f( g, Z4 n: m
  10. PC gt; devtool deploy-target -s myhelloworld
复制代码
- k, j  f; }' p7 h0 m8 ]% h3 M
9.m4projects-stm323 h, j  E: i4 E# k( J, T; c
  1. Board gt; cd <path_to_your_workspace>/build-<name_of_distro>
    % @' g  R' {( p1 G1 [2 {- T' l
  2. ; \4 Y# _9 U4 q  }6 A+ y& @- {; @
  3. Clean the m4projects build folder2 B- h& R+ y0 y" Y" i8 n6 d+ z
  4. Board gt; bitbake m4projects-stm32mp1 -f -c cleanall
    / d. B. C0 H+ Z: d8 S& L8 R* u

  5. # p* h2 Q3 |3 Q6 V  Y. t" |; A
  6. Rebuild the recipe m4projects; M" D5 k: u1 \, o
  7. Board gt; bitbake m4projects-stm32mp1
    / i  C% d5 z4 i9 b8 w
  8. 9 D4 J: w! f2 D8 N' N- P) c
  9. Rebuild the image
    5 G+ q+ t: T& h2 N. C3 j
  10. Board gt; bitbake st-image-weston
复制代码

3 q1 I4 j3 d: V" M二.devtool的总结4 d! u% K; J3 @6 e" X5 ^5 w4 H

5 V8 j7 y* G. h2 W
  1. devtool modify tf-a-stm32mp
    # C9 Z) S7 G, T0 I4 K8 _
  2. bitbake tf-a-stm32mp8 |+ ]2 T  X8 y7 k; X; w' y

  3.   A! \# `* V, k
  4. devtool search u-boot*8 v( I1 e7 ]! _
  5. devtool modify u-boot-stm32mp8 c* M3 |7 _: j0 B* U2 W7 n) l
  6. bitbake u-boot-stm32mp# h$ f. o9 z/ e* J) H! K

  7. . M& B+ P. }: ?; M
  8. devtool modify linux-stm32mp
    - h4 P- h: X, D5 ?  ~
  9. bitbake linux-stm32mp
复制代码
  1. NOTE: Starting bitbake server...
      t$ K2 T% V. y6 a7 K# k
  2. usage: devtool [--basepath BASEPATH] [--bbpath BBPATH] [-d] [-q]  L& S. m. D: i& r2 L5 O, @
  3.                [--color COLOR] [-h]
    # ]; @7 w* E; u
  4.                <subcommand> ...$ s- S. y6 [" T& U
  5. & q3 E, k, T" E: k+ ?9 l; E
  6. OpenEmbedded development tool
    % ^0 ?0 v, h& r6 Z6 ~, C) M
  7. , t3 p/ `8 @/ J! F, v
  8. options:4 p: o" Y3 f6 S) ^5 J4 l+ r
  9.   --basepath BASEPATH  Base directory of SDK / build directory
    - ~7 B2 f% H* o) E% @3 o
  10.   --bbpath BBPATH      Explicitly specify the BBPATH, rather than getting it. J8 M- t" }2 m' M8 W5 A7 n- b" j
  11.                        from the metadata
    + w5 H. _& U3 b* {* W
  12.   -d, --debug          Enable debug output6 N. }) N; q' ~  Y& @: y
  13.   -q, --quiet          Print only errors
    ( X, q$ P0 O% N4 S
  14.   --color COLOR        Colorize output (where COLOR is auto, always, never)
    " D4 D4 h: H" x( Q! v* M5 O
  15.   -h, --help           show this help message and exit, d, Z2 d% ~. p, X0 |
  16. ! D  j0 F0 \9 X
  17. subcommands:
    3 L6 i0 R3 z; t, ^: v
  18.   Beginning work on a recipe:
    * x( K5 k: [3 l' a! a8 i
  19.     add                  Add a new recipe
    9 N$ O  U- f2 z' V) N! |
  20.     modify               Modify the source for an existing recipe
    4 B* a# v$ b( s
  21.     upgrade              Upgrade an existing recipe
    % e+ N, s5 [+ A7 W
  22.   Getting information:
    8 L" b; A) F/ t+ {8 A8 z0 d/ e! H! \
  23.     status               Show workspace status% [. z* d3 b3 D' d8 q* c
  24.     search               Search available recipes  V4 s4 e8 x- @3 r, ?% K2 D
  25.   Working on a recipe in the workspace:
    ) o7 Z9 M$ n% m- w, V2 A3 ]' ]
  26.     build                Build a recipe- w: z' y+ w& G% ^9 o- e, R
  27.     rename               Rename a recipe file in the workspace! c+ {3 C' |6 @* G/ B# F% S7 q
  28.     edit-recipe          Edit a recipe file in your workspace
    $ ]/ L* I7 a2 E! Z; {; a0 y
  29.     find-recipe          Find a recipe file in your workspace( ^. x( o* _# |
  30.     configure-help       Get help on configure script options. N9 s9 @6 m1 }- `
  31.     update-recipe        Apply changes from external source tree to recipe, b0 S5 P0 ?0 w3 f" `8 X5 v
  32.     reset                Remove a recipe from your workspace2 @, P4 I; W- [0 ^2 j( D
  33.     finish               Finish working on a recipe in your workspace7 |& K8 W+ T3 H9 @0 p0 C+ A( b
  34.   Testing changes on target:: `3 |  Z9 M: D+ ]6 X0 x* r3 m
  35.     deploy-target        Deploy recipe output files to live target machine
    / O* @  c4 h0 y
  36.     undeploy-target      Undeploy recipe output files in live target machine
    . [7 N& K3 Q+ h; ~
  37.     build-image          Build image including workspace recipe packages& q! D) H+ H2 a9 m) [
  38.   Advanced:
    2 N* R4 t* |2 I% q
  39.     create-workspace     Set up workspace in an alternative location9 J. T( N8 b' e! U
  40.     import               Import exported tar archive into workspace
    - O7 l; n6 I4 Q* e4 K/ e
  41.     extract              Extract the source for an existing recipe
    0 s2 x2 R6 O5 Z' {2 }
  42.     sync                 Synchronize the source tree for an existing recipe
    ( g2 a/ s" d" [2 N! Q  W
  43.     export               Export workspace into a tar archive: W& g9 r/ H/ ]/ g
  44. Use devtool <subcommand> --help to get help on a specific command
复制代码

: u: i* b6 x' P& I! G
" D# h* Y$ y3 H0 ?& U————————————————. w# Q, {1 n0 B" Z* U( P
版权声明:jacob杰克爸) Y# W" _# }2 g3 x" A& }

9 O5 ]2 ~) \! O9 _3 P
赞 收藏 评论0 发布时间:2022-10-3 22:00

举报

0个回答

所属标签

相似技术帖

官网相关资源

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