From 98836f9b993e5450ad61daf2e589446819659b68 Mon Sep 17 00:00:00 2001 From: TolaMironcenko Date: Wed, 5 Mar 2025 17:52:04 +0700 Subject: [PATCH] added hostapd and openssl --- Makefile | 6 ++++++ kernel/config-6.13.3 | 6 +++--- scripts/build_image.sh | 8 ++++++++ scripts/config.sh | 2 ++ scripts/hostapd.sh | 32 ++++++++++++++++++++++++++++++++ scripts/iw.sh | 2 +- scripts/kernel.sh | 11 +++++++++++ scripts/openssl.sh | 27 +++++++++++++++++++++++++++ scripts/rootfs.sh | 37 +++++++++++++------------------------ scripts/uclibc.sh | 1 + sources.txt | 2 ++ uclibc/config-1.0.50 | 2 +- 12 files changed, 107 insertions(+), 29 deletions(-) create mode 100644 scripts/hostapd.sh create mode 100644 scripts/openssl.sh diff --git a/Makefile b/Makefile index 05fe4a5..6343b45 100644 --- a/Makefile +++ b/Makefile @@ -27,5 +27,11 @@ libnl: iw: ./scripts/build_image.sh iw +hostapd: + ./scripts/build_image.sh hostapd + +openssl: + ./scripts/build_image.sh openssl + sdroot_usable: ./scripts/build_image.sh sdroot_usable diff --git a/kernel/config-6.13.3 b/kernel/config-6.13.3 index baac00d..c056504 100644 --- a/kernel/config-6.13.3 +++ b/kernel/config-6.13.3 @@ -11,8 +11,8 @@ CONFIG_AS_VERSION=24100 CONFIG_LD_IS_BFD=y CONFIG_LD_VERSION=24100 CONFIG_LLD_VERSION=0 -CONFIG_RUSTC_VERSION=108500 -CONFIG_RUSTC_LLVM_VERSION=190107 +CONFIG_RUSTC_VERSION=108200 +CONFIG_RUSTC_LLVM_VERSION=190101 CONFIG_CC_CAN_LINK=y CONFIG_CC_CAN_LINK_STATIC=y CONFIG_CC_HAS_ASM_GOTO_OUTPUT=y @@ -1593,7 +1593,7 @@ CONFIG_WLAN_VENDOR_MARVELL=y # CONFIG_LIBERTAS_THINFIRM is not set # CONFIG_MWIFIEX is not set CONFIG_WLAN_VENDOR_MEDIATEK=y -# CONFIG_MT7601U is not set +CONFIG_MT7601U=y # CONFIG_MT76x0U is not set # CONFIG_MT76x2U is not set # CONFIG_MT7663U is not set diff --git a/scripts/build_image.sh b/scripts/build_image.sh index dd87d53..62a023d 100755 --- a/scripts/build_image.sh +++ b/scripts/build_image.sh @@ -12,6 +12,8 @@ . ./scripts/dropbear.sh . ./scripts/libnl.sh . ./scripts/iw.sh +. ./scripts/hostapd.sh +. ./scripts/openssl.sh case $1 in build) @@ -40,6 +42,12 @@ case $1 in iw) iw ;; + hostapd) + hostapd + ;; + openssl) + openssl + ;; sdroot_usable) if [ ! -d downloads ]; then download_sources diff --git a/scripts/config.sh b/scripts/config.sh index bb11178..c10fd1f 100755 --- a/scripts/config.sh +++ b/scripts/config.sh @@ -33,4 +33,6 @@ export libnl_enable="false" export iw_enable="true" export wireles_tools_enable="false" export wpa_supplicant_enable="false" +export hostapd_enable="true" +export openssl_enable="false" #-------------------------------------- diff --git a/scripts/hostapd.sh b/scripts/hostapd.sh new file mode 100644 index 0000000..badc7da --- /dev/null +++ b/scripts/hostapd.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +. ./scripts/colors.sh +. ./scripts/funcs.sh +. ./scripts/config.sh +. ./scripts/libnl.sh +. ./scripts/openssl.sh + +hostapd() { + [ ! -d $build/libnl ] && libnl + [ ! -d $build/openssl ] && openssl + pkgname=hostapd + pkgver=2.11 + printf "$GREEN** Building and installing ${pkgname}\n$RESET" + [ ! -d $build/${pkgname} ] && mkdir $build/${pkgname} + cd $build/${pkgname} + tar -xvf $root/downloads/${pkgname}-${pkgver}.tar.gz + cd ${pkgname}-${pkgver}/${pkgname} + sed -i "/CONFIG_EAP_TLS=y/s//#CONFIG_EAP_TLS=y/" defconfig + cp -v defconfig .config + CC=${CROSS_COMPILE}-gcc \ + PKG_CONFIG_PATH=/opt/toolchains/arm-buildroot-linux-uclibcgnueabihf/arm-buildroot-linux-uclibcgnueabihf/sysroot/usr/lib/pkgconfig \ + make ${makeflags} + check $? "Build ${pkgname}" + ${CROSS_COMPILE}-strip hostapd hostapd_cli + check $? "Stripping ${pkgname} binary" + cp -v hostapd hostapd_cli $rootfspath/usr/bin/ + cp -v /opt/toolchains/arm-buildroot-linux-uclibcgnueabihf/arm-buildroot-linux-uclibcgnueabihf/sysroot/lib/libatomic.so.1.2.0 \ + $rootfspath/usr/lib + ln -sv libatomic.so.1.2.0 $rootfspath/usr/lib/libatomic.so.1 + check $? "Install to rootfs ${pkgname}" +} diff --git a/scripts/iw.sh b/scripts/iw.sh index 3ca041d..37071b5 100644 --- a/scripts/iw.sh +++ b/scripts/iw.sh @@ -14,7 +14,7 @@ iw() { cd $build/iw tar -xvf $root/downloads/${pkgname}-${pkgver}.tar.xz cd ${pkgname}-${pkgver} - CC=arm-buildroot-linux-uclibcgnueabihf-gcc \ + CC=${CROSS_COMPILE}-gcc \ PKG_CONFIG_PATH=/opt/toolchains/arm-buildroot-linux-uclibcgnueabihf/arm-buildroot-linux-uclibcgnueabihf/sysroot/usr/lib/pkgconfig \ make ${makeflags} check $? "Build ${pkgname}" diff --git a/scripts/kernel.sh b/scripts/kernel.sh index 05e3758..a1f9582 100755 --- a/scripts/kernel.sh +++ b/scripts/kernel.sh @@ -57,3 +57,14 @@ kernel_with_rootfs() { check $? "Install Linux Kernel into images path" } #----------------------------------------------------------- + +kernel_headers() { + printf "$UGREEN** Building Linux Kernel headers\n$RESET" + [ ! -d $build/kernel-headers ] && mkdir $build/kernel-headers + cd $build/kernel-headers + tar -xvf $root/downloads/linux-$kernel_version.tar.xz + check $? "Extract Linux Kernel" + cd linux-$kernel_version + make ARCH=$ARCH headers + check $? "Build kernel headers" +} diff --git a/scripts/openssl.sh b/scripts/openssl.sh new file mode 100644 index 0000000..5d72e1a --- /dev/null +++ b/scripts/openssl.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +. ./scripts/colors.sh +. ./scripts/funcs.sh +. ./scripts/config.sh + +set -x + +openssl() { + pkgname=openssl + pkgver=3.4.1 + printf "$GREEN** Building and installing ${pkgname}\n$RESET" + [ ! -d $build/${pkgname} ] && mkdir $build/${pkgname} + cd $build/${pkgname} + tar -xvf $root/downloads/${pkgname}-${pkgver}.tar.gz + cd ${pkgname}-${pkgver}/ + ./config linux-armv4 CROSS_COMPILE=${CROSS_COMPILE}- + check $? "Configure ${pkgname}" + make ${makeflags} + check $? "Build ${pkgname}" + ${CROSS_COMPILE}-strip libcrypto.so.3 libssl.so.3 + check $? "Stripping ${pkgname} binary" + cp -v libcrypto.so.3 libssl.so.3 $rootfspath/usr/lib/ + ln -sv libcrypto.so.3 $rootfspath/usr/lib/libcrypto.so + ln -sv libssl.so.3 $rootfspath/usr/lib/libssl.so + check $? "Install to rootfs ${pkgname}" +} diff --git a/scripts/rootfs.sh b/scripts/rootfs.sh index ee726d8..9d1b81d 100755 --- a/scripts/rootfs.sh +++ b/scripts/rootfs.sh @@ -15,6 +15,8 @@ . ./scripts/gitea.sh . ./scripts/libnl.sh . ./scripts/iw.sh +. ./scripts/openssl.sh +. ./scripts/hostapd.sh #----------- Building rootfs ---------------------- rootfs() { @@ -43,34 +45,21 @@ rootfs() { cd $rootfspath/usr/bin for i in $(cat $root/busybox/busybox_list); do ln -sv busybox $i; done cp -v $root/rootfs/init.in $rootfspath/init + kernel_headers uclibc kernel kernel_modules - if [ "$ZLIB_ENABLE" = "true" ]; then - zlib - fi - if [ "$DROPBEAR_ENABLE" = "true" ]; then - dropbear - fi - if [ "$sftp_server_enable" = "true" ]; then - sftp_server - fi - if [ "$curl_enable" = "true" ]; then - curl - fi - if [ "$bash_enable" = "true" ]; then - bash - fi - if [ "$git_enable" = "true" ]; then - git - fi - if [ "$gitea_enable" = "true" ]; then - gitea - fi - if [ "$libnl_enable" = "true" ]; then - libnl - fi + [ "$ZLIB_ENABLE" = "true" ] && zlib + [ "$DROPBEAR_ENABLE" = "true" ] && dropbear + [ "$sftp_server_enable" = "true" ] && sftp_server + [ "$curl_enable" = "true" ] && curl + [ "$bash_enable" = "true" ] && bash + [ "$git_enable" = "true" ] && git + [ "$gitea_enable" = "true" ] && gitea + [ "$libnl_enable" = "true" ] && libnl [ "$iw_enable" = "true" ] && iw + [ "$openssl_enable" = "true" ] && openssl + [ "$hostapd_enable" = "true" ] && hostapd chmod 640 $rootfspath/etc/shadow $rootfspath/etc/inittab chmod 755 $rootfspath/etc/init.d/* $rootfspath/usr/share/udhcpc/default.script $rootfspath/init diff --git a/scripts/uclibc.sh b/scripts/uclibc.sh index ede3d7e..6eb1571 100755 --- a/scripts/uclibc.sh +++ b/scripts/uclibc.sh @@ -15,6 +15,7 @@ uclibc() { check $? "Extract ${pkgname}" cd ${pkgname}-${pkgver} cp -rv $root/uclibc/config-${pkgver} .config + sed -i -e "s/KERNEL_HEADERS=/KERNEL_HEADERS=\"..\/..\/kernel-headers\/linux-$kernel_version\/usr\/include\"/g" .config make ARCH=$ARCH CROSS_COMPILE=$CROSS_COMPILE- oldconfig check $? "Configure ${pkgname}" make ARCH=$ARCH CROSS_COMPILE=$CROSS_COMPILE- $makeflags # &>> $fulllogfile diff --git a/sources.txt b/sources.txt index 98580a6..56898da 100644 --- a/sources.txt +++ b/sources.txt @@ -13,3 +13,5 @@ https://www.kernel.org/pub/software/scm/git/git-2.46.0.tar.xz https://dl.gitea.com/gitea/1.22.4/gitea-1.22.4-linux-arm-5 # https://www.kernel.org/pub/software/network/iw/iw-6.9.tar.xz # https://github.com/thom311/libnl/releases/download/libnl3_10_0/libnl-3.10.0.tar.gz +# https://w1.fi/releases/hostapd-2.11.tar.gz +# https://github.com/openssl/openssl/releases/download/openssl-3.4.1/openssl-3.4.1.tar.gz diff --git a/uclibc/config-1.0.50 b/uclibc/config-1.0.50 index 085a00f..872aca8 100755 --- a/uclibc/config-1.0.50 +++ b/uclibc/config-1.0.50 @@ -60,7 +60,7 @@ UCLIBC_HAS_FPU=y DO_C99_MATH=y DO_XSI_MATH=y UCLIBC_HAS_LONG_DOUBLE_MATH=y -KERNEL_HEADERS="/home/tola/Documents/linux/SimpleLinux/downloads/linux-6.13.3/usr/include" +KERNEL_HEADERS= HAVE_DOT_CONFIG=y #