Sign up ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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


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

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

share|improve this question

migrated from Sep 3 '12 at 11:31

This question came from our site for professional and enthusiast programmers.

2 Answers 2

It's not possible, DD expects a file.

share|improve this answer
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.? – Matthew Hoggan Sep 3 '12 at 5:21
I think I answered my own question – Matthew Hoggan Sep 3 '12 at 5:21

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)
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.