0

I would like to use a device label instead of the device in a script that I am writing so I can use the script on multiple computers.

I want to change the line:

sudo dd if=$(TARGET) of=/dev/sdb

To

sudo dd if=$(TARGET) of=$(LABEL_NAME)

How do I do this? This script is part of a GNUMakefile.

2 Answers 2

0

It's not possible, DD expects a file.

2
  • Is there not some clever way to map a label back to a device? Some command I can run, provide it a label and get the device back, put this in a recipe etc.? Sep 3, 2012 at 5:21
  • I think I answered my own question linux.die.net/man/8/findfs Sep 3, 2012 at 5:21
0

Solution to problem:

AR = ar
LD = ld
LL = ls -l
SRC = putstring.s
OBJ = $(SRC:%.s=%.o)
FILE = $(shell findfs LABEL=SEGATEUSB)

TARGET = putstring

all : $(OBJ) $(TARGET)

$(OBJ) : $(SRC)
        as -o $@ $<

$(TARGET) : $(OBJ)
        ld --oformat binary -Tlinker.ld -o $@ $^

install :
        sudo dd if=$(TARGET) of=$(FILE)

clean :
        rm -f $(OBJ) $(TARGET)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .