Linux移植遇到的一些问题及解决方法(arm开发板)

M1 ARM架构下, linux安装mysql的方式及潜在问题解决 mac m1芯片的操作 阅读详情

1. 前言
   自上次研究嵌入式系统以后,已经过了12年了,这期间,linux内核和硬件都发生了非常大的变化,加这方面的开发人员相对较少,碰到一些问题,需要耗费比较多的时间和精力来搜索资料和自己研究,对于没于耐心和基础的人来说,确实不容易坚持下去。这方面的网上资料,有很多是培训机构或者爱好者发的,其正确性也需要验证才能知道,也有很多是以诈传诈,或者语焉不详,要处之处一笔跳过,或者语焉不详,要处之处一笔跳过,或干脆不写。另外,linux开发的问题,就是搭建环境比较麻烦,
库版本的兼容性有差别,经常遇到库不兼容,缺这个库少那个库的问题。 泛此种种,就需要靠自己,不断的尝试工,不断的测试和探索,反反复复做测试,其辛苦只有做过的人才知道,但是走过一遍之后,对底层技术和相关开发知识就有了更深入的认识了,付出也是值得的,同志们共勉吧。

2. 编译linux内核遇到的一些问题及对策

2.1 错误信息:
include/linux/if_pppox.h:24: included file 'linux/if_pppolac.h' is not exported
include/linux/if_pppox.h:25: included file 'linux/if_pppopns.h' is not exported
linux/kernel.h:65: userspace cannot reference function or variable defined in the kernel
include/linux/kernel.h:97: userspace cannot reference function or variable defined in the kernel
include/linux/quota.h:175: userspace cannot reference function or variable defined in the kernel
include/linux/soundcard.h:1054: userspace cannot reference function or variable defined in the kernel

解决方法:
编辑:include/linux/Kbuild
找到这一行:header-y += if_pppox.h 
在其下面加入如下两行:
header-y += if_pppolac.h
header-y += if_pppopns.h

2.2 错误信息:
Can't use 'defined(@array)' (Maybe you should just omit the defined()?) at kernel/timeconst.pl
解决方法:
打开 kernel/timeconst.pl

定位到以下内容:
@val = @{$canned_values{$hz}}; 
if (defined(@val)) { 
@val = compute_values($hz); 
} 
output($hz, @val); 
将if (defined(@val)) 改为if (@val),再次编译就可以通过了。

2.3 错误信息:
openssl/opensslv.h: No such file or directory错误的解决办法
解决方法:
缺少openssl库,找到相应库安装,比如,centos-7中,
yum install openssl-devel 

2.4 错误信息:
"mkimage" command not found - U-Boot images will not be built

解决方法:
这是生成uImage时,要用于u-boot下的一个工具,这是安装u-boot时的会
生成的工具,对u-boot编译后,uboot的tools目录下有这个工具。

2.5 错误信息:
---[ end Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)

原因分析及对策:这是一个让新手或者没见识过的人非常头痛的问题,很长时间没办法下手,根本不知道原因是什么。但是看信息,好像又是和文件系统相关,挂不上root 文件系统,unknown-block(0,0)又似乎和flash块相关,经过反复对比和测试,发现有2个原因:
(1) 对于支持设备树的linux内核而言,没有将emmmc的相关配置加进设备树,内核启动的时候都看不到emmc相关信息,或者是设备树配置不正确,这个需要寻求硬件厂家支持,给到相应的资料和电路原理路;
(2) linux内核启动参数问题,这也是一个很容易忽略的地方,这个坑也是隐藏的比较深,一不小心就错过了,比如以下配置
就会出现这个问题:
Kernel command line: 
root=/dev/mmcblk1p2 rw console=ttySAC2,115200 init=/linuxrc earlyprintk
而正确的配置是:
root=/dev/mmcblk1p2 rw console=ttySAC2,115200 init=/linuxrc rootwait
即加上这个rootwait,至于为什么,可以参看内核代码。这也太坑了,这个问题足
以让你折腾3天3夜。

2.6 关于烧写程序fastboot的问题
在有些烧写程序启动时,如果不在串口输入fastboot命令,pc是识别不到otg区动的,而扯蛋的是有些版本的烧写程序输入fastboot回车即可,而有的版本输入fastboot会提示:
fastboot <USB_controller>
    - run as a fastboot usb device
要输入:fastboot 0 回车,才会影响命令。

2.7 错误信息:
drivers/scsi/osd/osd_initiator.c: In function ‘build_test’:
drivers/scsi/osd/osd_initiator.c:67:2: error: size of unnamed array is negative
  BUILD_BUG_ON(sizeof(struct osdv2_cdb) != OSD_TOTAL_CDB_LEN);
  ^
drivers/scsi/osd/osd_initiator.c:68:2: error: size of unnamed array is negative
  BUILD_BUG_ON(sizeof(struct osdv1_cdb) != OSDv1_TOTAL_CDB_LEN);
  ^
make[3]: *** [drivers/scsi/osd/osd_initiator.o] Error 1
make[2]: *** [drivers/scsi/osd] Error 2
make[1]: *** [drivers/scsi] Error 2
make: *** [drivers] Error 2

解决方法:具体原因先没时间分析,打开文件:drivers/scsi/osd/osd_initiator.c

//注释掉67,68两行
     63 static inline void build_test(void)
     64 {
     65         /* structures were not packed */
     66         BUILD_BUG_ON(sizeof(struct osd_capability) != OSD_CAP_LEN);
     67         //BUILD_BUG_ON(sizeof(struct osdv2_cdb) != OSD_TOTAL_CDB_LEN);
     68         //BUILD_BUG_ON(sizeof(struct osdv1_cdb) != OSDv1_TOTAL_CDB_LEN);
     69 }

2.8 错误信息:
missing bus glue for ehci-hcd
解决方法:
如果你的硬件不支持这个特性,就在内核配置中去掉这一项:
make menuconfig
Device Drivers -> USB support -> EHCI HCD(usb 2.0 support) 去掉,硬件不支持

2.9 错误信息:
arch/arm/plat-samsung/dev-i2c0.c:69: undefined reference to `s3c_i2c0_cfg_gpio'
解决方法:
对于s5pv210的核片,在内核中没有选中smdkv210,编译就会出现这个莫名奇妙的错误。

2.10 错误信息:
hival/rpm.c: In function ‘fileaction_setowngrp’:
archival/rpm.c:385:2: warning: ignoring return value of ‘chown’, declared with attribute warn_unused_result [-Wunused-result]
  chown(filename, uid, gid);
  ^
In file included from /usr/include/bits/byteswap.h:35:0,
                 from /usr/include/byteswap.h:24,
                 from include/platform.h:107,
                 from include/libbb.h:13,
                 from archival/rpm.c:10:
archival/rpm.c: In function ‘rpm_getint’:
archival/rpm.c:351:10: error: invalid 'asm': invalid operand for code 'w'
   return ntohs(*(int16_t*)tmpint);
          ^
make[1]: *** [archival/rpm.o] Error 1
make: *** [archival] Error 2

错误信息分析:以上看起来是因为ntohs的问题,特别是这一句:
invalid 'asm': invalid operand for code 'w'
其根本原因,是交叉编译工具跑到主机的头文件搜索中去了,而交叉编译工具应在交叉编译工具的配置头文件中去搜索。看看这路径:In file included from /usr/include/bits/byteswap.h:35:0,应将/etc/profile中的C_INCLUDE_PATH先去掉,不要让交叉工具跑去主机目录下去搜。修改后,再将查看搜索路径:查看头文件搜索路径
arm-linux-gnueabihf-gcc -E -v -

/usr/local/arm-linux/lib/gcc/arm-linux-gnueabihf/4.9.1/include
这样显示就对了。

2.11 错误信息:
In file included from /usr/local/arm-linux/arm-linux-gnueabihf/include/stdlib.h:959:0,
                 from include/libbb.h:24,
                 from libbb/login.c:14:
/usr/local/arm-linux/arm-linux-gnueabihf/include/bits/stdlib.h: In function ‘wctomb’:
/usr/local/arm-linux/arm-linux-gnueabihf/include/bits/stdlib.h:90:3: error: #error "Assumed value of MB_LEN_MAX wrong"
 # error "Assumed value of MB_LEN_MAX wrong"
 
原因分析及对策:在网上查到以下几句:

By default the limits.h file is not properly configured, so you need to patch it.To fix the problem you have to go inside GCC's source directory and type the command:

cd $GCC_VERSION
cat gcc/limitx.h gcc/glimits.h gcc/limity.h > \
`dirname $(${TARGET}-gcc -print-libgcc-file-name)`/include-fixed/limits.h

cat gcc/limitx.h gcc/glimits.h gcc/limity.h > \
`dirname $(${TARGET}-gcc -print-libgcc-file-name)`/include-fixed/limits.h


This adds a #include_next <limits.h> to the bottom which eventually picks up the right header
   ^
   
    88 #define __STDLIB_MB_LEN_MAX     16
     89 #if defined MB_LEN_MAX && MB_LEN_MAX != __STDLIB_MB_LEN_MAX
     90 # error "Assumed value of MB_LEN_MAX wrong"
     91 #endif

glimits.h 中有这么一句
/* Maximum length of a multibyte character.  */
#ifndef MB_LEN_MAX
#define MB_LEN_MAX 1
#endif
这里怎么定义为1呢,改为16试试?也就是两个地方定义不一致

多字节字符最大长度,改大是最好的。

2.12 错误信息:
Error: unrecognized/unsupported machine ID (r1 = 0x00000d8a).

Available machine support:

ID (hex)        NAME
ffffffff        Generic DT based system
ffffffff        Samsung S5PC110/S5PV210-based board

Please check your kernel config and/or bootloader.

原因分析:对于s5pv210的板子,这是硬件厂家的u-boot中将machine ID设置为0x00000d8a,而内核编译配置时,没有选中SMDKV210这个固件编译,还有是应将arch/arm/tools/mach-types 这个文件中定义的smdkv210 的值改为3466(0x00000d8a),强烈鄙视这些无良开发板厂家,埋了这么多坑,在文档中只字不提,你问他他还不愿意说清楚。

ARM9开发板Linux内核移植与机器码问题解决 嵌入式Linux开发中,内核移植是连接硬件与操作系统的关键技术环节。其核心原理在于通过机器码机制实现Bootloader与内核的匹配验证,这涉及到ARM架构的启动流程和硬件抽象层设计。在ARM9开发板等嵌入式场景中,正确处理机器码问题能确保系统稳定启动,而闭源Bootloader带来的机器码不透明问题则需要通过逆向工程或反复试验解决。以FriendlyARM MINI2451开发板为例,通过分析ARMv5TE架构特性、配置交叉编译工具链、修改内核Kconfig和Makefile等步骤,最终实现Linux 3 阅读详情

相关推荐

1.3 SSH移植日志

之前打包了一个精简的linuxos,本身想基于这个os进行简单的调试,以便更充分的了解内核的原理。然后再调试内存子系统时,发现无法从外部访问该os,没有ssh,没有adb,也无法用串口,所以这部分是为了将ssh移植打包到我们的os当中,以满足访问虚拟机或者开发板进行调试。后期也会考虑移植adb,并在开发板上使用串口调试。

从0到1,突破自己 902

正点原子OpenCV编译失败错误160.提示invalid 'asm': invalid operand for code 'w'

原因是cmake 设置库错误,应该选择仅仅在本目标中搜索,

qq1273753254的专栏 1324

无需UMAT:基于Abaqus内置模型实现形状记忆聚合物结构的热-力耦合仿真

本文详细介绍了如何利用Abaqus内置模型实现形状记忆聚合物(SMP)的热-力耦合仿真,无需编写复杂的UMAT子程序。通过广义Maxwell模型和Neo-Hookean模型的组合应用,结合完整的热-力耦合分析流程,帮助工程师高效模拟SMP的形状记忆行为。文章还提供了工程应用案例和常见问题解决方案,为相关领域的研究和设计提供实用指导。

weixin_34005090的博客 117

arm编译PHP报错error: invalid asm: invalid operand prefix %c

报错error: invalid 'asm': invalid operand prefix '%c' 原因:gcc版本过低,需要升级版本 编译器支持__asm__ goto不支持%c这个新特性 解决办法升级gcc yum install -y devtoolset-8-toolchain scl enable devtoolset-8 bash gcc --version ...

SRE运维 网络 系统 安全 1157

保姆级教程:DBeaver社区版安装与驱动配置(附阿里云镜像解决下载超时)

本文提供DBeaver社区版的保姆级安装教程,涵盖版本选择、安装路径设置到驱动配置优化。特别针对国内用户遇到的下载超时问题,详细介绍了如何配置阿里云镜像加速驱动下载,确保高效连接MySQL等主流数据库。

weixin_30430169的博客 480

智能驾驶功能软件平台设计规范 第一部分:系统架构

智能驾驶功能软件平台设计规范 第一部分:系统架构2020-07-29 发布。

爱是与世界平行 6744

编译FFmpeg遇到的问题,放弃了

项目里头需要用到FFMPEG,网上GOOGLE到的BLOG基本都一样。因为FFMPEG每个版本变化都很大,所以网上的资料也只能做参考,主要还是靠自己慢慢排错,手动修改config.h或者添加删减代码。本人C++水平太有限了,加上时间不够,最后决定放弃移植。 最后遇到的错误如下: /home/kexi/workspace/android/HelloJni/jni/ffmpeg/libswscal

lomotion的专栏 2067

声纹识别实战:用Python从零搭建一个简易声纹验证系统(附完整代码)

本文是一份详细的声纹识别实战指南,教你使用Python从零搭建一个简易的声纹验证系统。文章涵盖了从音频采集、预处理、MFCC特征提取,到基于高斯混合模型(GMM)的建模与验证全流程,并提供了完整的代码实现,帮助开发者快速掌握这项生物特征识别核心技术。

ik6789012的博客 235

linux kernel内核的头文件获取、安装等方法,手动计算添加version.h

交叉编译时经常会用到这些头文件。 下载合适版本的linux 地址: mirrors.aliyun.com/linux-kernel/ mirrors.edge.kernel.org/pub/linux/kernel/ 解压: biren@ubuntu:~/crossbuild/src$ tar jxf linux-3.9.tar.bz2 配置内核: biren@ubuntu:~/crossbuild/src/linux-3.9$ make ARCH=arm menuconfig HOSTCC sc

birencs的博客 1万+

为什么我的 Spark Executor / Yarn Container 只有一个vCore?

在很多集群里,在关闭了Spark的DynamicAllocation的前提下(避免自动申请空闲资源,干扰测试结果),都会观察到:提交Spark作业时,申请 1 个 driver + n 个 executor 会在Yarn上会对应创建 n+1 个 container,但是每个container只有一个vCore,通过--driver-cores和--executor-cores设定的vCore数都未奏效。有人会因此错误的认为Yarn上的一个vCore对应一个Spark的executor,这是非常错误的,正确的

Laurence的技术博客 917

嵌入式编程模型 | 原型模式

本文介绍了原型模式在嵌入式传感器网络中的应用。原型模式通过复制现有对象创建新实例,避免了重复初始化开销,适用于设备配置克隆、状态复制等场景。文章以传感器网络为例,展示了原型模式的结构(抽象原型类、具体原型类、客户端)和实现方式,通过C语言代码演示了温度/湿度传感器的克隆过程。该模式能有效提升嵌入式系统资源复用效率,实现快速部署相似配置的传感器节点,同时保持内存优化和配置灵活性。

嵌入式大杂烩 148

移植QT到ARM平台

经过为期3天的编译、移植,终于将Qt5.7成功移植到iTop4412开发板,板载exynos4412处理器,基于ARM Cortex-A9内核。因此,本篇教程以iTop4412示例,适用于Qt5.7在ARM_Linux平台上的移植。 ----------------------------------------------------------------------------------...

van38686061的博客 1995

人工智能混合编程实践:C++调用封装好的DLL进行异常检测推理

C++、Python、ONNX、人工智能、异常检测、Anomalib 2.1.0

FriendshipTang的博客 172

移植Linux-2.6内核到蓝海薇芯开发板

最近买了蓝海薇芯的arm9 s3c2410 开发板,但是上边带的内核是linux-2.4内核,自己虽然比较菜,但也知道2.4的内核都是老黄历了,所以打算移植个2.6的内核到板子上去。首先是熟悉一下开发板自己带的功能吧。先借个图吧,大部分开发板的loader好像功能都做的差不多(网上查了几个好像是这样)  看内核移植的书有一段时间了,感觉总是不得要领,可能是泛泛看书效果不好吧,还是边

lkkjob的专栏 1008

C++程序发生内存越界,一定会导致程序崩溃吗?详解内存越界

内存越界是否一定会导致程序崩溃吗?详解内存越界

dvlinker的技术专栏 1万+

LinePhone3.2.7(android端最新版本) sip客户端

SIP客户端For android:LinePhone3.2.7(最新版本),官网地址:http://www.linphone.org/

ARM-Linux移植攻略

原创作品,转载请标明出处http://blog.youkuaiyun.com/yming0221/article/details/6581719 持续更新中....... ubuntu下在连接arm开发板的情况下,使用无线网卡上网设置基于S3C2440的busybox的移植 yaffs根文件系统制作FL2440下触摸屏校准 Mplayer的移植 ARM 开发板 NAND FLASH空间不足解决方法

hwmt2012的专栏 669

lwip-2.0.3

lwip是瑞典计算机科学院(SICS)的Adam Dunkels 开发的一个小型开源的TCP/IP协议栈。实现的重点是在保持TCP协议主要功能的基础上减少对RAM 的占用。

arm linux系统中移植编译iw命令的过程和遇见问题的解决方法

使用背景: 由于将arm板上的USB -wifi的模式修改为sta的模式,数据的传输延时太大。所以需要在开机的时候执行:./iw wlan0 set power_save off 。用以减小延时。会用到iw命令,需要额外的移植。 编译环境: Ubuntu 运行环境: 基于rv1108的linux平台(linux内核3.10) 编译过程: 参考:https://blog.csdn....

仗劍走天涯 1302

WINCC7.3破解文件

WINCC7.3硬件够破解文件,有需要的下载!WINCC7.3硬件够破解文件,有需要的下载!

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

python移植到arm_python移植到arm平台

1. 交叉编译Python见Cross Compiling Python for Embedded Linux本文引用地址:http://www.eepw.com.cn/article/201611/317666.htmCC=arm-linux-gcc CXX=arm-linux-g++ AR=arm-linux-ar RANLIB=arm-linux-ranlib ./configure --h...

weixin_42300162的博客 512

移植 sshd到arm开发板 (修正版)

引言 之前移植sshd到arm开发板,断断续续花了好长时间,但是ssh登录时还总是提示permission denied please try again,网上说的方法都试过了,还是无法解决,让人非常郁闷。当时用的交叉编译器是arm-linux-gcc 3.4.1,busybox用的是1.15.2版本。后来改用arm-linux-gcc  4.4.3,busybox用的是1.19.2版本,很快就

崔建忠的专栏 4696

【引用】Linux应用程序开发(一)---移植thttpd+Sqlite3+PHP5到arm linux(2)

移植环境(红色粗字体字为修改后内容,蓝色粗体字为特别注意内容) 1,主机环境:VMare下CentOS 5.5 ,1G内存。 2,集成开发环境:Elipse IDE 3,编译编译环境:arm-linux-gcc v4.4.3,arm-none-linux-gnueabi-gcc v4.5.1。 4,开发板:mini2440,2M nor flash,128M nand flash。 5,

liuqiang_mail的专栏 1258

ARM平台Linux内核移植实战案例详解

深入讲解在arm平台环境下完成Linux内核移植的关键步骤与常见问题,结合实际案例剖析配置、编译与启动全过程,帮助开发者快速掌握arm平台系统级开发核心技能。

weixin_35705784的博客 435

QT5.6.2在ARM-S5PV210开发板上不能显示汉字

在linux下正常的程序,移植到ARM上,中文不能显示。网上好多介绍,一头雾水。查看其中话题是关于中文显示的(http://www.qtcn.org/bbs/simple/?t55852.html)。经过实践能行。过程如下: 看ARM上的环境:env查看环境变量,发现红色标记位置 注意红字。把虚拟机里面/usr/shared/fonts/truetype/arphic(这种字体叫文鼎字体)里面的东西拷到开发板里就ok了。arphic目录下的二个字库文件放到QT的字库目录中 OK QT5...

世间所有的相遇都是久别重逢 1078

2440 java_移植java虚拟机到EM2440开发板

threwjava.lang.ExceptionInInitializerError*threwjava.lang.NoClassDefFoundError: StaticEc1 = class [LTest;c2 = class [[LTest;c3 = class [LC;c4 = class [[LC;c1.modifiers = 1041c2.modifiers = 1041c3.modi...

weixin_39644952的博客 129

gdb linux arm low.c,gdb在arm-linux上的移植

以前一直用打桩法来调试arm-linux程序,即通过添加printf()来调试。这一方法在通常情况下是很有用,而且也是很简单实用的。但是对于一些很特殊很隐蔽的错误,在这时这个方法可能就不太管用了,因为你总不能在每条语句之后都加上printf()吧。而且对于多线程的大中型应用程序,如果你不熟悉编译器,又或者你本身就是新手的话,程序的一个小bug就有可能让你几天睡不好觉。就像今天我遇到的一个错误,同样...

weixin_28751115的博客 297

load html qt Linux,Qt embeded 4.5.3 在ARM-Linux的移植

移植这个是发现用Qt 4.6 for X86移植到ARM-Linux,理论上移植没太多问题,但实际碰到太多问题,而且QT官网上有针对Embeded Linux 的qt 4.5.3下载。这个资料也全。因此首先用这个版本试试。然后再来移植4.6的版本。下载http://get.qt.nokia.com/qt/source/qt-embedded-linux-opensource-src-4.5.3.t...

weixin_42358409的博客 119

移植安装ModBus到ARM开发板

目录 一、源码下载 1、libmodbus官网 2、下载 二、交叉编译 1、解压 2、创建安装目录 3、进入解压的目录 4、配置编译选项 5、编译 6、安装 7、生成动态链接库 三、移植到ARM开发板 1、复制文件到ARM开发板 四、创建测试程序 1、创建测试程序C文件 2、复制库中头文件 3、交叉编译 4、复制可执行文件到开发板 五、安装ModbusP...

菜菜哥的杂货铺 4095
上一篇: 从源码构建gcc交叉编译环境
下一篇: 编译isl和cloog库出现:fatal error: gmp.h: No such file or directory
ComputerInBook
博客等级 码龄19年 1168粉丝 464原创
评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值