-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tools: bootconfig: Add bootconfig command
Add "bootconfig" command which operates the bootconfig config-data on initrd image. User can add/delete/verify the boot config on initrd image using this command. e.g. Add a boot config to initrd image # bootconfig -a myboot.conf /boot/initrd.img Remove it. # bootconfig -d /boot/initrd.img Or verify (and show) it. # bootconfig /boot/initrd.img Link: http://lkml.kernel.org/r/157867223582.17873.14342161849213219982.stgit@devnote2 Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org> [ Removed extra blank line at end of bootconfig.c ] Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
- Loading branch information
Masami Hiramatsu
authored and
Steven Rostedt (VMware)
committed
Jan 13, 2020
1 parent
7684b85
commit 950313e
Showing
12 changed files
with
481 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
bootconfig |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# SPDX-License-Identifier: GPL-2.0 | ||
# Makefile for bootconfig command | ||
|
||
bindir ?= /usr/bin | ||
|
||
HEADER = include/linux/bootconfig.h | ||
CFLAGS = -Wall -g -I./include | ||
|
||
PROGS = bootconfig | ||
|
||
all: $(PROGS) | ||
|
||
bootconfig: ../../lib/bootconfig.c main.c $(HEADER) | ||
$(CC) $(filter %.c,$^) $(CFLAGS) -o $@ | ||
|
||
install: $(PROGS) | ||
install bootconfig $(DESTDIR)$(bindir) | ||
|
||
clean: | ||
$(RM) -f *.o bootconfig |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/* SPDX-License-Identifier: GPL-2.0 */ | ||
#ifndef _BOOTCONFIG_LINUX_BOOTCONFIG_H | ||
#define _BOOTCONFIG_LINUX_BOOTCONFIG_H | ||
|
||
#include "../../../../include/linux/bootconfig.h" | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/* SPDX-License-Identifier: GPL-2.0 */ | ||
#ifndef _SKC_LINUX_BUG_H | ||
#define _SKC_LINUX_BUG_H | ||
|
||
#include <stdio.h> | ||
#include <stdlib.h> | ||
|
||
#define WARN_ON(cond) \ | ||
((cond) ? printf("Internal warning(%s:%d, %s): %s\n", \ | ||
__FILE__, __LINE__, __func__, #cond) : 0) | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/* SPDX-License-Identifier: GPL-2.0 */ | ||
#ifndef _SKC_LINUX_CTYPE_H | ||
#define _SKC_LINUX_CTYPE_H | ||
|
||
#include <ctype.h> | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/* SPDX-License-Identifier: GPL-2.0 */ | ||
#ifndef _SKC_LINUX_ERRNO_H | ||
#define _SKC_LINUX_ERRNO_H | ||
|
||
#include <asm/errno.h> | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/* SPDX-License-Identifier: GPL-2.0 */ | ||
#ifndef _SKC_LINUX_KERNEL_H | ||
#define _SKC_LINUX_KERNEL_H | ||
|
||
#include <stdlib.h> | ||
#include <stdbool.h> | ||
|
||
#include <linux/printk.h> | ||
|
||
typedef unsigned short u16; | ||
typedef unsigned int u32; | ||
|
||
#define unlikely(cond) (cond) | ||
|
||
#define __init | ||
#define __initdata | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* SPDX-License-Identifier: GPL-2.0 */ | ||
#ifndef _SKC_LINUX_PRINTK_H | ||
#define _SKC_LINUX_PRINTK_H | ||
|
||
#include <stdio.h> | ||
|
||
/* controllable printf */ | ||
extern int pr_output; | ||
#define printk(fmt, ...) \ | ||
(pr_output ? printf(fmt, __VA_ARGS__) : 0) | ||
|
||
#define pr_err printk | ||
#define pr_warn printk | ||
#define pr_info printk | ||
#define pr_debug printk | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* SPDX-License-Identifier: GPL-2.0 */ | ||
#ifndef _SKC_LINUX_STRING_H | ||
#define _SKC_LINUX_STRING_H | ||
|
||
#include <string.h> | ||
|
||
/* Copied from lib/string.c */ | ||
static inline char *skip_spaces(const char *str) | ||
{ | ||
while (isspace(*str)) | ||
++str; | ||
return (char *)str; | ||
} | ||
|
||
static inline char *strim(char *s) | ||
{ | ||
size_t size; | ||
char *end; | ||
|
||
size = strlen(s); | ||
if (!size) | ||
return s; | ||
|
||
end = s + size - 1; | ||
while (end >= s && isspace(*end)) | ||
end--; | ||
*(end + 1) = '\0'; | ||
|
||
return skip_spaces(s); | ||
} | ||
|
||
#endif |
Oops, something went wrong.