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

STM32MP1 Distribution Package一些总结

[复制链接]
STMCU小助手 发布时间:2022-10-3 22:00
1.必须的依赖包; \- m/ H+ [. o5 T, w

' Q) c8 k% x* F! w& b7 l" `2 u
  1. PC gt; sudo apt-get update7 W4 w4 u+ ?3 h' U6 m0 M
  2. PC gt; sudo apt-get install bison flex sed wget curl cvs subversion git-core coreutils unzip texi2html ) I* V- V+ N. E$ S8 r" t7 ]0 D5 z
  3. texinfo docbook-utils gawk python-pysqlite2 diffstat help2man make gcc build-essential g++ desktop-file-utils chrpath libxml2-utils xmlto docbook 2 w0 D  M  G" H
  4. bsdmainutils iputils-ping cpio python-wand python-pycryptopp python-crypto) Y$ c+ e- D0 q* O
  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( ]7 H8 b$ J+ w
  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
复制代码
2 @3 x/ Z8 G5 T# w: U" b! q
2.repo 获取源码, C5 F: f5 d$ g) |5 P9 s; ^
) v4 b7 d+ \6 v5 |4 p
#repo init -u -b refs/tags/openstlinux-5.4-dunfell-mp1-20-06-240 a  R2 a3 ~, l; f2 F+ Q) E' J

# J. c, {  A# h. S/ n3 r9 \
  1. repo init -u  -b refs/tags/openstlinux-20-02-19
复制代码
3 P, L1 I" z# F: y4 k: ]  Y
fatal: Cannot get 6 r! i4 Q/ A9 ~
fatal: error [Errno 101] Network is unreachable
3 z7 L# M% Y$ b( A/ e解决方法:先单独克隆repo4 x& x  a; n# u% E

$ S7 @, \1 f4 ~% B# W" f
  1. git clone( ~! X! H( j+ i* t8 O9 |
  2. mkdir .repo- c1 j8 L& Z# z6 m) o
  3. mv git-repo/ repo1 a6 U! `; v+ n. ~8 z4 p' V
  4. mv repo .repo
    ; L+ N0 G$ N3 |& H5 s
  5. repo sync -c -j8
复制代码

$ I7 U6 j% w7 l' o- \单独更新' Y9 F- q# P$ T% i% y3 Y) v
% W2 R) ^7 t0 l0 c
  1. repo sync --force-sync layers/meta-openembedded/
    / ~( g1 p* B* U. X) I: H- V  m
  2. repo sync --force-sync layers/meta-openembedded/8 J  W0 u7 m- A3 Q* ?% k  e
  3. repo sync --force-sync layers/meta-st/meta-st-openstlinux/+ C9 R6 b$ F+ w% ]; m$ P( q# y& ?
  4. repo sync --force-sync layers/openembedded-core/# ]0 z: p+ b  \& v: E
  5. repo sync --force-sync layers/openembedded-core/bitbake/8 e3 f& e  t- V, [" z3 g
  6. repo sync
复制代码
8 k4 a2 Z! g* f8 }6 p
源码获取完成,编译Distribution Package。
% s% p* O- t/ u) Q
  1. PC gt; DISTRO=openstlinux-weston MACHINE=stm32mp1 source layers/meta-st/scripts/envsetup.sh) q) n( t8 e. a: l5 x
  2. PC gt; bitbake st-image-wseton    //编译镜像PC gt; bitbake st-image-weston  -c fetchall  //编译镜像
复制代码

5 X/ s) g" x% ]% C( P# y; D+ O4.bitbake常用的一些命令5 g! M3 u, J8 Y9 u. V( b
/ W0 _, @. }* J1 i% l
  1. bitbake st-image-wseton -f //忽略某个包的错误,执行下去。可以减少编译等待时间。. F# t* j+ G& l9 b2 ?. w
  2. bitbake st-image-wseton -c fetchall  //-C用于执行特定命令,这里fetchall.
    , D- J" i8 x8 N( f: A
  3. bitbake -e linux-imx | grep ^SRC_URI=  //软件包下载地址
    3 P' O2 p  V2 ~& p) m9 d
  4. bitbake -s | grep linux      //查找所有包并显示包含有linux名字的包  R1 \1 m% R' e- q7 b% ]$ V
  5. bitbake -e linux-imx  | grep ^S=    //编译目录4 X- Y* O% t8 I" O. _+ A
  6. bitbake linux-imx -C compile   //编译内核和dtb,-C的C是大写
    ; ?" C* p" Q; o$ M6 o3 E: Q. J2 e" s
  7. bitbake opencv -c fetch
    ! m; X! ~; B5 y5 C0 k2 }0 j4 t
  8. bitbake opencv -c clean! I* N0 U1 E4 y. I: v9 Y
  9. 1 @3 [% l, y5 a8 E% y" d: r
  10. bitbake -k core-image-minimal
    % q& O* S1 S, t, d3 L: T" @
  11. bitbake xx-image -c listtasks
    8 C5 A! X' v7 e; p
  12. bitbake -s | grep packagename1 k. v" P5 n  |4 q8 v4 q5 H
  13. bitbake -e xxx-image | grep ^SRC_URI=
    " ?( x. s5 m. P% ~) X9 ^$ [
  14. 查看软件依赖
    9 f& M5 y3 ]4 c
  15. bitbake -g  packagename
复制代码
  1. bitbake -c clean -v u-boot
    - @- Y9 h4 U1 p1 N
  2. bitbake -c cleanall     xx-image            #清除所有编译中间
      \& ^: A9 w+ F- H' [; n
  3. bitbake -c cleansstate   xx-image            #清除编译         ( \1 S, }2 V5 }  W$ O
  4. 生成编译中的配置文件和类文件
    2 Z* r- R- i! N% f( k  N
  5. bitbake -e > mybuild.log
    : f/ Y5 [+ r. [
  6. 0 q8 R2 T$ H( c) I; L" |2 N
  7. bitbake -b 加上.bb文件的路径,即可以直接执行这个.bb文件
    & K4 m  K9 [0 R" i  R0 T
  8. #查找包的原路径5 S- i- M7 g; u3 Q
  9. bitbake -e linux-stm32mp | grep ^SRC_URI=+ z, i. o0 v! R9 M
  10. #查找包的bblayer! {8 u3 z. l, |
  11. bitbake -e linux-stm32mp | grep ^S
复制代码

  d! N0 C$ X% ?3 ~- g7 K5.bitbake 命令续
) Y" x5 r3 q; s. j. c
  1. bitbake -e linux-stm32mp | grep ^S=
    2 S" B9 ]* I3 z$ {4 \
  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 f' _* J$ x3 L' w3 |
  3. bitbake -e m4projects-stm32mp1 | grep ^S=0 U# x; l6 h* @
  4. S="/home/fdw/32mp1/openstlinux-200219/build-openstlinuxweston-stm32mp1/tmp-glibc/work/stm32mp1-ostl-linux-gnueabi/m4projects-stm32mp1/1.2.0-r0/git' Y. V6 i$ U& S3 z3 t* n

  5. % a8 I4 v: B2 P' U" c
  6. bitbake -s | grep opencv- G7 [( W/ O  {
  7. PC gt;  find . -type f -iname "opencv*.bb"- p; H4 Y1 ^8 s+ Z- p+ N
  8. ./layers/meta-openembedded/meta-oe/recipes-support/opencv/opencv_3.4.3.bb
复制代码
& o3 E' _& p9 I& x, N( d7 _
6.linux 内核实例
6 i/ J* ^% R7 y9 {* W
  1. PC gt; devtool modify virtual/kernel
    . q& A/ R2 B6 f+ D; M; R% `
  2. PC gt; ls workspace/sources/linux-stm32mp// Q5 K8 o* ^0 |9 n9 d0 I0 C

  3. 7 b' U5 ]0 N' x+ g7 g0 z, M) H3 x) {
  4. Board gt; dmesg | grep -i cma
    4 U) u) f9 o6 A  x$ a; H' w
  5. PC gt;grep -i CONFIG_CMA_SIZE_MBYTES ./workspace/sources/linux-stm32mp/ -nr
    6 f. w) x! ~* O- @
  6. 3 g" g7 G" i+ `# F$ ~9 }9 R9 W/ I6 Z
  7. PC gt; bitbake virtual/kernel -c menuconfig
    ) h7 b- E0 {' T; Q& l& t
  8. PC gt; bitbake virtual/kernel -C compile& i% X5 i; x, D; {: u* K

  9. . C0 Z3 Q8 X' q5 T
  10. $ bitbake -c menuconfig virtual/kernel
    ( k( C" n- l# G& k% C
  11. $ bitbake -c compile -f -v virtual/kernel 单独编译内核
    : ]6 S6 s+ E1 b. w
  12. $ bitbake -c compile_kernelmodules -f -v virtual/kernel 单独编译模块, S" C3 |) L; W8 k
  13. $ bitbake -c deploy -f -v virtual/kernel  然后部署编译输出镜像
复制代码
  1. #devtool build because the build makes compile,
    ! j+ ?! H% z+ z  u" Y
  2. #compile_kernemodules and install commands0 h; [% c- z- B& q6 P  y4 N. L; m
  3. Board gt; mount /dev/mmcblk0p4 /boot1 x0 c) _' a  q1 u4 X
  4. PC gt; scp <build dir>/../../*.dtb root@<board ip address>:/boot
    8 f& A4 c& {5 l9 A
  5. Board gt; cd /boot; sync; systemctl reboot2 L! E6 u& D5 u

  6. " R: u" l0 ^6 U. ]) M6 O
  7. vim workspace/sources/linux-stm32mp/arch/arm/boot/dts/stm32mp157a-dk1.dts
    0 o) j2 h! l- `+ \
  8. bitbake virtual/kernel -C compile
复制代码
  1. PC gt; vim workspace/sources/linux-stm32mp/drivers/media/platform/vivid/vivid-core.c 7 _$ a( G. i" u& t
  2. PC gt; bitbake virtual/kernel -C compile
    2 F8 L' Z4 {% K1 ?! r- ~( }: z
  3. #Update the vivid kernel module on the board
    8 q6 a- a, J/ V, m. b$ i4 J* m' B
  4. PC gt; devtool deploy-target -Ss linux-stm32mp  :/
    . d. {( T1 }& `9 U# M( V4 M
  5. Board gt; /sbin/depmod -a
    % ^, S+ W' r7 \* a/ i
  6. Board gt; sync
    + K0 ^: ?, |5 _: s, q) Z" \
  7. Board gt; modprobe vivid     
复制代码
  1. scp tmp-glibc/deploy/images/stm32mp1/stm32mp157*.dtb :/boot
    ! \' f! n  A* H& I; ]2 m
  2. scp tmp-glibc/deploy/images/stm32mp1/uImage*:/boot
    0 |8 H. W" N; y( t
  3. rm -rf /home/fdw/.ssh/known_hosts
复制代码

7 f4 b. C- M- `; @& t: u) R( P6.uboot实例1 W! @2 f; v& @/ [
  1. PC gt; devtool search u-boot*
    0 c1 N2 R2 _2 I. N7 s% [
  2. PC gt; devtool modify u-boot-stm32mp
    ( k" ~" m3 s; v" a% F1 Q4 n& V
  3. #cd <build dir>/workspace/sources/u-boot-stm32mp
    $ x' t. p9 [& A, h
  4. PC gt; devtool build u-boot-stm32mp- ^; C" x3 N* ^0 `" x
  5. PC gt; bitbake u-boot-stm32mp -c deploy2 f4 f. O( A1 P4 w0 `
  6. #ums 0 mmc 0
    ; D8 Y' h, x4 Q* B
  7. PC gt; dd if=u-boot-<board name>-trusted.stm32 of=/dev/sdc3 bs=1M conv=fdatasync
复制代码
6 e0 d1 i' ^. e4 _. K/ F2 j
7.tf-A实例
. w0 ]7 @1 _$ k; M4 `
  1. PC gt; devtool search tf-a*" `% r  u$ A  {: H5 e6 ~
  2. PC gt; devtool modify tf-a-stm32mp
    $ w* _6 P! B2 B; F) k6 V' M
  3. #PC gt; cd <build dir>/workspace/sources/tf-a-stm32mp  i- q7 u# I( [  c" o
  4. PC gt; vim ./plat/st/stm32mp1/bl2_io_storage.c 5 S& Z. s* _9 `2 |. D
  5. PC gt; devtool build tf-a-stm32mp
    1 p4 B. F+ O) c/ ]; `
  6. #bitbake tf-a-stm32mp
    5 U' D7 j) t6 o, O+ `2 u
  7. PC gt; bitbake tf-a-stm32mp -c deploy
    - r4 z9 y1 {% ?5 p
  8. PC gt; dd if=tf-a-<board name>-trusted.stm32 of=/dev/sdc1 bs=1M conv=fdatasync
复制代码

7 V* s; V( C, ^' p. [( g8.应用程序 “hello world”
/ X$ e( T; w2 H3 Y( O% W6 c0 k9 {& a8 ^
  1. PC gt; mkdir hello_world_example, v( q0 ]# o$ e" G
  2. PC gt; cd hello_world_example
    / ^( X7 G& Q7 ]4 |7 R7 J1 r
  3. PC gt; vim hello_world_example.c
    , I6 V- p  T  t+ j8 k/ K6 C
  4. PC gt; cd <build dir>
    / q, L8 [0 a( v( D* A9 L
  5. #Add a new recipe to the workspace
    , @, J" Z* v. T
  6. PC gt; devtool add myhelloworld hello_world_example/
    0 `# S$ W6 k0 A8 t, d5 D
  7. #Adapt recipe  }$ {9 m$ A2 z0 }
  8. PC gt; devtool edit-recipe myhelloworld0 y" r/ A9 h8 b3 u: s
  9. PC gt; devtool build myhelloworld' X/ a+ L, c/ ~+ `( N: e
  10. PC gt; devtool deploy-target -s myhelloworld
复制代码
. W: v$ I4 H) W0 G
9.m4projects-stm32+ ~& ~# J9 v& |4 O: ]. p
  1. Board gt; cd <path_to_your_workspace>/build-<name_of_distro>
    : z: b/ U3 f+ I: s
  2. & H( _6 Z4 T3 L
  3. Clean the m4projects build folder7 s3 V8 j7 l3 m- l( p' M3 p
  4. Board gt; bitbake m4projects-stm32mp1 -f -c cleanall
      @, h8 J/ x9 t8 x  B

  5. 6 |2 T+ [' N1 q6 U3 q0 `5 i; o6 }
  6. Rebuild the recipe m4projects
    " k, c; }. ^( N, P' [7 A- ^
  7. Board gt; bitbake m4projects-stm32mp1
    5 p" g1 ~2 j1 y2 ^7 N- W6 F) X) B
  8. 0 \/ j* ]" j8 p, G% @7 q6 d7 b* p
  9. Rebuild the image1 I2 ~, q; J5 P0 b9 P
  10. Board gt; bitbake st-image-weston
复制代码

. [$ S" X5 E  R* t% k8 o4 J二.devtool的总结; Y% i/ a' D2 u& z

4 g6 b! W; S, H4 n
  1. devtool modify tf-a-stm32mp
    3 G2 Z) h. T4 L" P' _% f/ n
  2. bitbake tf-a-stm32mp% {: S# ~" h5 Z, L5 r- v6 D' D
  3. 7 g; b& \, @3 l5 t
  4. devtool search u-boot*
    - w% I- ]1 d, Z0 X. b
  5. devtool modify u-boot-stm32mp& ^' P# w: i: o+ u( Y9 Q+ r' x+ _
  6. bitbake u-boot-stm32mp
    ; ]% O, M; P0 w$ P: l6 ~$ K
  7. # ~# f  n/ g, ~% o+ a5 U' m* f
  8. devtool modify linux-stm32mp( ?: b% g: ]5 D" a0 M' }0 m" w
  9. bitbake linux-stm32mp
复制代码
  1. NOTE: Starting bitbake server...
    % {, N" f$ z7 u4 N3 ?
  2. usage: devtool [--basepath BASEPATH] [--bbpath BBPATH] [-d] [-q]
    1 E# s7 p# E. T
  3.                [--color COLOR] [-h]! `4 |+ l1 R6 Z0 W- {* P
  4.                <subcommand> ...2 ^5 b* R( Z* J# U' |
  5. * N; ~* {0 k9 ^5 ?
  6. OpenEmbedded development tool
    9 R0 Y: E4 c; u: q, p9 N% E
  7. 2 S7 \/ `" f4 l: w3 k. z
  8. options:
    & W" z4 P4 o- E1 p( ~: n+ x" P9 V
  9.   --basepath BASEPATH  Base directory of SDK / build directory& @8 L" v, R/ h& b
  10.   --bbpath BBPATH      Explicitly specify the BBPATH, rather than getting it
    + @: M9 A2 D9 _$ @( N. W
  11.                        from the metadata
    $ \7 s! O9 Q' X  _
  12.   -d, --debug          Enable debug output
    1 L. z; i9 v9 v& ]
  13.   -q, --quiet          Print only errors
    9 y) [9 m' `% j4 N, m
  14.   --color COLOR        Colorize output (where COLOR is auto, always, never)
    1 e5 h: v' h* Y/ d
  15.   -h, --help           show this help message and exit  w* m; ]& r% A, J( i
  16. ( w5 L* O+ K/ I# u$ |' n: y
  17. subcommands:
    ' O- W; p& F) }$ U* A4 I
  18.   Beginning work on a recipe:
    7 f( Y( d: z1 `7 L8 ?) C' {& D
  19.     add                  Add a new recipe5 j8 d+ b' N( F! u2 t  b
  20.     modify               Modify the source for an existing recipe
    * v: [* P7 T# j! r2 J  g
  21.     upgrade              Upgrade an existing recipe1 f! W. \+ d/ B7 v! V
  22.   Getting information:
    / T6 s+ r+ e" D
  23.     status               Show workspace status) k7 N: T% g7 w1 N
  24.     search               Search available recipes
    3 Y3 r2 A& R* y/ v, Z) E
  25.   Working on a recipe in the workspace:
    + f; x+ O5 m; K& i" V8 e6 M! d, Q
  26.     build                Build a recipe0 B% c" {/ k, c
  27.     rename               Rename a recipe file in the workspace
    + U$ U3 R' P! M9 W' E
  28.     edit-recipe          Edit a recipe file in your workspace
    * _9 s. w# B0 i. a( p" e; T: h
  29.     find-recipe          Find a recipe file in your workspace
    : h5 W0 I8 Z/ W0 u4 k
  30.     configure-help       Get help on configure script options
    2 s# H: ~$ n8 m2 E5 K, i8 C' I
  31.     update-recipe        Apply changes from external source tree to recipe4 Z' D; E, Z9 I0 N- a' }
  32.     reset                Remove a recipe from your workspace! I8 d1 i" S  e
  33.     finish               Finish working on a recipe in your workspace
      w% u; i/ _" i. N4 A% I
  34.   Testing changes on target:
    ! j/ a( w# O5 v- B2 B
  35.     deploy-target        Deploy recipe output files to live target machine
    0 a4 @3 P- U( D- |0 X$ k0 P
  36.     undeploy-target      Undeploy recipe output files in live target machine3 R. ?( b+ _9 K6 D9 z) d+ N0 F
  37.     build-image          Build image including workspace recipe packages
    6 n' K9 z; p! b, i+ t
  38.   Advanced:9 D5 }  K, q- \/ p6 S
  39.     create-workspace     Set up workspace in an alternative location8 K6 V8 J) P8 `! Y+ |3 b
  40.     import               Import exported tar archive into workspace2 ~6 x! [# t$ [" i
  41.     extract              Extract the source for an existing recipe2 ^9 b/ O; z) r* R2 v$ Q$ w
  42.     sync                 Synchronize the source tree for an existing recipe5 u1 ^4 Q$ ]$ v* P
  43.     export               Export workspace into a tar archive- _& q0 O. D3 ^! a
  44. Use devtool <subcommand> --help to get help on a specific command
复制代码
4 s: w  S" V% R, d( R
$ z2 v- L* j- {0 a0 Z
————————————————
2 W- a& ^) U$ ?% E' B1 m5 W版权声明:jacob杰克爸
( i( j, L+ R, B- H1 t6 k) v
& {# ^# S% N) X% j, ]( L9 e8 L
赞 收藏 评论0 发布时间:2022-10-3 22:00

举报

0个回答

所属标签

相似技术帖

官网相关资源

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