Initial commit
Some checks failed
Build Kernel / Build all affected Kernels (push) Has been cancelled
Build all core packages / Build all core packages for selected target (push) Has been cancelled
Build and Push prebuilt tools container / Build and Push all prebuilt containers (push) Has been cancelled
Build Toolchains / Build Toolchains for each target (push) Has been cancelled
Build host tools / Build host tools for linux and macos based systems (push) Has been cancelled
Coverity scan build / Coverity x86/64 build (push) Has been cancelled

This commit is contained in:
domenico
2025-06-24 12:51:15 +02:00
commit 27c9d80f51
10493 changed files with 1885777 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
--- a/squashfs-tools/Makefile
+++ b/squashfs-tools/Makefile
@@ -7,6 +7,9 @@ all: mksquashfs unsquashfs
mksquashfs: mksquashfs.o read_fs.o sort.o
$(CC) mksquashfs.o read_fs.o sort.o -lz -o $@
+mksquashfs-lzma: mksquashfs.o read_fs.o sort.o
+ $(CXX) mksquashfs.o read_fs.o sort.o -L$(LZMAPATH) -llzma-old -o $@
+
mksquashfs.o: mksquashfs.c squashfs_fs.h mksquashfs.h global.h sort.h
read_fs.o: read_fs.c squashfs_fs.h read_fs.h global.h
@@ -16,4 +19,9 @@ sort.o: sort.c squashfs_fs.h global.h so
unsquashfs: unsquashfs.o
$(CC) unsquashfs.o -lz -o $@
+unsquashfs-lzma: unsquashfs.o
+ $(CXX) unsquashfs.o -L$(LZMAPATH) -llzma-old -o $@
+
unsquashfs.o: unsquashfs.c squashfs_fs.h read_fs.h global.h
+
+clean:

View File

@@ -0,0 +1,11 @@
--- a/squashfs-tools/mksquashfs.c
+++ b/squashfs-tools/mksquashfs.c
@@ -1347,7 +1347,7 @@ struct inode_info *lookup_inode(struct s
}
-inline void add_dir_entry(char *name, char *pathname, struct dir_info *sub_dir, struct inode_info *inode_info, void *data, struct dir_info *dir)
+static inline void add_dir_entry(char *name, char *pathname, struct dir_info *sub_dir, struct inode_info *inode_info, void *data, struct dir_info *dir)
{
if((dir->count % DIR_ENTRIES) == 0)
if((dir->list = realloc(dir->list, (dir->count + DIR_ENTRIES) * sizeof(struct dir_ent *))) == NULL)

View File

@@ -0,0 +1,79 @@
--- a/squashfs-tools/mksquashfs.c
+++ b/squashfs-tools/mksquashfs.c
@@ -117,6 +117,9 @@ unsigned int inode_bytes = 0, inode_size
char *data_cache = NULL;
unsigned int cache_bytes = 0, cache_size = 0, inode_count = 0;
+/* override all timestamps */
+time_t fixed_time = -1;
+
/* in memory directory data */
#define I_COUNT_SIZE 128
#define DIR_ENTRIES 32
@@ -1554,6 +1557,11 @@ void dir_scan(squashfs_inode *inode, cha
perror(buffer);
return;
}
+
+ /* override timestamp of lstat if fixed_time is given */
+ if(fixed_time != -1)
+ inode_info->buf.st_mtime = fixed_time;
+
if(sorted)
sort_files_and_write(dir_info);
dir_scan2(inode, dir_info);
@@ -1582,6 +1590,10 @@ struct dir_info *dir_scan1(char *pathnam
perror(buffer);
continue;
}
+
+ if(fixed_time != -1)
+ buf.st_mtime = fixed_time;
+
if(excluded(filename, &buf))
continue;
@@ -1621,6 +1633,9 @@ int dir_scan2(squashfs_inode *inode, str
char *dir_name = dir_ent->name;
unsigned int inode_number = ((buf->st_mode & S_IFMT) == S_IFDIR) ? dir_ent->inode->inode_number : dir_ent->inode->inode_number + dir_inode_no;
+ if(fixed_time != -1)
+ buf->st_mtime = fixed_time;
+
if(dir_ent->inode->inode == SQUASHFS_INVALID_BLK) {
switch(buf->st_mode & S_IFMT) {
case S_IFREG:
@@ -1898,6 +1913,16 @@ int main(int argc, char *argv[])
exit(1);
}
}
+ } else if(strcmp(argv[i], "-fixed-time") == 0) {
+ if(++i == argc) {
+ ERROR("%s: -fixed-time missing a timestamp\n", argv[0]);
+ exit(1);
+ }
+ fixed_time = strtoll(argv[i], &b, 10);
+ if(*b != '\0') {
+ ERROR("%s: -fixed-time has an invalid number\n", argv[0]);
+ exit(1);
+ }
} else if(strcmp(argv[i], "-noI") == 0 ||
strcmp(argv[i], "-noInodeCompression") == 0)
noI = TRUE;
@@ -1967,6 +1992,7 @@ printOptions:
ERROR("-all-root\t\tmake all files owned by root\n");
ERROR("-force-uid uid\t\tset all file uids to uid\n");
ERROR("-force-gid gid\t\tset all file gids to gid\n");
+ ERROR("-fixed-time timestamp\tset all timestamps to timestamp\n");
ERROR("-le\t\t\tcreate a little endian filesystem\n");
ERROR("-be\t\t\tcreate a big endian filesystem\n");
ERROR("-nopad\t\t\tdo not pad filesystem to a multiple of 4K\n");
@@ -2190,7 +2216,7 @@ printOptions:
sBlk.block_size = block_size;
sBlk.block_log = block_log;
sBlk.flags = SQUASHFS_MKFLAGS(noI, noD, check_data, noF, no_fragments, always_use_fragments, duplicate_checking);
- sBlk.mkfs_time = time(NULL);
+ sBlk.mkfs_time = fixed_time != -1 ? fixed_time : time(NULL);
restore_filesystem:
write_fragment();

View File

@@ -0,0 +1,20 @@
--- a/squashfs-tools/mksquashfs.c
+++ b/squashfs-tools/mksquashfs.c
@@ -30,6 +30,7 @@
#include <unistd.h>
#include <stdio.h>
#include <sys/types.h>
+#include <sys/sysmacros.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
--- a/squashfs-tools/unsquashfs.c
+++ b/squashfs-tools/unsquashfs.c
@@ -25,6 +25,7 @@
#define FALSE 0
#include <stdio.h>
#include <sys/types.h>
+#include <sys/sysmacros.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>

View File

@@ -0,0 +1,25 @@
Fixes the following build error with GCC 10:
/usr/bin/ld: read_fs.o:(.bss+0x0): multiple definition of `swap'; mksquashfs.o:(.bss+0x1b2a88): first defined here
And a compile warning.
--- a/squashfs-tools/read_fs.c
+++ b/squashfs-tools/read_fs.c
@@ -61,7 +61,7 @@ extern int add_file(long long, long long
fprintf(stderr, s, ## args); \
} while(0)
-int swap;
+static int swap;
int read_block(int fd, long long start, long long *next, unsigned char *block, squashfs_super_block *sBlk)
{
--- a/squashfs-tools/mksquashfs.c
+++ b/squashfs-tools/mksquashfs.c
@@ -258,6 +258,7 @@ int read_sort_file(char *filename, int s
void sort_files_and_write(struct dir_info *dir);
struct file_info *duplicate(char *(get_next_file_block)(struct duplicate_buffer_handle *, unsigned int), struct duplicate_buffer_handle *file_start, long long bytes, unsigned int **block_list, long long *start, int blocks, struct fragment **fragment, char *frag_data, int frag_bytes);
struct dir_info *dir_scan1(char *, int (_readdir)(char *, char *, struct dir_info *));
+int dir_scan2(squashfs_inode *inode, struct dir_info *dir_info);
#define MKINODE(A) ((squashfs_inode)(((squashfs_inode) inode_bytes << 16) + (((char *)A) - data_cache)))

View File

@@ -0,0 +1,11 @@
--- a/squashfs-tools/mksquashfs.c
+++ b/squashfs-tools/mksquashfs.c
@@ -1822,7 +1822,7 @@ int main(int argc, char *argv[])
{
struct stat buf, source_buf;
int i;
- squashfs_super_block sBlk;
+ squashfs_super_block sBlk = {};
char *b, *root_name = NULL;
int be, nopad = FALSE, keep_as_directory = FALSE, orig_be;
squashfs_inode inode;