mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
To: barebox@lists.infradead.org
Subject: [PATCH 1/5] filetype: add Bourne Shell support
Date: Wed, 18 Apr 2012 14:27:43 +0200	[thread overview]
Message-ID: <1334752067-11445-1-git-send-email-plagnioj@jcrosoft.com> (raw)
In-Reply-To: <20120418120230.GC1980@game.jcrosoft.org>

Put it at first as it's the most likely to detect

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 common/filetype.c  |    3 +++
 include/filetype.h |    1 +
 2 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/common/filetype.c b/common/filetype.c
index 0120913..15a3732 100644
--- a/common/filetype.c
+++ b/common/filetype.c
@@ -38,6 +38,7 @@ static const char *filetype_str[] = {
 	[filetype_bzip2] = "bzip2 compressed",
 	[filetype_oftree] = "open firmware flat device tree",
 	[filetype_aimage] = "Android boot image",
+	[filetype_sh] = "Bourne Shell",
 };
 
 const char *file_type_to_string(enum filetype f)
@@ -53,6 +54,8 @@ enum filetype file_detect_type(void *_buf)
 	u32 *buf = _buf;
 	u8 *buf8 = _buf;
 
+	if (strncmp(buf8, "#!/bin/sh", 9) == 0)
+		return filetype_sh;
 	if (buf[8] == 0x65726162 && buf[9] == 0x00786f62)
 		return filetype_arm_barebox;
 	if (buf[9] == 0x016f2818 || buf[9] == 0x18286f01)
diff --git a/include/filetype.h b/include/filetype.h
index d0b6226..9338793 100644
--- a/include/filetype.h
+++ b/include/filetype.h
@@ -16,6 +16,7 @@ enum filetype {
 	filetype_bzip2,
 	filetype_oftree,
 	filetype_aimage,
+	filetype_sh,
 };
 
 const char *file_type_to_string(enum filetype f);
-- 
1.7.9.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2012-04-18 12:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-18 12:02 [PATCH 0/5 v2] introduce binfmt support Jean-Christophe PLAGNIOL-VILLARD
2012-04-18 12:27 ` Jean-Christophe PLAGNIOL-VILLARD [this message]
2012-04-18 12:27 ` [PATCH 2/5 v2] Introduce " Jean-Christophe PLAGNIOL-VILLARD
2012-04-18 12:27 ` [PATCH 3/5] bootm: add uimage " Jean-Christophe PLAGNIOL-VILLARD
2012-04-18 12:27 ` [PATCH 4/5 v2] arm: bootm: add barebox, zImage and aImage " Jean-Christophe PLAGNIOL-VILLARD
2012-04-18 12:27 ` [PATCH 5/5] defaultenv: add " Jean-Christophe PLAGNIOL-VILLARD
2012-04-18 18:42 ` [PATCH 0/5 v2] introduce " Sascha Hauer
  -- strict thread matches above, loose matches on Subject: below --
2012-04-13  7:57 [PATCH 0/5] " Jean-Christophe PLAGNIOL-VILLARD
2012-04-13  8:02 ` [PATCH 1/5] filetype: add Bourne Shell support Jean-Christophe PLAGNIOL-VILLARD

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1334752067-11445-1-git-send-email-plagnioj@jcrosoft.com \
    --to=plagnioj@jcrosoft.com \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox