You are not logged in.

#1 2014-03-05 20:08:05

gava
Member
Registered: 2014-02-26
Posts: 14

[SOLVED] initramfs mac address

I need to read the mac address of the embedded network card while in initramfs (only network device available).
Is there any way to get an interface up on this device? I read about the net hook but im not trying to use a nfs so it seems like an overkill
(and im not really sure if the net hook is seting the interfaces or just using them).
My current system autodetects the interfaces and sets them up once systemd/udev kiks in but the initramfs only shows the lo interface.

Last edited by gava (2014-03-10 12:12:11)

Offline

#2 2014-03-05 20:15:57

alphaniner
Member
From: Ancapistan
Registered: 2010-07-12
Posts: 2,810

Re: [SOLVED] initramfs mac address

I use the ifconfig binary that comes with the mkinitcpio-nfs package for another type of network booting, it does set IP address.

But if you only need to get the mac address, see if /sys/class/net/<dev>/address exists in the initramfs.

Edit: device entries [other than lo] will only be in /sys/class/net/ if the driver is installed in your initramfs.

Last edited by alphaniner (2014-03-05 20:47:05)


But whether the Constitution really be one thing, or another, this much is certain - that it has either authorized such a government as we have had, or has been powerless to prevent it. In either case, it is unfit to exist.
-Lysander Spooner

Offline

#3 2014-03-06 12:12:00

gava
Member
Registered: 2014-02-26
Posts: 14

Re: [SOLVED] initramfs mac address

Oh, a driver issue could fit (I could read the mac address out of the box on qemu but not when installed on the new motherboard).
Any clues as to where are the drivers and how to add them to the initramfs? (they are bundled with the kernel right?)
I'm guessing I'll need to add a hook with the appropriate modules added but im not sure as to where to find them.
Maybe the ones in /usr/lib/modules/3.13.5-1-ARCH/kernel/drivers/net/ethernet ? (its an embedded network card (not wireless))
hm, or /usr/lib/modules/3.13.5-1-ARCH/kernel/net/... so many options...
I guess it's time for a little research, trial and error.

Offline

#4 2014-03-06 14:18:08

alphaniner
Member
From: Ancapistan
Registered: 2010-07-12
Posts: 2,810

Re: [SOLVED] initramfs mac address

This simple hook (/usr/lib/initcpio/install/net) should work:

#!/usr/bin/bash

build() {
    add_checked_modules '/drivers/net/'
}

But that will pull all net modules when building the fallback image, so it would be better to figure out what module you need and just add it to the MODULES array in mkinitcpio.conf


But whether the Constitution really be one thing, or another, this much is certain - that it has either authorized such a government as we have had, or has been powerless to prevent it. In either case, it is unfit to exist.
-Lysander Spooner

Offline

#5 2014-03-10 12:11:23

gava
Member
Registered: 2014-02-26
Posts: 14

Re: [SOLVED] initramfs mac address

I was already using the net hook. It would appear that the fallback image was working as expected but the default one wasnt (autodetect + mkinitcpio in a different pc to the one that runs the image). I removed the fallback and made the default one drop the autodetect hook. Now everything is working as required.
Thanks for the help.

Offline

Board footer

Powered by FluxBB