LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices



Reply
 
Search this Thread
Old 07-16-2012, 05:40 AM   #1
nathan2225
LQ Newbie
 
Registered: Jun 2006
Posts: 22

Rep: Reputation: 0
Question Try to find boot device from init.sh


Hi !
I'm creating a linux-image which can boot on different hardware configurations. At some point of the init process i want to map the boot device to a fix path e.g. /instlpart to load some extra data from it.

So i my case the the boot device is varies, depending on the hardware config / image type , sometimes /dev/sda, /dev/sda1 or /dev/sdc

So how can i determine in the init.sh where i can find the extra data ?
Thanks
Robert
 
Old 07-17-2012, 02:11 PM   #2
silendo
Member
 
Registered: Jun 2012
Location: Italy
Distribution: Slackware 13.37
Posts: 45

Rep: Reputation: Disabled
The extra data can you recall in other script?
 
Old 07-18-2012, 02:05 PM   #3
nathan2225
LQ Newbie
 
Registered: Jun 2006
Posts: 22

Original Poster
Rep: Reputation: 0
Unhappy

I just need the device so i can mount it afterwards to lets say /installdevice !
I think i could do an fdisk or somehow check for a partition name or something like that..
But that would be some work, i just wonder if linux -kernel can't tell me somehow from which partition is was loaded
I have the BIOS data, something like 8:1:1 but i don't know how to translate this into a linux device.
 
Old 07-18-2012, 02:43 PM   #4
whizje
Member
 
Registered: Sep 2008
Location: The Netherlands
Distribution: Slackware64 current
Posts: 583

Rep: Reputation: 129Reputation: 129
maybe through /sys/block/*/device
Code:
bash-4.2$ ls -l /sys/block/*/device 
lrwxrwxrwx 1 root root 0 Jul 18 11:47 /sys/block/sda/device -> ../../../0:0:0:0
lrwxrwxrwx 1 root root 0 Jul 18 11:47 /sys/block/sdb/device -> ../../../1:0:0:0
lrwxrwxrwx 1 root root 0 Jul 18 11:47 /sys/block/sdc/device -> ../../../2:0:0:0
lrwxrwxrwx 1 root root 0 Jul 18 11:47 /sys/block/sdd/device -> ../../../3:0:0:0
lrwxrwxrwx 1 root root 0 Jul 18 11:47 /sys/block/sde/device -> ../../../4:0:0:0
lrwxrwxrwx 1 root root 0 Jul 18 11:47 /sys/block/sdf/device -> ../../../8:0:0:0
lrwxrwxrwx 1 root root 0 Jul 18 11:47 /sys/block/sr0/device -> ../../../6:0:0:0
or
Code:
bash-4.2$ lsscsi 
[0:0:0:0]    disk    ATA      ST2000DM001-9YN1 CC4B  /dev/sda 
[1:0:0:0]    disk    ATA      SAMSUNG HD103SI  1AG0  /dev/sdb 
[2:0:0:0]    disk    ATA      SAMSUNG HD204UI  1AQ1  /dev/sdc 
[3:0:0:0]    disk    ATA      ST31000528AS     CC38  /dev/sdd 
[4:0:0:0]    disk    ATA      WDC WD800JD-75MS 10.0  /dev/sde 
[6:0:0:0]    cd/dvd  _NEC     DVD_RW ND-3550A  1.05  /dev/sr0 
[8:0:0:0]    disk    SanDisk  Cruzer Blade     1.00  /dev/sdf

Last edited by whizje; 07-18-2012 at 02:46 PM.
 
Old 07-19-2012, 09:10 AM   #5
nathan2225
LQ Newbie
 
Registered: Jun 2006
Posts: 22

Original Poster
Rep: Reputation: 0
Hi whizje,

yes, that are excellect ideas ! Now i'm able to convert the BIOS number to a device ! (need to mount sysfs ?)
Second idea is even better, but busybox (i' using to boot/config) does not support this command.
But in a newer version of busybox i found support for findfs -LABEL which gave me a simple way(without text parsing) to mount via Volume-Name !

Many thanks
Robert
 
Old 07-19-2012, 09:28 AM   #6
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,487

Rep: Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077
All circumstantial evidence.
Once the kernel is loaded you can never guarantee where it was loaded from.

If it's "your" system. perhaps you can have some confidence, but from a security perspective, you can't trust the data.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Can't find boot device? derchris Linux - General 10 03-18-2011 10:55 AM
[SOLVED] FC 10: RAID failure test: grub cannot find boot device jot Fedora 3 03-26-2009 10:11 AM
Cant find /init during PowerPC initramfs boot kermitG Linux - Embedded & Single-board computer 1 02-16-2009 10:59 AM
unable to find device-mapper major/minor? help!!!!! can't boot up! kernel panic! newtovanilla Linux - Newbie 5 11-23-2008 03:39 PM
UL 1.0 GRUB: could not find device for /boot: not found or not a block device cma Linux - General 4 12-12-2005 04:35 AM


All times are GMT -5. The time now is 12:49 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration