guowenxue
2024-07-13 0bc1e30ccf48fadc7b21424404093ce75b43481f
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
SUMMARY = "A multimedia wth full command image for production"
LICENSE = "MIT"
 
inherit core-image
 
# additional free disk space created in Kbytes
#IMAGE_OVERHEAD_FACTOR = "1.0"
#IMAGE_ROOTFS_EXTRA_SPACE = "512000"
 
inherit extrausers
# Create the password hash with following command on host:
# >> mkpasswd -m sha256crypt password -S abcd6789
# Remember to escape the character $ in the resulting hash
 
# Set the root password:
#PASSWD="\$5\$abcd6789\$Vuv1aLz04ZwhxgsB3lOQbwy1XUS6PJ.8h2A7.9HoUd3"
EXTRA_USERS_PARAMS = "\
    usermod -p '${PASSWD}' root; \
"
 
## Select Image Features
IMAGE_FEATURES += " \
    hwcodecs \
    ssh-server-openssh \
    package-management \
"
 
CONFLICT_DISTRO_FEATURES = "directfb"
 
CORE_IMAGE_EXTRA_INSTALL_BASE += " \
    packagegroup-base-wifi \
    packagegroup-imx-isp \
    packagegroup-imx-security \
    packagegroup-fsl-tools-audio \
    packagegroup-core-full-cmdline \
    packagegroup-tools-bluetooth \
    packagegroup-core-ssh-openssh \
    packagegroup-fsl-gstreamer1.0 \
    packagegroup-fsl-gstreamer1.0-full \
    packagegroup-fsl-tools-benchmark \
    packagegroup-fsl-opencv-imx \
    packagegroup-qt6-modules \
    packagegroup-misc-utils \
"
 
CORE_IMAGE_EXTRA_INSTALL_BASE += " \
    kernel-modules \
    firmwared linux-firmware \
    powertop tzdata ppp vim \
    xz lrzsz rsync dos2unix \
    gnupg parted inetutils \
    hostapd wireless-tools iw \
    i2c-tools spidev-test spitools \
    libgpiod libgpiod-tools \
    fb-test fbgrab libdrm ffmpeg \
    opencv zbar v4l-utils yavta \
    alsa-state pulseaudio-server \
    python3 python3-pip tmux \
    openssh-sftp openssh-sftp-server \
    memtester pcsc-tools stunnel ntp \
    curl evtest cpufrequtils iperf3 \
    dosfstools ethtool iproute2 modemmanager \
    e2fsprogs-mke2fs e2fsprogs-resize2fs \
    cryptodev-module openssl-bin \
    libsocketcan can-utils canutils \
"
 
# For machine igkboard-imx6ull
CORE_IMAGE_EXTRA_INSTALL = " \
    ${CORE_IMAGE_EXTRA_INSTALL_BASE} \
"
 
# For machine igkboard-imx8mp
CORE_IMAGE_EXTRA_INSTALL:igkboard-imx8mp = " \
    ${CORE_IMAGE_EXTRA_INSTALL_BASE} \
    packagegroup-fsl-tools-gpu \
    packagegroup-fsl-tools-gpu-external \
    ${@bb.utils.contains('DISTRO_FEATURES', 'wayland', 'weston-init', '', d)} \
    git gcc gcc-symlinks binutils automake cmake autoconf freerdp \
"
 
modify_rootfs() {
 
    # Modify default environment
    echo "alias ls='ls --color=auto'" >> ${IMAGE_ROOTFS}/etc/profile
 
    # Update wpa_supplicant service
    sed -i "/^After=/d" ${IMAGE_ROOTFS}/lib/systemd/system/wpa_supplicant@.service
}
 
# Remove unused files in rootfs
doclean_rootfs() {
 
    # remove unsed test apps
    rm -rf ${IMAGE_ROOTFS}/unit_tests
 
    # remove unsed firmware
    mkdir -p ${IMAGE_ROOTFS}/lib/firmware/.bak
 
    mv ${IMAGE_ROOTFS}/lib/firmware/imx* ${IMAGE_ROOTFS}/lib/firmware/.bak
    mv ${IMAGE_ROOTFS}/lib/firmware/nxp* ${IMAGE_ROOTFS}/lib/firmware/.bak
    mv ${IMAGE_ROOTFS}/lib/firmware/mediatek ${IMAGE_ROOTFS}/lib/firmware/.bak
    mv ${IMAGE_ROOTFS}/lib/firmware/mt76* ${IMAGE_ROOTFS}/lib/firmware/.bak
    mv ${IMAGE_ROOTFS}/lib/firmware/rtl* ${IMAGE_ROOTFS}/lib/firmware/.bak
 
    rm -rf ${IMAGE_ROOTFS}/lib/firmware/*
    mv ${IMAGE_ROOTFS}/lib/firmware/.bak/* ${IMAGE_ROOTFS}/lib/firmware/
    rm -rf ${IMAGE_ROOTFS}/lib/firmware/imx*.elf
    rm -rf ${IMAGE_ROOTFS}/lib/firmware/.bak
}
 
ROOTFS_POSTPROCESS_COMMAND += "modify_rootfs; doclean_rootfs; "