[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Booting a CF or SD card from an internal card reader



On Fri 05 May 2017 at 07:58:06 (-0500), Richard Owlett wrote:
> On 05/05/2017 04:28 AM, Brian wrote:
> >On Fri 05 May 2017 at 05:34:13 +0200, Leandro Noferini wrote:
> >
> >>Brian <ad44@cityscape.co.uk> writes:
> >>
> >>>1. This HOWTO is a result of the discussion on debian-user beginning at
> >
> >It should be stressed that the HOWTO is applicable only to devices on
> >the USB bus.
> >
> >>Thanks a lot for this document because it hits a problem I found many
> >>months ago without solution for me. I would like to use my internal card
> >>reader (Lenovo X240) to boot in tails (https://tails.boum.org)
> >
> >I rarely dabble in hardware-related things, so a mistake or two could
> >creep into what follows.
> >
> >>My reader appears this way:
> >>
> >>====================================================================
> >>~ $ lsusb
> >>Bus 001 Device 003: ID 058f:9540 Alcor Micro Corp. AU9540 Smartcard Reader
> >>====================================================================
> >
> >The Lenovo X240 has a Smart Card reader and a 4-in-1 card reader (MMC,
> >SD, SDHC, SDXC). The Smart Card reader is on the USB bus. I have never
> >used one but it appears to have something to do with identity cards.
> >GRUB does not detect it with nativedisk so booting from it is not
> >possible.
> >
> >>The sd card with tails on appears this way:
> >>
> >>====================================================================
> >>leandro@tricheco:~$ sudo fdisk /dev/mmcblk0
> >>
> >>Welcome to fdisk (util-linux 2.29.2).
> >>Changes will remain in memory only, until you decide to write them.
> >>Be careful before using the write command.
> >>
> >>Command (m for help): p
> >>Disk /dev/mmcblk0: 7,4 GiB, 7969177600 bytes, 15564800 sectors
> >>Units: sectors of 1 * 512 = 512 bytes
> >>Sector size (logical/physical): 512 bytes / 512 bytes
> >>I/O size (minimum/optimal): 512 bytes / 512 bytes
> >>Disklabel type: gpt
> >>Disk identifier: F12D15CF-2FC3-4852-8226-9D4F7E625B29
> >>
> >>Device         Start     End Sectors  Size Type
> >>/dev/mmcblk0p1  2048 5122047 5120000  2,5G EFI System
> >>====================================================================
> >
> >This is the 4-in-1 card reader; the one you want you are trying to boot
> >from. As indicted by /dev/mmcblk0p1 it is on the PCI bus. 'lspci' should
> >display the chip used; one from Ricoh?
> >
> >GRUB doesn't see anything on this bus (it has no drivers for the device),
> >so booting from it is not possible.
> >
> >>Following your document I edited /etc/grub.d/40_custom adding these
> >>lines:
> >>
> >>====================================================================
> >>menuentry 'Tails on CF card' {
> >>	insmod part_msdos
> >>        insmod ext2
> >>        echo "Running nativedisk command. Please wait."
> >>        nativedisk
> >>        search --label --set=root TAILS
> >>        linux /vmlinuz root=LABEL=TAILS ro
> >>        initrd /initrd.img
> >>}
> >>====================================================================
> >>
> >>But it is not working.
> >>
> >>If I give the "nativedisk" command in grub command line I get only
> >>
> >>====================================================================
> >>(ahci0)
> >>====================================================================
> >>
> >>Where am I wrong?
> >
> >I think you have possibly not appreciated the distinction between a card
> >reader on a USB bus and one on a PCI bus. The first should be visible to
> >GRUB and nativedisk (but, as you have seen, isn't always). The second is
> >never visible to GRUB.
> >
> 
> Not true.
> On my Lenovo T510 laptop I have
> 
> root@march-9-Jessie:/home/richard# ls /dev/mm*
> /dev/mmcblk0  /dev/mmcblk0p1  /dev/mmcblk0p2  /dev/mmcblk0p5
> 
> Although my BIOS will not boot from /dev/mmcblk0, the GRUB resident
> on /dev/sda1 has no trouble finding Debian on /dev/mmcblk0p1.

Which Grub are you talking about? Just to clarify, Grub running in
Linux (lspci, lsusb, etc given to a $ or # prompt) may have no
trouble; it's got a full set of drivers available. What we're
interested in is Grub running at boot time where it gives this
prompt:

grub>

This can still be part of "GRUB resident on" /dev/sda, if not
/dev/sda1, but the Linux OS's drivers are absent.

Looking back at this and the preceding thread, you posted:

> On 04/12/2017 12:13 PM, Pascal Hambourg wrote:
>> - while the SD card is inserted, in the GRUB menu press "c" to enter a
>> GRUB shell and report the result of the "ls" command.
>
>Did not see any way to capture the output. So made manual copy. The
>following appeared on a single line.
>
>(hd0) (hd0, msdos9) (hd0, msdos8) (hd0, msdos7) (hd0, msdos6)
>(hd0, msdos5) (hd0, msdos1) (hd1) (hd1, msdos1)

I see nothing here corresponding to /dev/mmcblk0p1.

> My notes are:
>
> with no usb devices present, I get
> (ahci) (ahci0,msdosXX) (ahci1)
> where XX maches the partions on my "hard disk" {it is actually a
> solid state drive which was manufactured to be a plugin replacement
> for original mechanical dive (aka 'spinning rust'}.
> I don't know what (ahci1) is.
>
> Repeating above with empty card reader I get:
> (ahci) (ahci0,msdosXX) (usb0a) (usb0b) (ahci1)
>
> I repeated the above with the SD card plugged into a USB card reader
> getting:
> (ahci) (ahci0,msdosXX) (usb0a) (usb0a,msdos1) (usb0b) (ahci1)
>
> When not using "nativedisk" in the second case I get:
> (hd0) (hd0,msdosXX) (hd1) (hd1,msdos1)

I see nothing here corresponding to /dev/mmcblk0p1.

(For those who haven't looked back at the thread, the (hd1,msdos1)
seen here is a red herring, a "USB flash drive that was plugged in.
It is FAT formatted and used to exchange information with my Windows
machine.")

What we haven't yet seen posted is the unambiguous output of
grub> ls
grub> nativedisk
grub> ls
for the Lenovo with only the SD card and the internal drive (needed
to boot the MBR) connected; the SD card plugged into the actual
slot cut out of the casing of the PC, of course, and not through
some other hardware device/adapter/reader/choose-your-favourite-word.

All the stuff left ahead is Linux stuff, not Grub:

> root@march-9-Jessie:/home/richard# lspci -tv
> -+-[0000:ff]-+-00.0  Intel Corporation Core Processor QuickPath
> Architecture Generic Non-core Registers
>  |           +-00.1  Intel Corporation Core Processor QuickPath
> Architecture System Address Decoder
>  |           +-02.0  Intel Corporation Core Processor QPI Link 0
>  |           +-02.1  Intel Corporation 1st Generation Core Processor
> QPI Physical 0
>  |           +-02.2  Intel Corporation 1st Generation Core Processor
> Reserved
>  |           \-02.3  Intel Corporation 1st Generation Core Processor
> Reserved
>  \-[0000:00]-+-00.0  Intel Corporation Core Processor DRAM Controller
>              +-02.0  Intel Corporation Core Processor Integrated
> Graphics Controller
>              +-16.0  Intel Corporation 5 Series/3400 Series Chipset
> HECI Controller
>              +-19.0  Intel Corporation 82577LM Gigabit Network Connection
>              +-1a.0  Intel Corporation 5 Series/3400 Series Chipset
> USB2 Enhanced Host Controller
>              +-1b.0  Intel Corporation 5 Series/3400 Series Chipset
> High Definition Audio
>              +-1c.0-[02]--
>              +-1c.1-[03]----00.0  Intel Corporation Centrino
> Advanced-N 6200
>              +-1c.3-[05-0c]----00.0  Renesas Technology Corp.
> uPD720202 USB 3.0 Host Controller
>              +-1c.4-[0d]--+-00.0  Ricoh Co Ltd MMC/SD Host Controller
>              |            +-00.1  Ricoh Co Ltd R5U2xx (R5U230 /
> R5U231 / R5U241) [Memory Stick Host Controller]
>              |            \-00.3  Ricoh Co Ltd R5C832 PCIe IEEE 1394
> Controller
>              +-1d.0  Intel Corporation 5 Series/3400 Series Chipset
> USB2 Enhanced Host Controller
>              +-1e.0-[0e]--
>              +-1f.0  Intel Corporation Mobile 5 Series Chipset LPC
> Interface Controller
>              +-1f.2  Intel Corporation 5 Series/3400 Series Chipset
> 6 port SATA AHCI Controller
>              +-1f.3  Intel Corporation 5 Series/3400 Series Chipset
> SMBus Controller
>              \-1f.6  Intel Corporation 5 Series/3400 Series Chipset
> Thermal Subsystem

Cheers,
David.


Reply to: