aboutsummaryrefslogtreecommitdiffstats
path: root/tools/squashfs4/patches/200-add-fixed-timestamp-option.patch
blob: 7ac1765eed22a371f8584e4a3968941eb923fa89 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
Index: squashfs4.2/squashfs-tools/mksquashfs.c
===================================================================
--- squashfs4.2.orig/squashfs-tools/mksquashfs.c
+++ squashfs4.2/squashfs-tools/mksquashfs.c
@@ -175,6 +175,9 @@ unsigned int cache_bytes = 0, cache_size
 /* inode lookup table */
 squashfs_inode *inode_lookup_table = NULL;
 
+/* override all timestamps */
+time_t fixed_time = -1;
+
 /* in memory directory data */
 #define I_COUNT_SIZE		128
 #define DIR_ENTRIES		32
@@ -2452,6 +2455,8 @@ again:
 restat:
 	fstat(file, &buf2);
 	close(file);
+	if (fixed_time != -1)
+		buf2.st_mtime = fixed_time;
 	if(read_size != buf2.st_size) {
 		memcpy(buf, &buf2, sizeof(struct stat));
 		file_buffer->error = 2;
@@ -3612,7 +3617,7 @@ void dir_scan(squashfs_inode *inode, cha
 		buf.st_mode = S_IRWXU | S_IRWXG | S_IRWXO | S_IFDIR;
 		buf.st_uid = getuid();
 		buf.st_gid = getgid();
-		buf.st_mtime = time(NULL);
+		buf.st_mtime = fixed_time != -1 ? fixed_time : time(NULL);
 		buf.st_dev = 0;
 		buf.st_ino = 0;
 		dir_ent->inode = lookup_inode(&buf);
@@ -3623,6 +3628,8 @@ void dir_scan(squashfs_inode *inode, cha
 				pathname, strerror(errno));
 			return;
 		}
+		if(fixed_time != -1)
+			buf.st_mtime = fixed_time;
 		dir_ent->inode = lookup_inode(&buf);
 	}
 
@@ -3677,6 +3684,8 @@ struct dir_info *dir_scan1(char *pathnam
 				filename, strerror(errno));
 			continue;
 		}
+		if(fixed_time != -1)
+			buf.st_mtime = fixed_time;
 
 		if((buf.st_mode & S_IFMT) != S_IFREG &&
 			(buf.st_mode & S_IFMT) != S_IFDIR &&
@@ -3795,7 +3804,7 @@ struct dir_info *dir_scan2(struct dir_in
 		buf.st_gid = pseudo_ent->dev->gid;
 		buf.st_rdev = makedev(pseudo_ent->dev->major,
 			pseudo_ent->dev->minor);
-		buf.st_mtime = time(NULL);
+		buf.st_mtime = fixed_time != -1 ? fixed_time : time(NULL);
 		buf.st_ino = pseudo_ino ++;
 
 		if(pseudo_ent->dev->type == 'f') {
@@ -4674,6 +4683,15 @@ int main(int argc, char *argv[])
 			progress = FALSE;
 		else if(strcmp(argv[i], "-no-exports") == 0)
 			exportable = FALSE;
+		else if(strcmp(argv[i], "-fixed-time") == 0) {
+			if((++i == argc) || (fixed_time =
+					strtoll(argv[i], &b, 10), *b != '\0')) {
+				ERROR("%s: -fixed-time missing or invalid "
+					"timestamp\n", argv[0]);
+
+				exit(1);
+			}
+		}
 		else if(strcmp(argv[i], "-processors") == 0) {
 			if((++i == argc) || (processors =
 					strtol(argv[i], &b, 10), *b != '\0')) {
@@ -5314,7 +5332,7 @@ printOptions:
 	sBlk.flags = SQUASHFS_MKFLAGS(noI, noD, noF, noX, no_fragments,
 		always_use_fragments, duplicate_checking, exportable,
 		no_xattrs, comp_opts);
-	sBlk.mkfs_time = time(NULL);
+	sBlk.mkfs_time = fixed_time != -1 ? fixed_time : time(NULL);
 
 restore_filesystem:
 	if(progress && estimated_uncompressed) {
00; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
Index: linux-3.10/drivers/hwmon/bcm2835-hwmon.c
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ linux-3.10/drivers/hwmon/bcm2835-hwmon.c	2013-07-09 20:25:51.309324091 +0100
@@ -0,0 +1,219 @@
+/*****************************************************************************
+* Copyright 2011 Broadcom Corporation.  All rights reserved.
+*
+* Unless you and Broadcom execute a separate written software license
+* agreement governing use of this software, this software is licensed to you
+* under the terms of the GNU General Public License version 2, available at
+* http://www.broadcom.com/licenses/GPLv2.php (the "GPL").
+*
+* Notwithstanding the above, under no circumstances may you combine this
+* software in any way with any other Broadcom software provided under a
+* license other than the GPL, without Broadcom's express prior written
+* consent.
+*****************************************************************************/
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/hwmon.h>
+#include <linux/hwmon-sysfs.h>
+#include <linux/platform_device.h>
+#include <linux/sysfs.h>
+#include <mach/vcio.h>
+#include <linux/slab.h>
+#include <linux/err.h>
+
+#define MODULE_NAME "bcm2835_hwmon"
+
+/*#define HWMON_DEBUG_ENABLE*/
+
+#ifdef HWMON_DEBUG_ENABLE
+#define print_debug(fmt,...) printk(KERN_INFO "%s:%s:%d: "fmt"\n", MODULE_NAME, __func__, __LINE__, ##__VA_ARGS__)
+#else
+#define print_debug(fmt,...)
+#endif
+#define print_err(fmt,...) printk(KERN_ERR "%s:%s:%d: "fmt"\n", MODULE_NAME, __func__,__LINE__, ##__VA_ARGS__)
+#define print_info(fmt,...) printk(KERN_INFO "%s: "fmt"\n", MODULE_NAME, ##__VA_ARGS__)
+
+#define VC_TAG_GET_TEMP 0x00030006
+#define VC_TAG_GET_MAX_TEMP 0x0003000A
+
+/* --- STRUCTS --- */
+struct bcm2835_hwmon_data {
+	struct device *hwmon_dev;
+};
+
+/* tag part of the message */
+struct vc_msg_tag {
+	uint32_t tag_id;		/* the tag ID for the temperature */
+	uint32_t buffer_size;	/* size of the buffer (should be 8) */
+	uint32_t request_code;	/* identifies message as a request (should be 0) */
+	uint32_t id;			/* extra ID field (should be 0) */
+	uint32_t val;			/* returned value of the temperature */
+};
+
+/* message structure to be sent to videocore */
+struct vc_msg {
+	uint32_t msg_size;		/* simply, sizeof(struct vc_msg) */
+	uint32_t request_code;		/* holds various information like the success and number of bytes returned (refer to mailboxes wiki) */
+	struct vc_msg_tag tag;		/* the tag structure above to make */
+	uint32_t end_tag;		/* an end identifier, should be set to NULL */
+};
+
+typedef enum {
+	TEMP,
+	MAX_TEMP,
+} temp_type;
+
+/* --- PROTOTYPES --- */
+static ssize_t bcm2835_get_temp(struct device *dev, struct device_attribute *attr, char *buf);
+static ssize_t bcm2835_get_name(struct device *dev, struct device_attribute *attr, char *buf);
+
+/* --- GLOBALS --- */
+
+static struct bcm2835_hwmon_data *bcm2835_data;
+static struct platform_driver bcm2835_hwmon_driver;
+
+static SENSOR_DEVICE_ATTR(name, S_IRUGO,bcm2835_get_name,NULL,0);
+static SENSOR_DEVICE_ATTR(temp1_input,S_IRUGO,bcm2835_get_temp,NULL,TEMP);
+static SENSOR_DEVICE_ATTR(temp1_max,S_IRUGO,bcm2835_get_temp,NULL,MAX_TEMP);
+
+static struct attribute* bcm2835_attributes[] = {
+	&sensor_dev_attr_name.dev_attr.attr,
+	&sensor_dev_attr_temp1_input.dev_attr.attr,
+	&sensor_dev_attr_temp1_max.dev_attr.attr,
+	NULL,
+};
+
+static struct attribute_group bcm2835_attr_group = {
+	.attrs = bcm2835_attributes,
+};
+
+/* --- FUNCTIONS --- */
+
+static ssize_t bcm2835_get_name(struct device *dev, struct device_attribute *attr, char *buf)
+{
+	return sprintf(buf,"bcm2835_hwmon\n");
+}
+
+static ssize_t bcm2835_get_temp(struct device *dev, struct device_attribute *attr, char *buf)
+{
+	struct vc_msg msg;
+	int result;
+	uint temp = 0;
+	int index = ((struct sensor_device_attribute*)to_sensor_dev_attr(attr))->index;
+
+	print_debug("IN");
+
+	/* wipe all previous message data */
+	memset(&msg, 0, sizeof msg);
+
+	/* determine the message type */
+	if(index == TEMP)
+		msg.tag.tag_id = VC_TAG_GET_TEMP;
+	else if (index == MAX_TEMP)
+		msg.tag.tag_id = VC_TAG_GET_MAX_TEMP;
+	else
+	{
+		print_debug("Unknown temperature message!");
+		return -EINVAL;
+	}
+
+	msg.msg_size = sizeof msg;
+	msg.tag.buffer_size = 8;
+
+	/* send the message */
+	result = bcm_mailbox_property(&msg, sizeof msg);
+
+	/* check if it was all ok and return the rate in milli degrees C */
+	if (result == 0 && (msg.request_code & 0x80000000))
+		temp = (uint)msg.tag.val;
+	#ifdef HWMON_DEBUG_ENABLE
+	else
+		print_debug("Failed to get temperature!");
+	#endif
+	print_debug("Got temperature as %u",temp);
+	print_debug("OUT");
+	return sprintf(buf, "%u\n", temp);
+}
+
+
+static int bcm2835_hwmon_probe(struct platform_device *pdev)
+{
+	int err;
+
+	print_debug("IN");
+	print_debug("HWMON Driver has been probed!");
+
+	/* check that the device isn't null!*/
+	if(pdev == NULL)
+	{
+		print_debug("Platform device is empty!");
+		return -ENODEV;
+	}
+
+	/* allocate memory for neccessary data */
+	bcm2835_data = kzalloc(sizeof(struct bcm2835_hwmon_data),GFP_KERNEL);
+	if(!bcm2835_data)
+	{
+		print_debug("Unable to allocate memory for hwmon data!");
+		err = -ENOMEM;
+		goto kzalloc_error;
+	}
+
+	/* create the sysfs files */
+	if(sysfs_create_group(&pdev->dev.kobj, &bcm2835_attr_group))
+	{
+		print_debug("Unable to create sysfs files!");
+		err = -EFAULT;
+		goto sysfs_error;
+	}
+
+	/* register the hwmon device */
+	bcm2835_data->hwmon_dev = hwmon_device_register(&pdev->dev);
+	if (IS_ERR(bcm2835_data->hwmon_dev))
+	{
+		err = PTR_ERR(bcm2835_data->hwmon_dev);
+		goto hwmon_error;
+	}
+	print_debug("OUT");
+	return 0;
+
+	/* error goto's */
+	hwmon_error:
+	sysfs_remove_group(&pdev->dev.kobj, &bcm2835_attr_group);
+
+	sysfs_error:
+	kfree(bcm2835_data);
+
+	kzalloc_error:
+
+	return err;
+
+}
+
+static int bcm2835_hwmon_remove(struct platform_device *pdev)
+{
+	print_debug("IN");
+	hwmon_device_unregister(bcm2835_data->hwmon_dev);
+
+	sysfs_remove_group(&pdev->dev.kobj, &bcm2835_attr_group);
+	print_debug("OUT");
+	return 0;
+}
+
+/* Hwmon Driver */
+static struct platform_driver bcm2835_hwmon_driver = {
+	.probe = bcm2835_hwmon_probe,
+	.remove = bcm2835_hwmon_remove,
+	.driver = {
+				.name = "bcm2835_hwmon",
+				.owner = THIS_MODULE,
+			},
+};
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Dorian Peake");
+MODULE_DESCRIPTION("HW Monitor driver for bcm2835 chip");
+
+module_platform_driver(bcm2835_hwmon_driver);
Index: linux-3.10/drivers/hwmon/Kconfig
===================================================================
--- linux-3.10.orig/drivers/hwmon/Kconfig	2013-07-09 20:25:51.321324159 +0100
+++ linux-3.10/drivers/hwmon/Kconfig	2013-07-09 20:25:51.313324108 +0100
@@ -1537,6 +1537,16 @@
         help
           Support for the A/D converter on MC13783 and MC13892 PMIC.
 
+config SENSORS_BCM2835
+	depends on THERMAL_BCM2835=n
+	tristate "Broadcom BCM2835 HWMON Driver"
+	help
+	  If you say yes here you get support for the hardware
+	  monitoring features of the BCM2835 Chip
+
+	  This driver can also be built as a module.  If so, the module
+	  will be called bcm2835-hwmon.
+
 if ACPI
 
 comment "ACPI drivers"
Index: linux-3.10/drivers/hwmon/Makefile
===================================================================
--- linux-3.10.orig/drivers/hwmon/Makefile	2013-07-09 20:25:51.321324159 +0100
+++ linux-3.10/drivers/hwmon/Makefile	2013-07-09 20:26:07.361403698 +0100
@@ -141,6 +141,7 @@
 obj-$(CONFIG_SENSORS_WM831X)	+= wm831x-hwmon.o
 obj-$(CONFIG_SENSORS_WM8350)	+= wm8350-hwmon.o
 obj-$(CONFIG_SENSORS_GSC)	+= gsc.o
+obj-$(CONFIG_SENSORS_BCM2835)	+= bcm2835-hwmon.o
 
 obj-$(CONFIG_PMBUS)		+= pmbus/