guowenxue
2023-12-22 281a7fcd5924e749a96967393828421caea68e93
commit | author | age
849fbd 1 SUMMARY = "A console lite image for production"
G 2 LICENSE = "MIT"
3
4 inherit core-image
5
6 # additional free disk space created in Kbytes
7 #IMAGE_OVERHEAD_FACTOR = "1.0"
8 #IMAGE_ROOTFS_EXTRA_SPACE = "512000"
9
10 inherit extrausers
11 # Create the password hash with following command on host:
281a7f 12 # >> mkpasswd -m sha256crypt password -S abcd6789
849fbd 13 # Remember to escape the character $ in the resulting hash
G 14
281a7f 15 # Set the root password:
G 16 #PASSWD="\$5\$abcd6789\$Vuv1aLz04ZwhxgsB3lOQbwy1XUS6PJ.8h2A7.9HoUd3"
849fbd 17 EXTRA_USERS_PARAMS = "\
G 18     usermod -p '${PASSWD}' root; \
19 "
281a7f 20
G 21 ## Select Image Features
22 IMAGE_FEATURES += " \
23     hwcodecs \
24     ssh-server-openssh \
25     package-management \
26 "
27
28 CONFLICT_DISTRO_FEATURES = "directfb"
29
30 CORE_IMAGE_EXTRA_INSTALL += " \
31     packagegroup-base-wifi \
32     packagegroup-imx-isp \
33     packagegroup-imx-security \
34     packagegroup-fsl-tools-audio \
35     packagegroup-core-full-cmdline \
36     packagegroup-tools-bluetooth \
37     packagegroup-core-ssh-openssh \
38     packagegroup-fsl-gstreamer1.0 \
39     packagegroup-fsl-gstreamer1.0-full \
40     packagegroup-qt6-modules \
41     packagegroup-misc-utils \
42 "
43
44 CORE_IMAGE_EXTRA_INSTALL += " \
45     kernel-modules \
46     firmwared linux-firmware \
47     powertop tzdata ppp vim \
48     xz lrzsz rsync dos2unix \
49     gnupg parted inetutils \
50     hostapd wireless-tools iw \
51     i2c-tools spidev-test \
52     libgpiod libgpiod-tools \
53     opencv zbar v4l-utils yavta \
54     alsa-state pulseaudio-server \
55     python3 python3-pip \
56     openssh-sftp openssh-sftp-server \
57     memtester pcsc-tools stunnel ntp \
58     curl evtest cpufrequtils \
59     dosfstools ethtool iproute2 \
60     e2fsprogs-mke2fs e2fsprogs-resize2fs \
61 "
62
63 modify_rootfs() {
64
65     # Modify default environment
66     echo "alias ls='ls --color=auto'" >> ${IMAGE_ROOTFS}/etc/profile
67
68     # Update wpa_supplicant service
69     sed -i "/^After=/d" ${IMAGE_ROOTFS}/lib/systemd/system/wpa_supplicant@.service
70 }
71
72 # Remove unused files in rootfs
73 doclean_rootfs() {
74
75     # remove unsed test apps
76     rm -rf ${IMAGE_ROOTFS}/unit_tests
77
78     # remove unsed firmware
79     mkdir -p ${IMAGE_ROOTFS}/lib/firmware/.bak
80
81     mv ${IMAGE_ROOTFS}/lib/firmware/imx* ${IMAGE_ROOTFS}/lib/firmware/.bak
82     mv ${IMAGE_ROOTFS}/lib/firmware/nxp* ${IMAGE_ROOTFS}/lib/firmware/.bak
83     mv ${IMAGE_ROOTFS}/lib/firmware/mediatek ${IMAGE_ROOTFS}/lib/firmware/.bak
84     mv ${IMAGE_ROOTFS}/lib/firmware/mt76* ${IMAGE_ROOTFS}/lib/firmware/.bak
85     mv ${IMAGE_ROOTFS}/lib/firmware/rtl* ${IMAGE_ROOTFS}/lib/firmware/.bak
86
87     rm -rf ${IMAGE_ROOTFS}/lib/firmware/*
88     mv ${IMAGE_ROOTFS}/lib/firmware/.bak/* ${IMAGE_ROOTFS}/lib/firmware/
89     rm -rf ${IMAGE_ROOTFS}/lib/firmware/.bak
90 }
91
92 ROOTFS_POSTPROCESS_COMMAND += "modify_rootfs; doclean_rootfs; "