Re: Kernel boot panic

2016-12-08 Thread Kristof Provost
On 8 Dec 2016, at 15:59, Amit Mahadik wrote:
>      Hi,
>       I am trying to boot Linux kernel version 4.4.16 on custom ARM 
> based development platform.I want to separate rootfs and kernel Image 
> so that the size of my uImage is small. I followed the following 
> steps.
> 1. Partitioned the SD card. It has 2 partition. First partition is 
> formatted as vfat partition and    has uImage (without rootfs). 
> Second partition is formatted as ext3 and has the rootfs.2. I then 
> changed the U-Boot (version 2011.05) bootargs   Kernel command line: 
> console=ttyS0,115200 noinitrd rw rootfstype=ext3 root=/dev/mmcblk0p2 
>          rootwait mem=512M coherent_pool=4M no_console_suspend 
> resume=/dev/mtdblock3.
>
> However, while booting I get the following error 
> Failed to create /dev/root: -2VFS: Cannot open root device "mmcblk0p2" 
> or unknown-block(179,2): error -2
> I have also attached log for reference. Can anyone please point out 
> what I may be missing?

Well, your kernel finds the partition, but it’s still unable to open 
the root device.
Did you remember to compile ext3 support into your kernel (so not as a 
module)?

Regards,
Kristof

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Kernel boot panic

2016-12-08 Thread Amit Mahadik

     Hi,
      I am trying to boot Linux kernel version 4.4.16 on custom ARM based 
development platform.I want to separate rootfs and kernel Image so that the 
size of my uImage is small. I followed the following steps.
1. Partitioned the SD card. It has 2 partition. First partition is formatted as 
vfat partition and    has uImage (without rootfs). Second partition is 
formatted as ext3 and has the rootfs.2. I then changed the U-Boot (version 
2011.05) bootargs   Kernel command line: console=ttyS0,115200 noinitrd rw 
rootfstype=ext3 root=/dev/mmcblk0p2          rootwait mem=512M coherent_pool=4M 
no_console_suspend resume=/dev/mtdblock3.

However, while booting I get the following error 
Failed to create /dev/root: -2VFS: Cannot open root device "mmcblk0p2" or 
unknown-block(179,2): error -2
I have also attached log for reference. Can anyone please point out what I may 
be missing?
Regards,Amit.


   Starting kernel ...

Uncompressing Linux... done, booting the kernel.
[0.00] Booting Linux on physical CPU 0x0
[0.00] Initializing cgroup subsys cpuset
[0.00] Initializing cgroup subsys cpu
[0.00] Linux version 4.4.16-svn125 (amitm@buildserver-90) (gcc version 
4.8.3 20140320 (prerelease) (GCC) ) #6 SMP PREEMPT Wed Nov 30 15:09:22 IST 2016
[0.00] CPU: ARMv7 Processor [414fc091] revision 1 (ARMv7), cr=18c5387d
[0.00] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing 
instruction cache
[0.00] Machine: OPV5XC-CA9MP
[0.00] cma: Reserved 32 MiB at 0x1e00
[0.00] Memory policy: Data cache writealloc
[0.00] PERCPU: Embedded 12 pages/cpu @9dbbd000 s18496 r8192 d22464 
u49152
[0.00] Built 1 zonelists in Zone order, mobility grouping on.  Total 
pages: 130048
[0.00] Kernel command line: console=ttyS0,115200 noinitrd rw 
rootfstype=ext3 root=/dev/mmcblk0p2 rootwait mem=512M coherent_pool=4M 
no_console_suspend resume=/dev/mtdblock3
[0.00] PID hash table entries: 2048 (order: 1, 8192 bytes)
[0.00] Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
[0.00] Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
[0.00] Memory: 476628K/524288K available (5704K kernel code, 355K 
rwdata, 1804K rodata, 1976K init, 282K bss, 14892K reserved, 32768K 
cma-reserved)
[0.00] Virtual kernel memory layout:
[0.00] vector  : 0x - 0x1000   (   4 kB)
[0.00] fixmap  : 0xffc0 - 0xfff0   (3072 kB)
[0.00] vmalloc : 0xa080 - 0xff80   (1520 MB)
[0.00] lowmem  : 0x8000 - 0xa000   ( 512 MB)
[0.00] modules : 0x7f00 - 0x8000   (  16 MB)
[0.00]   .text : 0x80008000 - 0x8075d398   (7509 kB)
[0.00]   .init : 0x8075e000 - 0x8094c000   (1976 kB)
[0.00]   .data : 0x8094c000 - 0x809a4c60   ( 356 kB)
[0.00].bss : 0x809a4c60 - 0x809eb76c   ( 283 kB)
[0.00] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=3, Nodes=1
[0.00] Preemptible hierarchical RCU implementation.
[0.00]  RCU debugfs-based tracing is enabled.
[0.00]  Build-time adjustment of leaf fanout to 32.
[0.00] NR_IRQS:264
[0.00] smp_twd: clock not found -2
[0.00] twd_local_timer registered.
[0.12] sched_clock: 32 bits at 25MHz, resolution 40ns, wraps every 
85899345900ns
[0.32] clocksource: timer2: mask: 0x max_cycles: 0x, 
max_idle_ns: 76450417870 ns
[0.53] opv5xc_timer_init OK.
[0.000162] Console: colour dummy device 80x30
[0.000196] Calibrating local timer... 199.90MHz.
[0.060091] Calibrating delay loop... 1594.16 BogoMIPS (lpj=7970816)
[0.150080] pid_max: default: 32768 minimum: 301
[0.150197] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[0.150214] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[0.150946] CPU: Testing write buffer coherency: ok
[0.151278] CPU0: thread -1, cpu 0, socket 0, mpidr 8000
[0.151344] opv5xc_secondary_startup @ 0x56c544
[0.151367] see 0x56c544
[0.151450] Setting up static identity map for 0x8280 - 0x82d8
[0.230641] CPU1: Booted secondary processor
[0.26] CPU1: thread -1, cpu 1, socket 0, mpidr 8001
[0.300599] CPU2: Booted secondary processor
[0.339965] CPU2: thread -1, cpu 2, socket 0, mpidr 8002
[0.340128] Brought up 3 CPUs
[0.340167] SMP: Total of 3 processors activated (4782.48 BogoMIPS).
[0.340182] CPU: All CPU(s) started in SVC mode.
[0.341887] devtmpfs: initialized
[0.355711] VFP support v0.3: implementor 41 architecture 3 part 30 variant 
9 rev 4
[0.357002] clocksource: jiffies: mask: 0x max_cycles: 0x, 
max_idle_ns: 1911260446275 ns
[0.361766] NET: Registered protocol family 16
[0.370148] DMA: preallocated 4096 KiB pool for atomic coherent allocations
[0.32] cpuidle: using governor 

Re: How to use spi device from another kernel module?

2016-12-08 Thread Ran Shalit
On Wed, Dec 7, 2016 at 8:21 PM, Ran Shalit  wrote:
> On Wed, Dec 7, 2016 at 7:26 PM, Ran Shalit  wrote:
>> On Wed, Dec 7, 2016 at 6:58 PM, Joel Fernandes  wrote:
>>> On Tue, Dec 6, 2016 at 11:02 PM, Greg KH  wrote:
 On Tue, Dec 06, 2016 at 09:12:24PM -0800, Joel Fernandes wrote:
> On Tue, Dec 6, 2016 at 11:42 AM, Ran Shalit  wrote:
> > Hello,
> >
> > I have spi device which is registered using spi_register_board_info(),
> > and I would like to get a pointer to this device in some other kernel 
> > module.
> >
> > Is there a simple way to get a pointer to pointer to a device , so
> > that we can use it from other module ? (something like i2c_get_adapter
> > for i2c)
>
> Find out what's the SPI bus number (for the master) and the chip
> select on that SPI master (for the SPI device)
>
> Then you can use bus_for_each_device on spi_bus_type and find the
> spi_device you're looking for. See the following code for an example
> of how to use bus_for_each_device:
>
> Hi,
>
> I did try using this method with the following call:
>
> bus_for_each_dev(_bus_type, NULL, NULL, spi_device_found);
>
> static int spi_device_found(struct device *dev, void *data)
> {
> struct spi_device *spi = container_of(dev, struct spi_device, dev);
>
> printk(":  %s %s %dkHz %d bits mode=0x%02X\n",
> spi->modalias, dev_name(dev), spi->max_speed_hz/1000,
> spi->bits_per_word, spi->mode);
>
> return 0;
> }
>
> But for some reason the list is empty, although I do have devices
> registered successfuly with spi_register_driver.
> Using the same method with i2c works well, not sure why it doesn't
> list anything with spi.
>
> Thanks,
> Ran
>
>
> http://lxr.free-electrons.com/source/drivers/spi/spi.c#L524
>
> In your check function, just make sure your spi->master->bus_num is
> the bus you want and the spi->chip_select is the chip select
> corresponding to the device you want. If both these conditions are
> satisfied, there you have your spi_device.

 Eeek, no, please never do that, use the proper spi apis to get your
 needed device.  They are there somewhere, using a "raw"
 bus_for_each_device is never the answer unless you are a bus and
 iterating over your own device list.
>>>
>>> Yes I completely agree, maybe I assumed too much and thought he was
>>> trying to do this for some quick debugging from some kernel module,
>>> and was just looking for a quick and dirty way to get to a spi_device.
>>> Was not really suggesting this for production code. :)
>>>
If I may please ask one more thing on this issue, just for my understanding.
Before trying the above suggestions, I made the following trial (which
I know is quick and dirty ):

I copied the pointer to spi device from probe() function into static
variable and than tried to use it later (in proc/sysfs), but I get
exceptions.
I am not going to use this method anyway, yet I am curious why it doesn't work.

Thank you,
Ran

>>
>> You were actually Right... That's exactly what I wanted :) , so I
>> probably will  try to use your simple method.
>> I think that for production , spidev shows a good example how to use
>> spi as a char device:
>> https://github.com/Xilinx/linux-xlnx/blob/master/drivers/spi/spidev.c
>>
>> Thanks!
>> Ran
>>
>>> Regards,
>>> Joel
>>>

 thanks,

 greg k-h

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies