No init found:嵌入式Linux文件系统加载失败

问题描述

文件系统加载不成功,报错:No init found,如图(其中包含调试打印)
图片说明

制作材料及过程

硬件:s3c2440芯片,256M Nand Flash

软件:用了现成的boot,内核是2.6.32,busybox是1.13.3,编译器是arm-linux-gcc 4.4.3,文件映像制作工具为mkyaffs2image-128M(由于FLASH使用的是256M)
制作过程:编译内核、busybox,制作/dev/console和/dev/null的node,制作/lib库,编写/etc/inittab

初步分析

编译均成功,从打印来看,boot成功引导内核,内核也已经起来了,且进入了kernel_init的init_post

图片说明

也就是说,几个run_init_process函数都没跑成功,但文件系统中/sbin/init是存在的

图片说明

跟踪run_init_process函数:run_init_process-->kernel_execve-->do_execve-->count,是在count处出错了,我把argc打出来是-14

图片说明

进入count函数,发现时get_user出错了,EFAULT就是14

图片说明

get_user是内核态用来从用户态读数据的函数,但里面已经是嵌入汇编代码了,实在分析不了了……

哪位高手可以帮忙分析一下,或者以前碰到类似情况,知道如何解决的,谢谢!

3个回答

没有必要深入内核去分析这个过程,只要检查以下几点就行了:
1> 文件系统的根目录下存在linuxrc文件, 可以是脚本,也可以是可执行文件,还可以是符号链接(但不能跨文件系统)
2> /linuxrc具有可执行属性,且真正可执行
3> 如果/linuxrc是脚本文件,确认它的解释器也位于根目录下,并且可以正常使用

另外,如果是脚本的话,它的最后一行应当是:
exec /sbin/init

u011670962
肯德德 谢谢!确实是busybox编译有问题,我按照厂家提供的配置重新config了一下然后重新编译,就可以了
一年多之前 回复

从这一句:

Failed to execute /linuxrc. Attempting defaults ...

目前的问题是无法正确执行init进程。你指定的init进程是应该是**/linuxrc**吧,而它是指向bin/busybox的软连接,也就是Failed to execute bin/busybox

建议你仔细检查下busybox是否存在问题:
1. CPU架构是否正确(arm, arm64, ...)
2. 链接方式(动态、静态)
3. 其他

u011670962
肯德德 谢谢!确实是busybox编译有问题,我按照厂家提供的配置重新config了一下然后重新编译,就可以了
一年多之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
Failed to execute /init. Attempting defaults... Kernel panic - not syncing: No init found.
请问出现这个问题要怎么解决?是坏块问题吗? 我用TQ210的板子 linux 3.0.8内核 arm-linux-gcc 4.4.6 u-boot2014.04 yaffs: dev is 32505859 name is "mtdblock3" rw yaffs: yaffs: Attempting MTD mount of 31.3,"mtdblock3" yaffs: block 250 is bad yaffs: block 2910 is bad yaffs: block 3990 is bad yaffs: yaffs_read_super: is_checkpointed 0 VFS: Mounted root (yaffs2 filesystem) on device 31:3. Freeing init memory: 176K Failed to execute /init. Attempting defaults... Kernel panic - not syncing: No init found. Try passing init= option to kernel. See Linux Documentation/init.txt for guidance. 在另一台机子上可以成功运行 但是我烧录到自己机子就出现了此问题
MPU-9150九轴传感器,Failed to init IMU: -1 No valid compass calibration data?
1、用MPU9150九轴传感器采集人体姿态数据时,之前一直都能将九个数据点输出到串口监视器中,但突然有一天总是报错,传感器无法读取数据 2、烧录的代码如下: #include <LiquidCrystal.h> #include <lmic.h> //////////////////////////////////////////////////////////////////////////// // // This file is part of RTIMULib-Arduino // // Copyright (c) 2014-2015, richards-tech // // Permission is hereby granted, free of charge, to any person obtaining a copy of // this software and associated documentation files (the "Software"), to deal in // the Software without restriction, including without limitation the rights to use, // copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the // Software, and to permit persons to whom the Software is furnished to do so, // subject to the following conditions: // // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A // PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include <Wire.h> #include "I2Cdev.h" #include "RTIMUSettings.h" #include "RTIMU.h" #include "RTFusionRTQF.h" #include "CalLib.h" #include <EEPROM.h> RTIMU *imu; // the IMU object RTFusionRTQF fusion; // the fusion object RTIMUSettings settings; // the settings object // DISPLAY_INTERVAL sets the rate at which results are displayed #define DISPLAY_INTERVAL 0 // interval between pose displays // SERIAL_PORT_SPEED defines the speed to use for the debug serial port #define SERIAL_PORT_SPEED 115200 unsigned long lastDisplay; unsigned long lastRate; int sampleCount; RTQuaternion gravity; void setup() { int errcode; Serial.begin(SERIAL_PORT_SPEED); Wire.begin(); imu = RTIMU::createIMU(&settings); // create the imu object Serial.print("ArduinoIMU starting using device "); Serial.println(imu->IMUName()); if ((errcode = imu->IMUInit()) < 0) { Serial.print("Failed to init IMU: "); Serial.println(errcode); } if (imu->getCalibrationValid()) Serial.println("Using compass calibration"); else Serial.println("No valid compass calibration data"); lastDisplay = lastRate = millis(); sampleCount = 0; gravity.setScalar(0); gravity.setX(0); gravity.setY(0); gravity.setZ(1); } void loop() { unsigned long now = millis(); unsigned long timeTemp = millis(); unsigned long delta; RTVector3 realAccel; RTVector3 realGyro; RTVector3 realCompass; RTQuaternion rotatedGravity; RTQuaternion fusedConjugate; RTQuaternion qTemp; int loopCount = 0; while (imu->IMURead()) { // get the latest data if ready yet // this flushes remaining data in case we are falling behind if (++loopCount >= 10) continue; fusion.newIMUData(imu->getGyro(), imu->getAccel(), imu->getCompass(), imu->getTimestamp()); // do gravity rotation and subtraction // create the conjugate of the pose fusedConjugate = fusion.getFusionQPose().conjugate(); // now do the rotation - takes two steps with qTemp as the intermediate variable qTemp = gravity * fusion.getFusionQPose(); rotatedGravity = fusedConjugate * qTemp; // now adjust the measured accel and change the signs to make sense realAccel.setX(-(imu->getAccel().x() - rotatedGravity.x())); realAccel.setY(-(imu->getAccel().y() - rotatedGravity.y())); realAccel.setZ(-(imu->getAccel().z() - rotatedGravity.z())); realGyro.setX(-(imu->getGyro().x())); realGyro.setY(-(imu->getGyro().y())); realGyro.setZ(-(imu->getGyro().z())); realCompass.setX(-(imu->getCompass().x())); realCompass.setY(-(imu->getCompass().y())); realCompass.setZ(-(imu->getCompass().z())); sampleCount++; if ((delta = now - lastRate) >= 1000) { Serial.print("Sample rate: "); Serial.print(sampleCount); if (!imu->IMUGyroBiasValid()) Serial.println(", calculating gyro bias"); else Serial.println(); sampleCount = 0; lastRate = now; } /* if ((now - lastDisplay) >= DISPLAY_INTERVAL) { lastDisplay = now; RTMath::display("Accel:", realAccel); RTMath::display("Gyro:", realGyro); RTMath::display("Compass:", realCompass); Serial.println(); }*/ /*////////////////////正常输出//////////////*/ /*RTMath::display("Accel:", realAccel); RTMath::display("Gyro:", realGyro); RTMath::display("Compass:", realCompass); Serial.println();*/ /******************串口输出************/ RTMath::display( "",realAccel); RTMath::display("", realGyro); RTMath::display("",realCompass); Serial.println(); delay(25); } } 3、编译没有报错,但是打开串口监视器的时候出现: ArduinoIMU starting using device MPU-9250 Failed to init IMU: -1 No valid compass calibration data 4、尝试过的解决方法: a、更换连接线 b、更换库文件
linux内核在哪里加载根文件系统?
linux内核启动后,会对根文件系统进行加载,但是内核是在哪里对根文件进行加载的? ``` List of all partitions: 1f00 256 mtdblock0 (driver?) 1f01 64 mtdblock1 (driver?) 1f02 6272 mtdblock2 (driver?) 1f03 1408 mtdblock3 (driver?) 1f04 64 mtdblock4 (driver?) 1f05 64 mtdblock5 (driver?) 1f06 64 mtdblock6 (driver?) No filesystem could mount root, tried: squashfs Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(31,2) ``` 上面是串口打印的信息,我对No filesystem could mount root, tried:,这句话进行查找,定位到了mips-linux-2.6.31\init\Do_mounts.c_这个文件中 ``` printk("List of all partitions:\n"); printk_all_partitions(); printk("No filesystem could mount root, tried: "); for (p = fs_names; *p; p += strlen(p)+1) printk(" %s", p); printk("\n"); ``` 之后我就看不懂这些了,根文件系统是在哪里加载进来的??? 而且我在Uboot下,进行烧写时,是将根文件系统写到0x9f050000这个位置,但是在内核里面是如何指定的??
类里面使用input获得的值怎么传递给这个类下的方法去使用?
前提,我想写一个通过输入半径,求算圆的面积跟周长的类。但是发现在一个类下好像实现不了,(我是用2个类来实现的)求指点。。。 class r: r = float(input('请输入圆的半径:')) class yuan(r): def __init__(self): self.pi = 3.14 def s(self): s = self.pi * r.r * r.r print('圆的面积为{}'.format(s)) def l(self): l = 2 * self.pi * r.r print('圆的周长为{}'.format(l)) a=yuan() a.s() a.l()
/sbin 目录下的系统命令无法用了 ModuleNotFoundError: No module named 'CommandNotFound'
配置完linux系统的python环境后 /sbin 目录下的系统命令无法用了 /bin下的命令正常 ``` python@ubuntu:~$ ifconig Traceback (most recent call last): File "/usr/lib/command-not-found", line 27, in <module> from CommandNotFound.util import crash_guard ModuleNotFoundError: No module named 'CommandNotFound' python@ubuntu:~$ init Traceback (most recent call last): File "/usr/lib/command-not-found", line 27, in <module> from CommandNotFound.util import crash_guard ModuleNotFoundError: No module named 'CommandNotFound' python@ubuntu:~$ ^C python@ubuntu:~$ ``` 我把CommandNotFound文件夹拷贝到command-not-found文件同目录下页无用
嵌入式2.6.32内核挂载根文件系统root.cramfs失败
Copy linux kernel from 0x00030000 to 0x30008000, size = 0x00300000 ... done zImage magic = 0x016f2818 Setup linux parameters at 0x30000100 linux command line is: "noinitrd root=/dev/mtdblock3 init=/linuxrc console=ttyS"MACH_TYPE = 193 NOW, Booting Linux...... Uncompressing Linux.............................................................Linux version 2.6.32.63 (rival@ubuntu) (gcc version 4.4.3 (ctng-1.6.1) ) #7 Sat4CPU: ARM920T [41129200] revision 0 (ARMv4T), cr=c0007177 CPU: VIVT data cache, VIVT instruction cache Machine: SMDK2410 ATAG_INITRD is deprecated; please update your bootloader. Memory policy: ECC disabled, Data cache writeback CPU S3C2410A (id 0x32410002) S3C24XX Clocks, (c) 2004 Simtec Electronics S3C2410: core 200.000 MHz, memory 100.000 MHz, peripheral 50.000 MHz CLOCK: Slow mode (1.500 MHz), fast, MPLL on, UPLL on Built 1 zonelists in Zone order, mobility grouping on. Total pages: 16256 Kernel command line: noinitrd root=/dev/mtdblock3 init=/linuxrc console=ttySAC0sPID hash table entries: 256 (order: -2, 1024 bytes) Dentry cache hash table entries: 8192 (order: 3, 32768 bytes) Inode-cache hash table entries: 4096 (order: 2, 16384 bytes) Memory: 64MB = 64MB total Memory: 60664KB available (3708K code, 342K data, 156K init, 0K highmem) Hierarchical RCU implementation. NR_IRQS:99 irq: clearing pending ext status 00080000 irq: clearing subpending status 00000002 Console: colour dummy device 80x30 console [ttySAC0] enabled Calibrating delay loop... 99.53 BogoMIPS (lpj=248832) Mount-cache hash table entries: 512 CPU: Testing write buffer coherency: ok NET: Registered protocol family 16 S3C Power Management, Copyright 2004 Simtec Electronics S3C2410: Initialising architecture S3C24XX DMA Driver, (c) 2003-2004,2006 Simtec Electronics DMA channel 0 at c4808000, irq 33 DMA channel 1 at c4808040, irq 34 DMA channel 2 at c4808080, irq 35 DMA channel 3 at c48080c0, irq 36 bio: create slab <bio-0> at 0 SCSI subsystem initialized usbcore: registered new interface driver usbfs usbcore: registered new interface driver hub usbcore: registered new device driver usb s3c-i2c s3c2410-i2c: slave address 0x10 s3c-i2c s3c2410-i2c: bus frequency set to 97 KHz s3c-i2c s3c2410-i2c: i2c-0: S3C I2C adapter NET: Registered protocol family 2 IP route cache hash table entries: 1024 (order: 0, 4096 bytes) TCP established hash table entries: 2048 (order: 2, 16384 bytes) TCP bind hash table entries: 2048 (order: 1, 8192 bytes) TCP: Hash tables configured (established 2048 bind 2048) TCP reno registered NET: Registered protocol family 1 RPC: Registered udp transport module. RPC: Registered tcp transport module. RPC: Registered tcp NFSv4.1 backchannel transport module. NetWinder Floating Point Emulator V0.97 (extended precision) JFFS2 version 2.2. (NAND) (SUMMARY) .. 2001-2006 Red Hat, Inc. ROMFS MTD (C) 2007 Red Hat, Inc. msgmni has been set to 118 io scheduler noop registered io scheduler anticipatory registered (default) io scheduler deadline registered io scheduler cfq registered s3c2410-lcd s3c2410-lcd: no platform data for lcd, cannot attach s3c2410-lcd: probe of s3c2410-lcd failed with error -22 lp: driver loaded but no devices found ppdev: user-space parallel port driver Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled s3c2410-uart.0: s3c2410_serial0 at MMIO 0x50000000 (irq = 70) is a S3C2410 s3c2410-uart.1: s3c2410_serial1 at MMIO 0x50004000 (irq = 73) is a S3C2410 s3c2410-uart.2: s3c2410_serial2 at MMIO 0x50008000 (irq = 76) is a S3C2410 brd: module loaded loop: module loaded Uniform Multi-Platform E-IDE driver ide-gd driver 1.18 ide-cd driver 5.00 S3C24XX NAND Driver, (c) 2004 Simtec Electronics s3c24xx-nand s3c2410-nand: Tacls=2, 20ns Twrph0=6 60ns, Twrph1=2 20ns s3c24xx-nand s3c2410-nand: NAND ECC disabled NAND device: Manufacturer ID: 0xec, Chip ID: 0x76 (Samsung NAND 64MiB 3,3V 8-bi)NAND_ECC_NONE selected by board driver. This is not recommended !! Scanning device for bad blocks Bad eraseblock 633 at 0x0000009e4000 Bad eraseblock 1824 at 0x000001c80000 Creating 6 MTD partitions on "NAND 64MiB 3,3V 8-bit": 0x000000000000-0x000000020000 : "vivi" 0x000000020000-0x000000030000 : "param" 0x000000030000-0x000000330000 : "kernel" 0x000000330000-0x000000630000 : "root" 0x000000630000-0x000003d30000 : "yaffs" 0x000003d30000-0x000003dfc000 : "ucos" dm9000 Ethernet Driver, V1.31 usbmon: debugfs is not available ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver s3c2410-ohci s3c2410-ohci: S3C24XX OHCI s3c2410-ohci s3c2410-ohci: new USB bus registered, assigned bus number 1 s3c2410-ohci s3c2410-ohci: irq 42, io mem 0x49000000 usb usb1: configuration #1 chosen from 1 choice hub 1-0:1.0: USB hub found hub 1-0:1.0: 2 ports detected usbcore: registered new interface driver libusual usbcore: registered new interface driver usbserial USB Serial support registered for generic usbcore: registered new interface driver usbserial_generic usbserial: USB Serial Driver core USB Serial support registered for FTDI USB Serial Device usbcore: registered new interface driver ftdi_sio ftdi_sio: v1.5.0:USB FTDI Serial Converters Driver USB Serial support registered for pl2303 usbcore: registered new interface driver pl2303 pl2303: Prolific PL2303 USB to serial adaptor driver mice: PS/2 mouse device common for all mice S3C24XX RTC, (c) 2004,2006 Simtec Electronics s3c2410-rtc s3c2410-rtc: rtc disabled, re-enabling s3c2410-rtc s3c2410-rtc: rtc core: registered s3c as rtc0 S3C2410 Watchdog Timer, (c) 2004 Simtec Electronics s3c2410-wdt s3c2410-wdt: watchdog inactive, reset disabled, irq enabled Advanced Linux Sound Architecture Driver Version 1.0.21. No device for DAI UDA134X No device for DAI s3c24xx-i2s ALSA device list: No soundcards found. TCP cubic registered NET: Registered protocol family 17 s3c2410-rtc s3c2410-rtc: hctosys: invalid date/time List of all partitions: 1f00 128 mtdblock0 (driver?) 1f01 64 mtdblock1 (driver?) 1f02 3072 mtdblock2 (driver?) 1f03 3072 mtdblock3 (driver?) 1f04 56320 mtdblock4 (driver?) 1f05 816 mtdblock5 (driver?) No filesystem could mount root, tried: cramfs Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(31,3) Backtrace: [<c0033984>] (dump_backtrace+0x0/0x114) from [<c02f5a40>] (dump_stack+0x18/0x1c) r6:00008000 r5:c388b007 r4:c03f6ae4 [<c02f5a28>] (dump_stack+0x0/0x1c) from [<c02f5a90>] (panic+0x4c/0x11c) [<c02f5a44>] (panic+0x0/0x11c) from [<c00090fc>] (mount_block_root+0x1d8/0x218) r3:00000003 r2:80000000 r1:c381bf64 r0:c0372cc6 [<c0008f24>] (mount_block_root+0x0/0x218) from [<c0009200>] (mount_root+0xc4/0x)[<c000913c>] (mount_root+0x0/0xfc) from [<c00093a4>] (prepare_namespace+0x16c/0) r5:c0028829 r4:c03f6234 [<c0009238>] (prepare_namespace+0x0/0x1c0) from [<c0008630>] (kernel_init+0xe8/) r5:c0027104 r4:c03f6000 [<c0008548>] (kernel_init+0x0/0x120) from [<c005637c>] (do_exit+0x0/0x5dc) r5:00
求助!!Linux tomcat部署war包 初始化bean失败 org.springframework.beans.factory.BeanCreationException: Error creating bean with name
日志如下: 环境:Linux suse 11 sp4 JDK 1.8 tomcat8.5 9.0 都报错 访问页面直接404 但是war包在Windows环境没问题 甚至在linux虚拟机上也没有问题 网上搜索过这类错误 说是 asm jar包和cjlib 版本冲突 让我换成 asm 3.3.1 和 cjlib 2.2.2 但是我用的就是 asm 3.3.1 cjlib 2.2.2 ......... 很无奈 是我war包打的有问题吗?配置不对?还是linux系统有问题 org.springframework.web.context.ContextLoader.initWebApplicationContext Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userDao' defined in file [/data/tomcat/apache-tomcat-8.5.50/webapps//test/WEB-INF/classes/com/demo/dao/UserDao.class]: Initialization of bean failed; nested exception is java.lang.VerifyError: class net.sf.cglib.core.DebuggingClassWriter overrides final method visit.(IILjava/lang/String;Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;)V at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:527) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:607) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:925) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:472) at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:388) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:293) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4699) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5165) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:743) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:719) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:705) at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:970) at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1841) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Caused by: java.lang.VerifyError: class net.sf.cglib.core.DebuggingClassWriter overrides final method visit.(IILjava/lang/String;Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;)V at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:756) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at org.apache.catalina.loader.WebappClassLoaderBase.findClassInternal(WebappClassLoaderBase.java:2395) at org.apache.catalina.loader.WebappClassLoaderBase.findClass(WebappClassLoaderBase.java:855) at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1327) at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1180) at net.sf.cglib.core.AbstractClassGenerator.<init>(AbstractClassGenerator.java:38) at net.sf.cglib.core.KeyFactory$Generator.<init>(KeyFactory.java:127) at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:112) at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:108) at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:104) at net.sf.cglib.proxy.Enhancer.<clinit>(Enhancer.java:69) at org.springframework.aop.framework.Cglib2AopProxy.createEnhancer(Cglib2AopProxy.java:229) at org.springframework.aop.framework.Cglib2AopProxy.getProxy(Cglib2AopProxy.java:171) at org.springframework.aop.framework.ProxyFactory.getProxy(ProxyFactory.java:112) at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.createProxy(AbstractAutoProxyCreator.java:477) at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.wrapIfNecessary(AbstractAutoProxyCreator.java:362) at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.postProcessAfterInitialization(AbstractAutoProxyCreator.java:322) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:407) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1461) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519) ... 24 more
运用书上的朴素贝叶斯分类代码,但代码出错,怎么解决,大佬求解。。。
``` import numpy as np class Naive_bayes(object): def __init__(self,p0_vector,p1_vector,p_absolute,vocab_set): """ 输入:朴素贝叶斯实例self,p0_vector表示类别c0的单词词频P(X|c0) p1_vector 表示类别c1的单词词频P(X|c1),p_absolute 表示类别c1的概率 P(c1),单词字典vocab_set 输出:无 描述:朴素贝叶斯构造函数 """ self.p0_vector = p0_vector self.p1_vector = p1_vector self.p_absolute = p_absolute self.vocab_set = vocab_set super(Naive_bayes,self).__init__() def create_vocab_list(self,dataset): """ 输入:朴素贝叶斯实例self,训练数据集 dataset 输出: 无 描述:根据测试样本构建你单词字典 """ vocab_set = set([]) for doucument in dataset: vocab_set = vocab_set|set(doucument) self.vocab_set = list(vocab_set) def wordset2vector(self,inputset): """ 输入:朴素贝叶斯实例self,单条文本inputset 输出:文本向量 return_vec 描述:将每条文本转换为数字向量,建立于字典同等大小的文本向量,若语句中的词典在字典表中出现则标记为1,否则为0 """ return_vec = [0]*len(self.vocab_set) for word in inputset: if word in self.vocab_set: return_vec[self.vocab_set.index(word)] += 1 return return_vec def computer_conditon_probablility(self,words_vec,labels): """ 输入:朴素贝叶斯实例self,训练文本向量集合words——vec,文本标签labels 输出:无 描述:根据文本向量集合计算类别c(i)的单词词频P(X|ci)和概率P(ci) """ num_train_docs = len(words_vec) num_words = len(words_vec[0]) p0_num = np.ones(num_words) p1_num = np.ones(num_words) for i in range(num_train_docs): if labels[i] == 1: p1_num += words_vec[i] else: p0_num += words_vec[i] self.p0_vector = np.log(p0_num/sum(p0_num)) self.p1_vector = np.log(p1_num / sum(p1_num)) self.p_absolute = sum(labels)/float(num_train_docs) def fit(self,dataset,labels): """ 输入:朴素贝叶斯实例self,训练文本向量集合dataset,文本标签labels 输出:无 描述:根据训练样本集训练朴素贝叶斯分类器 """ self.create_vocab_list(dataset) # 构建样本单词字典 words_vec = [] for inputset in dataset: words_vec.append(self.wordset2vec(inputset)) # 构建文本向量 self.compute_condition_probability(words_vec,labels) # 计算条件概率P(X|ci)和类别c1的概率P(c1) def predict(self,word_vec): """ 输入:朴素贝叶斯实例self,测试文本向量word__vec 输出:word_vec所属类别 描述:利用朴素贝叶斯分类器预测文本类别 """ p0 = sum(word_vec*self.p0V) + np.log(1.0-self.p_absolute) p1 = sum(word_vec*self.p1V) + np.log(self.p_absolute) return 1 if p1 > p0 else 0 def load_dataset(filename,delimiter=" "): """ 输入:数据文件路径,分隔符 输出:数据集 描述:读取数据文件生成np.nArry类型的数据集 """ dataset = [] labels = [] with open(filename,'r') as fp: # 数据文件内容格式“Daily English Learning” while True: lines = fp.readline().strip() # lines="Daily English Learning" if not lines: break feature = lines.split(delimiter) # feature= ['daily','english','learning','1'] key = int(feature[-1]) values = [v.lower() for v in feature[0:-1]] labels.append(key) dataset.append(values) return dataset,labels if __name__ == "__main__": filename = "bayes.data" dataset,labels = load_dataset(filename) naive_bayes = Naive_bayes() naive_bayes.fit(dataset,labels) testset = ['Learning','English'] test_vec = naive_bayes.wordset2vec(testset) estimate =naive_bayes.predict(test_vec) print('[{0},{1} estimate is:{2}'.format(testset[0],testset[1],estimate)) ``` ![图片说明](https://img-ask.csdn.net/upload/202001/18/1579333779_71473.png)
curl交叉编译成动态库,运行是失败报错
使用以下命令交叉编译: ./configure --host=arm-linux CC=/home/keda/work/K2_LEDE-STABLE-17.01/staging_dir/toolchain-arm_cortex-a7+neon-vfpv4_gcc-5.4.0_musl-1.1.16_eabi/bin/arm-openwrt-linux-gcc CXX=/home/keda/work/K2_LEDE-STABLE-17.01/staging_dir/toolchain-arm_cortex-a7+neon-vfpv4_gcc-5.4.0_musl-1.1.16_eabi/bin/arm-openwrt-linux-g++ --without-ssl --enable-shared --disable-static --prefix=/home/keda/curl编译/curl_arm_shard 编译成功。但是运行报一下错误: Error relocating ./curl: curl_url: symbol not found Error relocating ./curl: curl_mime_data_cb: symbol not found Error relocating ./curl: curl_mime_name: symbol not found Error relocating ./curl: curl_mime_encoder: symbol not found Error relocating ./curl: curl_mime_init: symbol not found Error relocating ./curl: curl_mime_headers: symbol not found Error relocating ./curl: curl_multi_poll: symbol not found Error relocating ./curl: curl_mime_filedata: symbol not found Error relocating ./curl: curl_mime_free: symbol not found Error relocating ./curl: curl_mime_subparts: symbol not found Error relocating ./curl: curl_url_set: symbol not found Error relocating ./curl: curl_url_cleanup: symbol not found Error relocating ./curl: curl_mime_type: symbol not found Error relocating ./curl: curl_mime_addpart: symbol not found Error relocating ./curl: curl_mime_filename: symbol not found Error relocating ./curl: curl_url_get: symbol not found Error relocating ./curl: curl_mime_data: symbol not found
TypeError: Error #1010: 术语尚未定义,并且无任何属性。 at _fla::MainTimeline/init() at _fla::MainTimeline/frame1()
import flash.display.MovieClip; var count:int=4;//图块数量 init();//初始化 function init():void { for(var i:int=0;i<count;i++) { this["p"+i].alpha=0.1;//设置放置区域的四个图块的透明度 this["mc"+i].addEventListener(MouseEvent.MOUSE_DOWN,StartDragEvent);//添加鼠标按下拖动事件 this["mc"+i].addEventListener(MouseEvent.MOUSE_UP,StopDragEvent);//添加鼠标弹起停止拖动事件 } } function StartDragEvent(e:MouseEvent):void { var obj:MovieClip=e.currentTarget as MovieClip; this.setChildIndex(obj,this.numChildren-1);//将被拖动的图块放到最上层 obj.startDrag();//开始拖动 } function StopDragEvent(e:MouseEvent):void { var obj:MovieClip=e.currentTarget as MovieClip; obj.stopDrag();//停止拖动 var t:int=int(obj.name.slice(2));//获取图块的序号,这就是为什么要和位置图块一致 if(Math.abs(obj.x-this["p"+t].x)<20&&Math.abs(obj.y-this["p"+t].y)<20)//如果正确位置的图块和拖动图块的位置相差不超过20像素,则拼图成功。 { this["p"+t].alpha=1; obj.visible=false; } }
linux环境lamp环境下,报503错误
![图片说明](https://img-ask.csdn.net/upload/201911/15/1573805148_362755.png) 使用的是腾讯香港服务器,环境lamp【话说之前使用的是lnmp,也是不行!!!!】 为啥我命运多舛,这么不顺了呢!干啥啥不行,弄啥啥出错! 求大佬指点!跪谢 错误日志: [Fri Nov 15 15:40:58.498474 2019] [ssl:warn] [pid 21563:tid 139903301691264] AH01873: Init: Session Cache is not configured [hint: SSLSessionCache] [Fri Nov 15 15:40:58.498694 2019] [lbmethod_heartbeat:notice] [pid 21563:tid 139903301691264] AH02282: No slotmem from mod_heartmonitor [Fri Nov 15 15:40:58.505957 2019] [mpm_event:notice] [pid 21563:tid 139903301691264] AH00489: Apache/2.4.41 (Unix) OpenSSL/1.1.1b configured -- resuming normal operations [Fri Nov 15 15:40:58.505998 2019] [core:notice] [pid 21563:tid 139903301691264] AH00094: Command line: '/www/server/apache/bin/httpd' [Fri Nov 15 15:41:10.605307 2019] [ssl:warn] [pid 21836:tid 140058249111424] AH01873: Init: Session Cache is not configured [hint: SSLSessionCache] [Fri Nov 15 15:41:10.605516 2019] [lbmethod_heartbeat:notice] [pid 21836:tid 140058249111424] AH02282: No slotmem from mod_heartmonitor [Fri Nov 15 15:41:10.605629 2019] [core:warn] [pid 21836:tid 140058249111424] AH00098: pid file /www/server/apache/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run? [Fri Nov 15 15:41:10.611579 2019] [mpm_event:notice] [pid 21836:tid 140058249111424] AH00489: Apache/2.4.41 (Unix) OpenSSL/1.1.1b configured -- resuming normal operations [Fri Nov 15 15:41:10.611610 2019] [core:notice] [pid 21836:tid 140058249111424] AH00094: Command line: '/www/server/apache/bin/httpd' [Fri Nov 15 15:41:10.721139 2019] [mpm_event:notice] [pid 21836:tid 140058249111424] AH00494: SIGHUP received. Attempting to restart [Fri Nov 15 15:41:10.728525 2019] [ssl:warn] [pid 21836:tid 140058249111424] AH01873: Init: Session Cache is not configured [hint: SSLSessionCache] [Fri Nov 15 15:41:10.728602 2019] [lbmethod_heartbeat:notice] [pid 21836:tid 140058249111424] AH02282: No slotmem from mod_heartmonitor [Fri Nov 15 15:41:10.731409 2019] [mpm_event:notice] [pid 21836:tid 140058249111424] AH00489: Apache/2.4.41 (Unix) OpenSSL/1.1.1b configured -- resuming normal operations [Fri Nov 15 15:41:10.731425 2019] [core:notice] [pid 21836:tid 140058249111424] AH00094: Command line: '/www/server/apache/bin/httpd' [Fri Nov 15 15:50:05.213767 2019] [ssl:warn] [pid 1402:tid 140669009205120] AH01873: Init: Session Cache is not configured [hint: SSLSessionCache] [Fri Nov 15 15:50:05.225067 2019] [lbmethod_heartbeat:notice] [pid 1402:tid 140669009205120] AH02282: No slotmem from mod_heartmonitor [Fri Nov 15 15:50:05.225204 2019] [core:warn] [pid 1402:tid 140669009205120] AH00098: pid file /www/server/apache/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run? [Fri Nov 15 15:50:05.276213 2019] [mpm_event:notice] [pid 1402:tid 140669009205120] AH00489: Apache/2.4.41 (Unix) OpenSSL/1.1.1b configured -- resuming normal operations [Fri Nov 15 15:50:05.276255 2019] [core:notice] [pid 1402:tid 140669009205120] AH00094: Command line: '/www/server/apache/bin/httpd' [Fri Nov 15 15:55:32.686438 2019] [mpm_event:notice] [pid 1402:tid 140669009205120] AH00493: SIGUSR1 received. Doing graceful restart [Fri Nov 15 15:55:32.694468 2019] [ssl:warn] [pid 1402:tid 140669009205120] AH01873: Init: Session Cache is not configured [hint: SSLSessionCache] [Fri Nov 15 15:55:32.694570 2019] [lbmethod_heartbeat:notice] [pid 1402:tid 140669009205120] AH02282: No slotmem from mod_heartmonitor [Fri Nov 15 15:55:32.694816 2019] [mpm_event:notice] [pid 1402:tid 140669009205120] AH00489: Apache/2.4.41 (Unix) OpenSSL/1.1.1b configured -- resuming normal operations [Fri Nov 15 15:55:32.694834 2019] [core:notice] [pid 1402:tid 140669009205120] AH00094: Command line: '/www/server/apache/bin/httpd' [Fri Nov 15 15:56:02.942880 2019] [mpm_event:notice] [pid 1402:tid 140669009205120] AH00493: SIGUSR1 received. Doing graceful restart [Fri Nov 15 15:56:02.951044 2019] [ssl:warn] [pid 1402:tid 140669009205120] AH01873: Init: Session Cache is not configured [hint: SSLSessionCache] [Fri Nov 15 15:56:02.951136 2019] [lbmethod_heartbeat:notice] [pid 1402:tid 140669009205120] AH02282: No slotmem from mod_heartmonitor [Fri Nov 15 15:56:02.951472 2019] [mpm_event:notice] [pid 1402:tid 140669009205120] AH00489: Apache/2.4.41 (Unix) OpenSSL/1.1.1b configured -- resuming normal operations [Fri Nov 15 15:56:02.951494 2019] [core:notice] [pid 1402:tid 140669009205120] AH00094: Command line: '/www/server/apache/bin/httpd' [Fri Nov 15 15:58:47.679633 2019] [mpm_event:notice] [pid 1402:tid 140669009205120] AH00493: SIGUSR1 received. Doing graceful restart [Fri Nov 15 15:58:47.687623 2019] [ssl:warn] [pid 1402:tid 140669009205120] AH01873: Init: Session Cache is not configured [hint: SSLSessionCache] [Fri Nov 15 15:58:47.687704 2019] [lbmethod_heartbeat:notice] [pid 1402:tid 140669009205120] AH02282: No slotmem from mod_heartmonitor [Fri Nov 15 15:58:47.688041 2019] [mpm_event:notice] [pid 1402:tid 140669009205120] AH00489: Apache/2.4.41 (Unix) OpenSSL/1.1.1b configured -- resuming normal operations [Fri Nov 15 15:58:47.688056 2019] [core:notice] [pid 1402:tid 140669009205120] AH00094: Command line: '/www/server/apache/bin/httpd' [Fri Nov 15 16:41:02.090591 2019] [autoindex:error] [pid 4031:tid 140668424939264] [client 150.109.180.237:45328] AH01276: Cannot serve directory /www/server/phpmyadmin/: No matching DirectoryIndex (index.php,index.html,index.htm,default.php,default.html,default.htm) found, and server-generated directory index forbidden by Options directive ![图片说明](https://img-ask.csdn.net/upload/201911/15/1573809741_179630.png) 能通过域名路径访问到图像或者html文件,php后缀的文件一旦访问就提示503错误! ![图片说明](https://img-ask.csdn.net/upload/201911/15/1573810477_770933.png)
pyinstaller打包py成exe后音乐文件播放异常,pygame.error
已解决 虽然不知道什么原因 用pyinstaller打包以后pygame不支持播放mp3和ogg文件 我把音乐文件转换成wav格式就成功了 所以mp3和ogg在pycharm里可以正常使用,不过如果要转成exe的话还得先把音乐文件统一转化成wav才行 问题描述: ``` if self.direct == 1: pygame.init() music = r"music\ai.mp3" pygame.mixer.music.load(music) pygame.mixer.music.play() ``` 一个十分普通的语句,在pycharm里可以顺利运行,但使用pyinstaller完成打包,并把music文件夹复制到和exe文件同目录下后却不能正常播放music里面的音乐文件,出现如下报错:![图片说明](https://img-ask.csdn.net/upload/202001/11/1578673075_740305.png) 整条路径没有中文名,歌曲文件名为ai.mp3,也没有中文名; 打包语句:pyinstaller -D loadui_new.py 目前已经试过网上的冻结路径法、spec打包(使用--add-data添加文件)法,报错没有变化。 初学python,还请各位前辈能教一下,感激不尽
Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000004、Linux4.19.66/at91/ramdisk/gcc7.3.1。
**环境描述:** 最近移植4.19.66内核,使用ramdisk文件系统,at91sam9x5,编译器使用的是gcc-linaro-7.3.1-2018.05-x86_64_arm-linux-gnueabi **问题如下:** 挂载文件系统报错 kernel panic - not syncing: Attempted to kill init exitcode=0x00000004 ![图片说明](https://img-ask.csdn.net/upload/201909/27/1569550340_681476.jpg) **尝试过的方法:** 网上所说的内核和busybox编译选择EABI选项,这个确认是选择了的,无法解决我的问题! 同时搜索看到有的朋友说gcc编译器的lib库复制问题,请问gcc库复制有什么特别的地方,我是将lib目录下的内容全部删除、sudo rm -rf *,然后复制,sudo cp -rf * ./,最后使用strip缩小文件大小。
交给spring管理的类和没交给spring管理的类在项目启动后,加载顺序是什么样的?
想项目启动后自动执行一个方法,我把这个类A用spring管理了,并把要执行的这个方法放在了init-method中。 这个方法需要用到一个类B中的某个静态方法,但是这个类B并没有交给spring容器管理,就是一个普通的类。 我想问,在这个init-method调用类B中的这个静态方法的时候,会不会出现classNotFound类似的这种错误?还是在调用B.xxx()的时候类B就自动加载了?并不会出现这样的错误?还是需要把B也交给Spring容器管理才可以(才能控制他在类A之前加载好)?
为什么ubuntu14 进行 /etc/init.d/xxx restart 均没有反应?
为什么ubuntu14 进行 /etc/init.d/xxx restart 均没有反应 cd /etc/init.d可以看到文件都在
MPI_Init: Can't read plugin directory
在集群上传MPI程序任务报错,但在ssh界面上运行正常。 报错: wemcsim_mpi: MPI_Init: Can't read plugin directory /public/software/mpi/openmpi1.4.1gnu/lib/linux_amd64/plugins wemcsim_mpi: MPI_Init: No plugins will be available wemcsim_mpi: MPI_Init: Can't read plugin directory 提交任务: #PBS -N csg01 #PBS -q high #PBS -o ./example_2D.output #PBS -e ./example_2D.err #PBS -l nodes=1:ppn=4 /public/software/mpi/openmpi1.4.1gnu/bin/mpirun -np 4 -hostfile $PBS_NODEFILE xx/wemcsim_mpi 执行文件 xx/example_2D.lua 输入文档 ``` ```
springboot一共7个jar,在本地idea上面都没问题,但是在服务器,一个jar启动不了
springboot项目,在idea上面正常启动,没有任何问题,但是在测试服务器(linux系统)启动不了,直接初始化数据源后close,各位大神谁可以看下是什么原因不,谢谢! ``` C:\Users\Administrator\Desktop\localJar>java -jar ad_user-0.0.1-SNAPSHOT.jar log4j:WARN No appenders could be found for logger (org.springframework.web.context.support.StandardServletEnvironment). log4j:WARN Please initialize the log4j system properly. log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info. . ____ _ __ _ _ /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \ ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ \\/ ___)| |_)| | | | | || (_| | ) ) ) ) ' |____| .__|_| |_|_| |_\__, | / / / / =========|_|==============|___/=/_/_/_/ :: Spring Boot :: (v2.0.1.RELEASE) 2020-01-02 15:59:03.441 INFO 14568 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode! 2020-01-02 15:59:04.626 INFO 14568 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat] 2020-01-02 15:59:04.626 INFO 14568 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.5.29 2020-01-02 15:59:04.639 INFO 14568 --- [ost-startStop-1] o.a.catalina.core.AprLifecycleListener : The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;D:\Program Files\xftp\;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;D:\Program Files\NetSarang\Xshell 6\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;D:\Program Files\GIT\bin;D:\maven\apache-maven-3.3.9\bin\;C:\Users\Administrator\AppData\Local\Microsoft\WindowsApps;C:\Users\Administrator\AppData\Local\GitHubDesktop\bin;"C:\Program Files\Java\jdk1.8.0_221\bin;C:\Program Files\Java\jdk1.8.0_221\jre\bin;";;.] 2020-01-02 15:59:04.729 INFO 14568 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/user] : Initializing Spring embedded WebApplicationContext 2020-01-02 15:59:05.005 WARN 14568 --- [ost-startStop-1] c.n.c.sources.URLConfigurationSource : No URLs will be polled as dynamic configuration sources. 2020-01-02 15:59:05.005 INFO 14568 --- [ost-startStop-1] c.n.c.sources.URLConfigurationSource : To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath. 2020-01-02 15:59:05.032 INFO 14568 --- [ost-startStop-1] c.netflix.config.DynamicPropertyFactory : DynamicPropertyFactory is initialized with configuration sources: com.netflix.config.ConcurrentCompositeConfiguration@3c432935 2020-01-02 15:59:05.420 INFO 14568 --- [ost-startStop-1] c.a.d.s.b.a.DruidDataSourceAutoConfigure : Init DruidDataSource 2020-01-02 15:59:05.816 INFO 14568 --- [ost-startStop-1] com.alibaba.druid.pool.DruidDataSource : {dataSource-1} inited 2020-01-02 15:59:07.798 INFO 14568 --- [ main] com.alibaba.druid.pool.DruidDataSource : {dataSource-1} closed 2020-01-02 15:59:07.800 INFO 14568 --- [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat] ```
友善之臂mini2440 运行uart裸板程序失败
用的板子是友善之臂mini2440,自己学习韦东山的一期视频,在写uart裸板程序时发现怎么都无法实现功能 s3c2440.h ``` /* GPIO寄存器 */ #define GPBCON (*(volatile unsigned int*)0x56000010) #define GPGCON (*(volatile unsigned int*)0x56000060) #define GPHCON (*(volatile unsigned int*)0x56000070) #define GPBDAT (*(volatile unsigned int*)0x56000014) #define GPGDAT (*(volatile unsigned int*)0x56000064) #define GPHUP (*(volatile unsigned int*)0x56000078) /* UART寄存器 */ #define UCON0 (*(volatile unsigned int*)0x50000004) #define UBRDIV0 (*(volatile unsigned int*)0x50000004) #define ULCON0 (*(volatile unsigned int*)0x50000028) #define UTRSTAT0 (*(volatile unsigned int*)0x50000010) #define UTXH0 (*(volatile unsigned char*)0x50000020) #define URXH0 (*(volatile unsigned char*)0x50000024) #define UFCON0 (*(volatile unsigned int*)0x50000008) #define UMCON0 (*(volatile unsigned int*)0x5000000C) #define UCON1 (*(volatile unsigned int*)0x50004004) #define UBRDIV1 (*(volatile unsigned int*)0x50004028) #define ULCON1 (*(volatile unsigned int*)0x50004000) #define UTRSTAT1 (*(volatile unsigned int*)0x50004010) #define UTXH1 (*(volatile unsigned char*)0x50004020) #define URXH1 (*(volatile unsigned char*)0x50004024) #define UFCON1 (*(volatile unsigned int*)0x50004008) #define UMCON1 (*(volatile unsigned int*)0x5000400C) ``` uart.h ``` #ifndef _UART_H #define _UART_H void uart0_init(); int putchar(int c); int getchar(void); int puts(const char *s); #endif ``` uart.c ``` #include "s3c2440.h" /* 设置引脚用于串口 */ void uart0_init() { GPHCON &= ~((3<<8)|(3<<10)); //清空GPH2,GPH3 GPHCON |= ((2<<8)|(2<<10)); //GPH4,GPH5用于TXD1,RXD1 GPHUP &= ~((1<<4)|(1<<5)); //使能内部上拉 UFCON0 = 0x00; //不使用FIFO UMCON0 = 0x00; //不使用流控 ULCON0 = 0x00000003; //设置数据格式8n1:8位数据位,无校验位,1停止位 UCON0 = 0x00000005; //PCLK,中断/查询模式 UBRDIV0 = 26; //设置波特率 115200 } int putchar(int c) { while(!(UTRSTAT0) & (1<<2)) UTXH0 = (unsigned char)c; } int getchar(void) { while(!(UTRSTAT0) & (1<<0)) return URXH0; } int puts(const char *s) { while(*s) { putchar(*s); s++; } } ``` main.c ``` #include "s3c2440.h" #include "uart.h" int main(void) { unsigned char c; uart0_init(); puts("hello,world!\n"); while(1) { c = getchar(); putchar(c); } return 0; } ``` start.S ``` .text .global _start _start: /*设置内存:sp 栈*/ ldr sp,=4096 /*nand启动*/ /* 关闭看门狗 */ ldr r0, =0x53000000 ldr r1, =0 str r1, [r0] /* 设置CPU工作于异步模式 */ mrc p15,0,r0,c1,c0,0 orr r0,r0,#0xc0000000 //R1_nF:OR:R1_iA mcr p15,0,r0,c1,c0,0 /* 设置MPLL,FCLK */ /* CLKDIVN(0x4c000014) = 0x5 */ ldr r0, =0x4c000014 ldr r1, =0x5 /* HCLK = FCLK/4 = 100 MHz , PCLK = HCLK/2 = 50MHz */ str r1, [r0] /* 设置MPLLCON(0x4c000004) = (92<<12)|(1<<4)|(1<<0) FCLK = 400 MHz*/ ldr r0, =0x4c000004 ldr r1, =(92<<12)|(1<<4)|(1<<0) str r1,[r0] /*调用main*/ bl main halt: b halt ``` Makefile ``` all: arm-linux-gcc -c -o uart.o uart.c arm-linux-gcc -c -o main.o main.c arm-linux-gcc -c -o start.o start.S arm-linux-ld -Ttext 0 start.o uart.o main.o -o uart.elf arm-linux-objcopy -O binary -S uart.elf uart.bin arm-linux-objdump -D uart.elf > uart.dis clean: rm *.bin *.o *.elf *.dis ``` 程序写完后扔到虚拟机里编译生成.bin文件,之后用友善之臂自己编写的下载工具进行烧写 ![图片说明](https://img-ask.csdn.net/upload/202001/07/1578379644_335442.png) 之后选择nand启动,连接串口,并没有看到返回字符串hello,world! 特来请教
嵌入式编译zImage与uboot时出现问题,芯片是imx287
报错信息:sun@sun-X450CC:~/sun/Bootloader/imx-bootlets-src-2.6.35.3-1.1.0$ make BOARD=iMX28_EVK by using the pre-build command line # force building linux_prep make clean -C linux_prep make[1]: 正在进入目录 `/home/sun/sun/Bootloader/imx-bootlets-src-2.6.35.3-1.1.0/linux_prep' Cleaning... Files: rm -rf ./core/entry.o ./core/resume.o ./core/cmdlines.o ./core/setup.o ./core/keys.o ./board/iMX28_EVK.o ./hw/lradc-buttons.o ./output-target/linux_prep.ld Build output: rm -rf ./output-target Build system: rm -rf ./include/arch make[1]:正在离开目录 `/home/sun/sun/Bootloader/imx-bootlets-src-2.6.35.3-1.1.0/linux_prep' cross-compiling linux_prep make -C linux_prep ARCH=mx28 BOARD=iMX28_EVK make[1]: 正在进入目录 `/home/sun/sun/Bootloader/imx-bootlets-src-2.6.35.3-1.1.0/linux_prep' gcc -c -Wall -I./include -nostdinc -fno-builtin -O -DMX28 -DBOARD_MX28_EVK -D__ASSEMBLY__ -o core/entry.o core/entry.S core/entry.S: Assembler messages: core/entry.S:26: Error: unknown pseudo-op: `.code' core/entry.S:31: Error: no such instruction: `stmdb sp!,{r4-r12,lr}' core/entry.S:34: Error: no such instruction: `ldr r4,entry_count' core/entry.S:35: Error: expecting operand after ','; got nothing core/entry.S:36: Error: no such instruction: `bne start_kernel' core/entry.S:42: Error: no such instruction: `bl try_to_resume' core/entry.S:49: Error: too many memory references for `add' core/entry.S:50: Error: too many memory references for `str' core/entry.S:53: Error: no such instruction: `ldmia sp!,{r4-r12,lr}' core/entry.S:54: Error: no such instruction: `bx lr' core/entry.S:56: Error: unknown pseudo-op: `.pool' core/entry.S:64: Error: no such instruction: `bl clear_bss' core/entry.S:67: Error: no such instruction: `bl hw_init' core/entry.S:70: Error: no such instruction: `bl setup_tags' core/entry.S:71: Error: too many memory references for `mov' core/entry.S:74: Error: no such instruction: `ldr r1,=2531' core/entry.S:77: Error: expecting operand after ','; got nothing core/entry.S:80: Error: no such instruction: `ldr lr,=(0x40000000+0x8000)' core/entry.S:81: Error: too many memory references for `mov' core/entry.S:83: Error: unknown pseudo-op: `.pool' core/entry.S:91: Error: no such instruction: `stmdb sp!,{r4-r6,lr}' core/entry.S:92: Error: no such instruction: `ldr r4,=_hwinit_start' core/entry.S:93: Error: no such instruction: `ldr r5,=_hwinit_end' core/entry.S:94: Error: no such instruction: `ldr r6,[r4],' core/entry.S:95: Error: too many memory references for `mov' core/entry.S:96: Error: too many memory references for `mov' core/entry.S:97: Error: too many memory references for `cmp' core/entry.S:98: Error: no such instruction: `blo 1b' core/entry.S:99: Error: no such instruction: `ldmia sp!,{r4-r6,lr}' core/entry.S:100: Error: too many memory references for `mov' core/entry.S:102: Error: unknown pseudo-op: `.pool' core/entry.S:107: Error: no such instruction: `ldr r0,=_bss_start' core/entry.S:108: Error: no such instruction: `ldr r1,=_bss_end' core/entry.S:109: Error: expecting operand after ','; got nothing core/entry.S:110: Error: invalid char '[' beginning operand 2 `[r0]' core/entry.S:111: Error: too many memory references for `cmp' core/entry.S:112: Error: no such instruction: `blo 1b' core/entry.S:113: Error: too many memory references for `mov' core/entry.S:115: Error: unknown pseudo-op: `.pool' core/entry.S:122: Error: too many memory references for `mov' core/entry.S:125: Error: too many memory references for `mov' core/entry.S:128: Error: too many memory references for `mov' make[1]: *** [core/entry.o] 错误 1 make[1]:正在离开目录 `/home/sun/sun/Bootloader/imx-bootlets-src-2.6.35.3-1.1.0/linux_prep' make: *** [linux_prep] 错误 2 报错文件我找到了是这个: /* * linux_prep entry code. * * Entered twice: * * - Before loading Linux kernel image to SDRAM to check * if CPU is being taken out of standby mode and resume * sleeping kernel. * * - After loading Linux kernel image to prepare Linux boot * paramteters and jump to the kernel * * Vladislav Buzov <vbuzov@embeddedalley.com> * * Copyright 2008 SigmaTel, Inc * Copyright 2008 Embedded Alley Solutions, Inc * * This file is licensed under the terms of the GNU General Public License * version 2. This program is licensed "as is" without any warranty of any * kind, whether express or implied. */ #include <arch/platform.h> #undef DEBUG .code 32 .section ".start", "ax" .global _start, _fail_reason _start: stmdb sp!, {r4-r12, lr} /* Check entry counter */ ldr r4, entry_count cmp r4, #0 bne start_kernel /* * We may not return from there if system is resuming * from standby mode */ bl try_to_resume #ifdef DEBUG mov r2, #0x80000000 orr r2, r2, #0x70000 str r0, [r2] #endif /* Update counter to show we were here */ add r4, r4, #1 str r4, entry_count /* Return to ROM */ ldmia sp!, {r4-r12, lr} bx lr .pool entry_count: .long 0x00 _fail_reason: .long 0x00 start_kernel: bl clear_bss /* Initialize HW modules relevant for linux_prep */ bl hw_init /* Setup tags for Linux kernel and save tags pointer in r2 */ bl setup_tags mov r2, r0 /* Store machine id in r1 */ ldr r1, =MACHINE_ID /* Zero r0 register */ mov r0, #0 /* Jump to Linux kernel */ ldr lr, =KERNEL_BASE_ADDRESS mov pc, lr .pool /* * This function initializes all HW modules anebled in * current configuration. It goes throgh .hwinitcall section * containing addresses of HW initialization routines. */ hw_init: stmdb sp!, {r4-r6, lr} ldr r4, =_hwinit_start ldr r5, =_hwinit_end 1: ldr r6, [r4], #4 mov lr, pc mov pc, r6 cmp r4, r5 blo 1b ldmia sp!, {r4-r6, lr} mov pc, lr .pool /* * This function clears out the .bss section. */ clear_bss: ldr r0, =_bss_start ldr r1, =_bss_end mov r2, #0 1: str r2, [r0], #4 cmp r0, r1 blo 1b mov pc, lr .pool /* * ARM EABI toolchain needs divide by zero handler to be implemented * externally. */ .globl __div0 __div0: mov pc, lr .globl __aeabi_unwind_cpp_pr0 __aeabi_unwind_cpp_pr0: mov pc, lr .globl raise raise: mov pc, lr 有没有知道哪里错了的,这个文件我没有动过,是不是有什么地方需要配置
Java学习的正确打开方式
在博主认为,对于入门级学习java的最佳学习方法莫过于视频+博客+书籍+总结,前三者博主将淋漓尽致地挥毫于这篇博客文章中,至于总结在于个人,实际上越到后面你会发现学习的最好方式就是阅读参考官方文档其次就是国内的书籍,博客次之,这又是一个层次了,这里暂时不提后面再谈。博主将为各位入门java保驾护航,各位只管冲鸭!!!上天是公平的,只要不辜负时间,时间自然不会辜负你。 何谓学习?博主所理解的学习,它是一个过程,是一个不断累积、不断沉淀、不断总结、善于传达自己的个人见解以及乐于分享的过程。
程序员必须掌握的核心算法有哪些?
由于我之前一直强调数据结构以及算法学习的重要性,所以就有一些读者经常问我,数据结构与算法应该要学习到哪个程度呢?,说实话,这个问题我不知道要怎么回答你,主要取决于你想学习到哪些程度,不过针对这个问题,我稍微总结一下我学过的算法知识点,以及我觉得值得学习的算法。这些算法与数据结构的学习大多数是零散的,并没有一本把他们全部覆盖的书籍。下面是我觉得值得学习的一些算法以及数据结构,当然,我也会整理一些看过...
大学四年自学走来,这些私藏的实用工具/学习网站我贡献出来了
大学四年,看课本是不可能一直看课本的了,对于学习,特别是自学,善于搜索网上的一些资源来辅助,还是非常有必要的,下面我就把这几年私藏的各种资源,网站贡献出来给你们。主要有:电子书搜索、实用工具、在线视频学习网站、非视频学习网站、软件下载、面试/求职必备网站。 注意:文中提到的所有资源,文末我都给你整理好了,你们只管拿去,如果觉得不错,转发、分享就是最大的支持了。 一、电子书搜索 对于大部分程序员...
linux系列之常用运维命令整理笔录
本博客记录工作中需要的linux运维命令,大学时候开始接触linux,会一些基本操作,可是都没有整理起来,加上是做开发,不做运维,有些命令忘记了,所以现在整理成博客,当然vi,文件操作等就不介绍了,慢慢积累一些其它拓展的命令,博客不定时更新 free -m 其中:m表示兆,也可以用g,注意都要小写 Men:表示物理内存统计 total:表示物理内存总数(total=used+free) use...
比特币原理详解
一、什么是比特币 比特币是一种电子货币,是一种基于密码学的货币,在2008年11月1日由中本聪发表比特币白皮书,文中提出了一种去中心化的电子记账系统,我们平时的电子现金是银行来记账,因为银行的背后是国家信用。去中心化电子记账系统是参与者共同记账。比特币可以防止主权危机、信用风险。其好处不多做赘述,这一层面介绍的文章很多,本文主要从更深层的技术原理角度进行介绍。 二、问题引入 假设现有4个人...
程序员接私活怎样防止做完了不给钱?
首先跟大家说明一点,我们做 IT 类的外包开发,是非标品开发,所以很有可能在开发过程中会有这样那样的需求修改,而这种需求修改很容易造成扯皮,进而影响到费用支付,甚至出现做完了项目收不到钱的情况。 那么,怎么保证自己的薪酬安全呢? 我们在开工前,一定要做好一些证据方面的准备(也就是“讨薪”的理论依据),这其中最重要的就是需求文档和验收标准。一定要让需求方提供这两个文档资料作为开发的基础。之后开发...
网页实现一个简单的音乐播放器(大佬别看。(⊙﹏⊙))
今天闲着无事,就想写点东西。然后听了下歌,就打算写个播放器。 于是乎用h5 audio的加上js简单的播放器完工了。 演示地点演示 html代码如下` music 这个年纪 七月的风 音乐 ` 然后就是css`*{ margin: 0; padding: 0; text-decoration: none; list-...
Python十大装B语法
Python 是一种代表简单思想的语言,其语法相对简单,很容易上手。不过,如果就此小视 Python 语法的精妙和深邃,那就大错特错了。本文精心筛选了最能展现 Python 语法之精妙的十个知识点,并附上详细的实例代码。如能在实战中融会贯通、灵活使用,必将使代码更为精炼、高效,同时也会极大提升代码B格,使之看上去更老练,读起来更优雅。
数据库优化 - SQL优化
以实际SQL入手,带你一步一步走上SQL优化之路!
通俗易懂地给女朋友讲:线程池的内部原理
餐盘在灯光的照耀下格外晶莹洁白,女朋友拿起红酒杯轻轻地抿了一小口,对我说:“经常听你说线程池,到底线程池到底是个什么原理?”
经典算法(5)杨辉三角
杨辉三角 是经典算法,这篇博客对它的算法思想进行了讲解,并有完整的代码实现。
使用 Docker 部署 Spring Boot 项目
Docker 技术发展为微服务落地提供了更加便利的环境,使用 Docker 部署 Spring Boot 其实非常简单,这篇文章我们就来简单学习下。首先构建一个简单的 S...
英特尔不为人知的 B 面
从 PC 时代至今,众人只知在 CPU、GPU、XPU、制程、工艺等战场中,英特尔在与同行硬件芯片制造商们的竞争中杀出重围,且在不断的成长进化中,成为全球知名的半导体公司。殊不知,在「刚硬」的背后,英特尔「柔性」的软件早已经做到了全方位的支持与支撑,并持续发挥独特的生态价值,推动产业合作共赢。 而对于这一不知人知的 B 面,很多人将其称之为英特尔隐形的翅膀,虽低调,但是影响力却不容小觑。 那么,在...
面试官:你连RESTful都不知道我怎么敢要你?
干货,2019 RESTful最贱实践
刷了几千道算法题,这些我私藏的刷题网站都在这里了!
遥想当年,机缘巧合入了 ACM 的坑,周边巨擘林立,从此过上了"天天被虐似死狗"的生活… 然而我是谁,我可是死狗中的战斗鸡,智力不够那刷题来凑,开始了夜以继日哼哧哼哧刷题的日子,从此"读题与提交齐飞, AC 与 WA 一色 ",我惊喜的发现被题虐既刺激又有快感,那一刻我泪流满面。这么好的事儿作为一个正直的人绝不能自己独享,经过激烈的颅内斗争,我决定把我私藏的十几个 T 的,阿不,十几个刷题网...
白话阿里巴巴Java开发手册高级篇
不久前,阿里巴巴发布了《阿里巴巴Java开发手册》,总结了阿里巴巴内部实际项目开发过程中开发人员应该遵守的研发流程规范,这些流程规范在一定程度上能够保证最终的项目交付质量,通过在时间中总结模式,并推广给广大开发人员,来避免研发人员在实践中容易犯的错误,确保最终在大规模协作的项目中达成既定目标。 无独有偶,笔者去年在公司里负责升级和制定研发流程、设计模板、设计标准、代码标准等规范,并在实际工作中进行...
SQL-小白最佳入门sql查询一
不要偷偷的查询我的个人资料,即使你再喜欢我,也不要这样,真的不好;
redis分布式锁,面试官请随便问,我都会
文章有点长并且绕,先来个图片缓冲下! 前言 现在的业务场景越来越复杂,使用的架构也就越来越复杂,分布式、高并发已经是业务要求的常态。像腾讯系的不少服务,还有CDN优化、异地多备份等处理。 说到分布式,就必然涉及到分布式锁的概念,如何保证不同机器不同线程的分布式锁同步呢? 实现要点 互斥性,同一时刻,智能有一个客户端持有锁。 防止死锁发生,如果持有锁的客户端崩溃没有主动释放锁,也要保证锁可以正常释...
项目中的if else太多了,该怎么重构?
介绍 最近跟着公司的大佬开发了一款IM系统,类似QQ和微信哈,就是聊天软件。我们有一部分业务逻辑是这样的 if (msgType = "文本") { // dosomething } else if(msgType = "图片") { // doshomething } else if(msgType = "视频") { // doshomething } else { // doshom...
Nginx 原理和架构
Nginx 是一个免费的,开源的,高性能的 HTTP 服务器和反向代理,以及 IMAP / POP3 代理服务器。Nginx 以其高性能,稳定性,丰富的功能,简单的配置和低资源消耗而闻名。 Nginx 的整体架构 Nginx 里有一个 master 进程和多个 worker 进程。master 进程并不处理网络请求,主要负责调度工作进程:加载配置、启动工作进程及非停升级。worker 进程负责处...
“狗屁不通文章生成器”登顶GitHub热榜,分分钟写出万字形式主义大作
一、垃圾文字生成器介绍 最近在浏览GitHub的时候,发现了这样一个骨骼清奇的雷人项目,而且热度还特别高。 项目中文名:狗屁不通文章生成器 项目英文名:BullshitGenerator 根据作者的介绍,他是偶尔需要一些中文文字用于GUI开发时测试文本渲染,因此开发了这个废话生成器。但由于生成的废话实在是太过富于哲理,所以最近已经被小伙伴们给玩坏了。 他的文风可能是这样的: 你发现,...
程序员:我终于知道post和get的区别
是一个老生常谈的话题,然而随着不断的学习,对于以前的认识有很多误区,所以还是需要不断地总结的,学而时习之,不亦说乎
《程序人生》系列-这个程序员只用了20行代码就拿了冠军
你知道的越多,你不知道的越多 点赞再看,养成习惯GitHub上已经开源https://github.com/JavaFamily,有一线大厂面试点脑图,欢迎Star和完善 前言 这一期不算《吊打面试官》系列的,所有没前言我直接开始。 絮叨 本来应该是没有这期的,看过我上期的小伙伴应该是知道的嘛,双十一比较忙嘛,要值班又要去帮忙拍摄年会的视频素材,还得搞个程序员一天的Vlog,还要写BU...
加快推动区块链技术和产业创新发展,2019可信区块链峰会在京召开
11月8日,由中国信息通信研究院、中国通信标准化协会、中国互联网协会、可信区块链推进计划联合主办,科技行者协办的2019可信区块链峰会将在北京悠唐皇冠假日酒店开幕。   区块链技术被认为是继蒸汽机、电力、互联网之后,下一代颠覆性的核心技术。如果说蒸汽机释放了人类的生产力,电力解决了人类基本的生活需求,互联网彻底改变了信息传递的方式,区块链作为构造信任的技术有重要的价值。   1...
Java世界最常用的工具类库
Apache Commons Apache Commons有很多子项目 Google Guava 参考博客
程序员把地府后台管理系统做出来了,还有3.0版本!12月7号最新消息:已在开发中有github地址
第一幕:缘起 听说阎王爷要做个生死簿后台管理系统,我们派去了一个程序员…… 996程序员做的梦: 第一场:团队招募 为了应对地府管理危机,阎王打算找“人”开发一套地府后台管理系统,于是就在地府总经办群中发了项目需求。 话说还是中国电信的信号好,地府都是满格,哈哈!!! 经常会有外行朋友问:看某网站做的不错,功能也简单,你帮忙做一下? 而这次,面对这样的需求,这个程序员...
网易云6亿用户音乐推荐算法
网易云音乐是音乐爱好者的集聚地,云音乐推荐系统致力于通过 AI 算法的落地,实现用户千人千面的个性化推荐,为用户带来不一样的听歌体验。 本次分享重点介绍 AI 算法在音乐推荐中的应用实践,以及在算法落地过程中遇到的挑战和解决方案。 将从如下两个部分展开: AI算法在音乐推荐中的应用 音乐场景下的 AI 思考 从 2013 年 4 月正式上线至今,网易云音乐平台持续提供着:乐屏社区、UGC...
【技巧总结】位运算装逼指南
位算法的效率有多快我就不说,不信你可以去用 10 亿个数据模拟一下,今天给大家讲一讲位运算的一些经典例子。不过,最重要的不是看懂了这些例子就好,而是要在以后多去运用位运算这些技巧,当然,采用位运算,也是可以装逼的,不信,你往下看。我会从最简单的讲起,一道比一道难度递增,不过居然是讲技巧,那么也不会太难,相信你分分钟看懂。 判断奇偶数 判断一个数是基于还是偶数,相信很多人都做过,一般的做法的代码如下...
为什么要学数据结构?
一、前言 在可视化化程序设计的今天,借助于集成开发环境可以很快地生成程序,程序设计不再是计算机专业人员的专利。很多人认为,只要掌握几种开发工具就可以成为编程高手,其实,这是一种误解。要想成为一个专业的开发人员,至少需要以下三个条件: 1) 能够熟练地选择和设计各种数据结构和算法 2) 至少要能够熟练地掌握一门程序设计语言 3) 熟知所涉及的相关应用领域的知识 其中,后两个条件比较容易实现,而第一个...
Android 9.0 init 启动流程
阅读五分钟,每日十点,和您一起终身学习,这里是程序员Android本篇文章主要介绍Android开发中的部分知识点,通过阅读本篇文章,您将收获以下内容:一、启动流程概述一、 启动流程概述Android启动流程跟Linux启动类似,大致分为如下五个阶段。1.开机上电,加载固化的ROM。2.加载BootLoader,拉起Android OS。3.加载Uboot,初始外设,引导Kernel启动等。...
相关热词 c#选择结构应用基本算法 c# 收到udp包后回包 c#oracle 头文件 c# 序列化对象 自定义 c# tcp 心跳 c# ice连接服务端 c# md5 解密 c# 文字导航控件 c#注册dll文件 c#安装.net
立即提问