-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathyocto.txt
127 lines (68 loc) · 4.03 KB
/
yocto.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
### To start using bitbake you need to source the "oe-init-build-env" script located into poky/ directory. So you should do something like this every time using bitbake:
cd ~/Projects/yocto
source poky/oe-init-build-env build-mp1
cd build-mp1
bitbake-layers show-layers
bitbake -c menuconfig virtual/kernel
bitbake core-image-minimal # or one of the images here https://docs.yoctoproject.org/ref-manual/images.html
# You may continue building the image without starting over by executing the following command
bitbake -f core-image-minimal
# If you want to start over
bitbake -c cleanall core-image-minimal
# To clean out everything
rm -rf tmp
### Create the final image for the SD card
cd ~/Projects/yocto/build-mp1/tmp/deploy/images/stm32mp1/scripts
./create_sdcard_from_flashlayout.sh ../flashlayout_core-image-minimal/extensible/FlashLayout_sdcard_stm32mp157f-dk2-extensible.tsv
# After unmounting the SD card
sudo dd if=../flashlayout_core-image-minimal/extensible/../../FlashLayout_sdcard_stm32mp157f-dk2-extensible.raw of=/dev/mmcblk0 bs=8M conv=fdatasync status=progress oflag=direct
## Voila!
# Adding build tools (including GCC and Nano) to the Linux system
Find the local.conf file (in .../yocto-labs/build/conf) and add these lines (doesn’t seem to matter where but the space before the package name seems to be important!):
IMAGE_INSTALL:append = " packagegroup-core-buildessential"
IMAGE_INSTALL:append = " nano"
IMAGE_INSTALL:append = " apt"
The first line will append the typical GCC build tools. The second line will add the Nano editor (in case you prefer not to work with the VI editor that is part of the minimal Linux system).
# Pay attention to syntax changes in newer versions: https://docs.yoctoproject.org/next/migration-guides/migration-3.4.html
# Make Kernel Changes Permanent
bitbake -c savedefconfig virtual/kernel
Now rebuild the Linux system and flash it to an SD Card. If all went well, you can now use GCC and the Nano editor natively on the STM32MP157F-DK2 board.
# If apt commands give an error like this E: flAbsPath on /var/lib/dpkg/status failed ; run the following
touch /var/lib/dpkg/status
sudo picocom -b 115200 /dev/ttyACM1
# If you wish to exit picocom, press [Ctrl][a] followed by [Ctrl][x]
# nano /etc/apt/sources.list.d/sources.list
deb [trusted=yes] http://packages.openstlinux.st.com kirkstone InRelease
deb [trusted=yes] http://packages.openstlinux.st.com kirkstone/main armhf Packages
deb [trusted=yes] http://packages.openstlinux.st.com kirkstone/updates armhf Packages
# nano /etc/apt/apt.conf
APT::Architecture "${DPKG_ARCH}";
### Create custom layer and image
# Enable the OpenEmbedded build environment
cd ~/Projects/yocto
source poky/oe-init-build-env build-mp1
# Create a custom layer
cd ~/Projects/yocto
bitbake-layers create-layer meta-custom
# Create custom image
cd meta-custom
mkdir -p recipes-core/images
# Copy the core-image-minimal.bb recipe to use a starting point
cp ../poky/meta/recipes-core/images/core-image-minimal.bb recipes-core/images/custom-image.bb
vi recipes-core/images/custom-image.bb
# Change the recipe to the following
# Create the final custom image for the SD card
cd ~/Projects/yocto/build-mp1/tmp/deploy/images/stm32mp1/scripts
./create_sdcard_from_flashlayout.sh ../flashlayout_custom-image/extensible/FlashLayout_sdcard_stm32mp157f-dk2-extensible.tsv
sudo dd if=../flashlayout_custom-image/extensible/../../FlashLayout_sdcard_stm32mp157f-dk2-extensible.raw of=/dev/mmcblk0 bs=8M conv=fdatasync status=progress oflag=direct
## Enable peripherals like I2C
cd ~/Projects/yocto/build-mp1/
cp tmp/work-shared/stm32mp1/kernel-source/arch/arm/boot/dts/stm32mp157d-dk1.dts ~/Documents
cd ~/Documents
cp stm32mp157f-dk2.dts stm32mp157f-dk2.dts.orig
vi stm32mp157f-dk2.dts
git diff --no-index stm32mp157f-dk2.dts.orig stm32mp157f-dk2.dts > 0001-add-i2c5-userspace-dts.patch
gedit 0001-add-i2c5-userspace-dts.patch
# Change the file header so that it points to the correct file locations:
--- a/arch/arm/boot/dts/stm32mp157f-dk2.dts
+++ b/arch/arm/boot/dts/stm32mp157f-dk2.dts