U
Best posts made by ubuntu
-
Reply: D1哪吒开发板wifi连接出错,这是什么情况?
看了一下源码,还真是要写 /etc/ 目录下面的文件:
ubuntu:/opt/D1/tina_d1_open$ grep /etc -r package/allwinner/wifimanager/ --include *.c package/allwinner/wifimanager/demo/wifi_longtime_test.c: wmg_printf(MSG_INFO,"DESCRIPTION:\n\tTest the stability of wifi module(see the test result in file:/etc/test_result).\n"); package/allwinner/wifimanager/demo/wifi_longtime_test.c: *see the test result in file:/etc/test_result package/allwinner/wifimanager/demo/wifi_longtime_test.c: wmg_debug_open_file("/etc/wifi_long_time_test.log"); package/allwinner/wifimanager/demo/wifi_longtime_test.c: sprintf(prt_buf,"echo \"Test Times:%d, Success Times:%d(including get IP timeout times:%d), Failed Times:%d\" > /etc/test_results",i,success_times,timeout_times,fail_times); package/allwinner/wifimanager/demo/wifi_longtime_test.c: sprintf(prt_buf,"echo \"Connecting mean time: %llu.%-llu seconds\" >> /etc/test_results",(total_con_microsec/1000000)/i,(total_con_microsec/i)%1000000); package/allwinner/wifimanager/demo/wifi_longtime_test.c: wmg_printf(MSG_INFO,prt_buf,"echo \"Disconnecting mean time: %llu.%-llu seconds\" >> /etc/test_results",(total_disc_microsec/1000000)/i,(total_disc_microsec/i)%1000000); package/allwinner/wifimanager/demo/wifi_longtime_test.c: sprintf(prt_buf,"echo Congratulations! >> /etc/test_results"); package/allwinner/wifimanager/src/core/wifi_udhcpc.c: system("/etc/wifi/udhcpc_wlan0 start >/dev/null"); package/allwinner/wifimanager/src/core/wifimanager.c: system("/etc/wifi/udhcpc_wlan0 stop >/dev/null"); package/allwinner/wifimanager/src/core/wifi.c:static const char IFACE_DIR[] = "/etc/wifi/sockets"; package/allwinner/wifimanager/src/core/wifi.c:static const char SUPP_CONFIG_TEMPLATE[]= "/etc/wifi/wpa_supplicant_src.conf"; package/allwinner/wifimanager/src/core/wifi.c:static const char SUPP_CONFIG_FILE[] = "/etc/wifi/wpa_supplicant.conf"; package/allwinner/wifimanager/src/core/wifi.c:static const char CONTROL_IFACE_PATH[] = "/etc/wifi/sockets"; package/allwinner/wifimanager/src/core/wifi.c: strncpy(cmd, "/etc/wifi/wifi start", 511); package/allwinner/wifimanager/src/core/wifi.c: system("/etc/wifi/wifi stop"); package/allwinner/wifimanager/src/daemon/wifid_cmd_handle.c: system("/etc/init.d/wifi_daemon start"); package/allwinner/wifimanager/src/daemon/wifid_cmd_handle.c: system("/etc/init.d/wifi_daemon stop"); ubuntu:/opt/D1/tina_d1_open$ ubuntu:/opt/D1/tina_d1_open$
Latest posts made by ubuntu
-
一个 Linux下非对称加密demo,ubuntu18.04验证通过
生成密钥对:
openssl genrsa -out private_key.pem 2048 openssl rsa -in private_key.pem -outform PEM -pubout -out public_key.pem
#include <stdio.h> #include <string.h> #include <openssl/rsa.h> #include <openssl/pem.h> int main() { // 加载RSA密钥对 RSA *rsa_keypair = RSA_new(); FILE *private_key_file = fopen("private_key.pem", "r"); PEM_read_RSAPrivateKey(private_key_file, &rsa_keypair, NULL, NULL); fclose(private_key_file); // 加载公钥 RSA *rsa_public_key = RSA_new(); FILE *public_key_file = fopen("public_key.pem", "r"); PEM_read_RSA_PUBKEY(public_key_file, &rsa_public_key, NULL, NULL); fclose(public_key_file); // 明文数据 char *plaintext = "Hello, world!"; // 分配内存保存加密后的数据 int plaintext_len = strlen(plaintext); int encrypted_len = RSA_size(rsa_public_key); unsigned char *encrypted_data = (unsigned char *)malloc(encrypted_len); // 加密数据 int result = RSA_public_encrypt(plaintext_len, (unsigned char *)plaintext, encrypted_data, rsa_public_key, RSA_PKCS1_PADDING); if (result == -1) { printf("Error: RSA_public_encrypt failed!\n"); return -1; } // 输出加密后的数据 printf("Encrypted data: "); for (int i = 0; i < result; i++) { printf("%02x", encrypted_data[i]); } printf("\n"); // 分配内存保存解密后的数据 int decrypted_len = RSA_size(rsa_keypair); unsigned char *decrypted_data = (unsigned char *)malloc(decrypted_len); // 解密数据 result = RSA_private_decrypt(encrypted_len, encrypted_data, decrypted_data, rsa_keypair, RSA_PKCS1_PADDING); if (result == -1) { printf("Error: RSA_private_decrypt failed!\n"); return -1; } // 输出解密后的数据 printf("Decrypted data: %s\n", decrypted_data); // 释放内存 free(encrypted_data); free(decrypted_data); RSA_free(rsa_keypair); RSA_free(rsa_public_key); return 0; }
编译指令:
gcc -o rsa_example rsa_example.c -lcrypto
运行:
./rsa_example Encrypted data: 831bbcc94a2f5b30b605849d4756273b7d88d4995f2a2688f26aab81ef3ab992e7fcebe0530e8c0d5c4f889313648f319d55e2321d48edec4e1760959ca24b168 2d0e06911c3e1f8e94357f10b88f2fd6a0e3b1978a8ce6252de849d410f36b1123d7a4a66913eb1bd6c8096fb80f15bda150530a77f6aace39008f35bf7873d11a4903fa0d97647a6 18630b7781732a81d72e17771c60cf343b18565f1e49422dcd2de33cb4f18693a1def0c9b029ec6d1b96991bde6e55b3bdd972391df3c403c13fe27b38df75b4aeb963ad34cd0d55b 26f810d0735017c0e93da288c12bcf71a9b08cacee9923843a506585b534b484ef63119fe813dbf90b9c85fd707ef Decrypted data: Hello, world!
-
Reply: awcast 如果用glibc编译失败
$ grep CWA_SetRes -r external/ external/awcast/src/wireless_display.c: CWA_SetRes(CWA_RES_MID); external/awcast/src/airplay/include/coolserver.h:int CWA_SetRes(int res); Binary file external/awcast/src/airplay/lib/lib32/openwrt-arm-musl/libcoolserver.so matches Binary file external/awcast/src/airplay/lib/lib32/openwrt-arm-musl/libcoolserver_s.a matches
只有 musl 实现了 CWA_SetRes,glibc没有实现。
-
awcast 如果用glibc编译失败
CFLAGS="-Os -pipe -march=armv7-a -mtune=cortex-a7 -mfpu=neon -fno-caller-saves -Wno-unused-result -mfloat-abi=hard -Wformat -Werror=format-security -fPIC -D_FORTIFY_SOURCE=2 -Wl,-z,now -Wl,-z,relro -DCONF_AWCAST_DLNA_ENABLE -DCONF_AWCAST_MIRACAST_ENABLE -DCONF_AWCAST_AIRPLAY_ENABLE -I/opt/H133/H133-lianhe/out/h133-p2/staging_dir/target/usr/include -I/opt/H133/H133-lianhe/out/h133-p2/staging_dir/target/include -I/opt/H133/H133-lianhe/prebuilt/gcc/linux-x86/arm/toolchain-sunxi-glibc/toolchain/usr/include -I/opt/H133/H133-lianhe/prebuilt/gcc/linux-x86/arm/toolchain-sunxi-glibc/toolchain/include " CXXFLAGS="-Os -pipe -march=armv7-a -mtune=cortex-a7 -mfpu=neon -fno-caller-saves -Wno-unused-result -mfloat-abi=hard -Wformat -Werror=format-security -fPIC -D_FORTIFY_SOURCE=2 -Wl,-z,now -Wl,-z,relro -DCONF_AWCAST_DLNA_ENABLE -DCONF_AWCAST_MIRACAST_ENABLE -DCONF_AWCAST_AIRPLAY_ENABLE -Wno-virtual-dtor -I/opt/H133/H133-lianhe/out/h133-p2/staging_dir/target/usr/include -I/opt/H133/H133-lianhe/out/h133-p2/staging_dir/target/include -I/opt/H133/H133-lianhe/prebuilt/gcc/linux-x86/arm/toolchain-sunxi-glibc/toolchain/usr/include -I/opt/H133/H133-lianhe/prebuilt/gcc/linux-x86/arm/toolchain-sunxi-glibc/toolchain/include " LDFLAGS="-L/opt/H133/H133-lianhe/out/h133-p2/staging_dir/target/usr/lib -L/opt/H133/H133-lianhe/out/h133-p2/staging_dir/target/lib -L/opt/H133/H133-lianhe/prebuilt/gcc/linux-x86/arm/toolchain-sunxi-glibc/toolchain/usr/lib -L/opt/H133/H133-lianhe/prebuilt/gcc/linux-x86/arm/toolchain-sunxi-glibc/toolchain/lib -specs=/opt/H133/H133-lianhe/build/hardened-ld-pie.specs -znow -zrelro " LIBS="" make -j1 -C /opt/H133/H133-lianhe/out/h133-p2/compile_dir/target/awcast/. AR="arm-openwrt-linux-gnueabi-ar" AS="arm-openwrt-linux-gnueabi-gcc -c -Os -pipe -march=armv7-a -mtune=cortex-a7 -mfpu=neon -fno-caller-saves -Wno-unused-result -mfloat-abi=hard -Wformat -Werror=format-security -fPIC -D_FORTIFY_SOURCE=2 -Wl,-z,now -Wl,-z,relro -DCONF_AWCAST_DLNA_ENABLE -DCONF_AWCAST_MIRACAST_ENABLE -DCONF_AWCAST_AIRPLAY_ENABLE" LD=arm-openwrt-linux-gnueabi-ld NM="arm-openwrt-linux-gnueabi-nm" CC="arm-openwrt-linux-gnueabi-gcc" GCC="arm-openwrt-linux-gnueabi-gcc" CXX="arm-openwrt-linux-gnueabi-g++" RANLIB="arm-openwrt-linux-gnueabi-ranlib" STRIP=arm-openwrt-linux-gnueabi-strip OBJCOPY=arm-openwrt-linux-gnueabi-objcopy OBJDUMP=arm-openwrt-linux-gnueabi-objdump SIZE=arm-openwrt-linux-gnueabi-size CROSS="arm-openwrt-linux-gnueabi-" ARCH="arm" CMAKE_COMMAND='/opt/H133/H133-lianhe/out/host/bin/cmake' CMAKE_DISABLE_cmake_check_build_system=1 ; make[4]: Entering directory '/opt/H133/H133-lianhe/out/h133-p2/compile_dir/target/awcast' make[5]: Entering directory '/opt/H133/H133-lianhe/out/h133-p2/compile_dir/target/awcast' make[6]: Entering directory '/opt/H133/H133-lianhe/out/h133-p2/compile_dir/target/awcast' make[6]: Leaving directory '/opt/H133/H133-lianhe/out/h133-p2/compile_dir/target/awcast' [ 28%] Built target tinyui make[6]: Entering directory '/opt/H133/H133-lianhe/out/h133-p2/compile_dir/target/awcast' make[6]: Leaving directory '/opt/H133/H133-lianhe/out/h133-p2/compile_dir/target/awcast' make[6]: Entering directory '/opt/H133/H133-lianhe/out/h133-p2/compile_dir/target/awcast' [ 35%] Linking C executable awcast CMakeFiles/awcast.dir/wireless_display.c.o: In function `wd_start_airplay': wireless_display.c:(.text+0x344): undefined reference to `CWA_SetRes' collect2: error: ld returned 1 exit status CMakeFiles/awcast.dir/build.make:303: recipe for target 'awcast' failed make[6]: *** [awcast] Error 1 make[6]: Leaving directory '/opt/H133/H133-lianhe/out/h133-p2/compile_dir/target/awcast' CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/awcast.dir/all' failed make[5]: *** [CMakeFiles/awcast.dir/all] Error 2 make[5]: Leaving directory '/opt/H133/H133-lianhe/out/h133-p2/compile_dir/target/awcast' Makefile:127: recipe for target 'all' failed make[4]: *** [all] Error 2 make[4]: Leaving directory '/opt/H133/H133-lianhe/out/h133-p2/compile_dir/target/awcast' Makefile:130: recipe for target '/opt/H133/H133-lianhe/out/h133-p2/compile_dir/target/awcast/.built' failed make[3]: *** [/opt/H133/H133-lianhe/out/h133-p2/compile_dir/target/awcast/.built] Error 2 make[3]: Leaving directory '/opt/H133/H133-lianhe/package/allwinner/homlet/awcast' package/Makefile:192: recipe for target 'package/allwinner/homlet/awcast/compile' failed make[2]: *** [package/allwinner/homlet/awcast/compile] Error 2 make[2]: Leaving directory '/opt/H133/H133-lianhe' package/Makefile:189: recipe for target '/opt/H133/H133-lianhe/out/h133-p2/staging_dir/target/stamp/.package_compile' failed make[1]: *** [/opt/H133/H133-lianhe/out/h133-p2/staging_dir/target/stamp/.package_compile] Error 2 make[1]: Leaving directory '/opt/H133/H133-lianhe' /opt/H133/H133-lianhe/build/toplevel.mk:304: recipe for target 'world' failed make: *** [world] Error 2 [2]+ Done $T/tools/build/buildserver --path $T 2> /dev/null 1>&2 #### make failed to build some targets (02:53 (mm:ss)) ####