lol

squashfsTools: 4.6.1 -> 4.7.2 (#415303)

authored by

Sandro and committed by
GitHub
aa1bdb48 a1901f2b

+2 -108
-100
pkgs/by-name/sq/squashfsTools/4k-align.patch
··· 1 - This patch is an old patch; see below for the original message body. The patch 2 - has been updated several times to be compatible with new releases. 3 - 4 - * To apply to squashfs 4.4, commit 52eb4c279cd283ed9802dd1ceb686560b22ffb67. 5 - * To apply to squashfs 4.5, commit 0496d7c3de3e09da37ba492081c86159806ebb07. 6 - * To apply to squashfs 4.6, commit f7623b3d9953a1190fec181708c9489ef3522b9f. 7 - 8 - From af8a6dca694ddd38d8a775a2b5f9a24fe2d10153 Mon Sep 17 00:00:00 2001 9 - From: Amin Hassani <ahassani@google.com> 10 - Date: Thu, 15 Dec 2016 10:43:15 -0800 11 - Subject: [PATCH] mksquashfs 4K aligns the files inside the squashfs image 12 - 13 - Files inside a squashfs image are not necessarily 4k (4096) 14 - aligned. This patch starts each file in a 4k aligned address and pads 15 - zero to the end of the file until it reaches the next 4k aligned 16 - address. This will not change the size of the compressed 17 - blocks (especially the last one) and hence it will not change how the 18 - files are being loaded in kernel or unsquashfs. However on average this 19 - increases the size of the squashfs image which can be calculated by the 20 - following formula: 21 - 22 - increased_size = (number_of_unfragmented_files_in_image + number of fragments) * 2048 23 - 24 - The 4k alignment can be enabled by flag '-4k-align' 25 - --- 26 - squashfs-tools/mksquashfs.c | 16 ++++++++++++++++ 27 - 1 file changed, 16 insertions(+) 28 - 29 - diff --git a/squashfs-tools/mksquashfs.c b/squashfs-tools/mksquashfs.c 30 - index 3429aac..db164c2 100644 31 - --- a/squashfs-tools/mksquashfs.c 32 - +++ b/squashfs-tools/mksquashfs.c 33 - @@ -82,6 +82,8 @@ int noI = FALSE; 34 - int noId = FALSE; 35 - int noD = FALSE; 36 - int noX = FALSE; 37 - +int do_4k_align = FALSE; 38 - +#define ALIGN_UP(bytes, size) (bytes = (bytes + size - 1) & ~(size - 1)) 39 - 40 - /* block size used to build filesystem */ 41 - int block_size = SQUASHFS_FILE_SIZE; 42 - @@ -1624,6 +1626,9 @@ static void unlock_fragments() 43 - * queue at this time. 44 - */ 45 - while(!queue_empty(locked_fragment)) { 46 - + // 4k align the start of remaining queued fragments. 47 - + if(do_4k_align) 48 - + ALIGN_UP(bytes, 4096); 49 - write_buffer = queue_get(locked_fragment); 50 - frg = write_buffer->block; 51 - size = SQUASHFS_COMPRESSED_SIZE_BLOCK(fragment_table[frg].size); 52 - @@ -2627,6 +2632,9 @@ static void *frag_deflator(void *arg) 53 - write_buffer->size = compressed_size; 54 - pthread_mutex_lock(&fragment_mutex); 55 - if(fragments_locked == FALSE) { 56 - + // 4k align the start of each fragment. 57 - + if(do_4k_align) 58 - + ALIGN_UP(bytes, 4096); 59 - fragment_table[file_buffer->block].size = c_byte; 60 - fragment_table[file_buffer->block].start_block = bytes; 61 - write_buffer->block = bytes; 62 - @@ -3021,6 +3029,10 @@ static struct file_info *write_file_blocks(int *status, struct dir_ent *dir_ent, 63 - struct file_info *file; 64 - int bl_hash = 0; 65 - 66 - + // 4k align the start of each file. 67 - + if(do_4k_align) 68 - + ALIGN_UP(bytes, 4096); 69 - + 70 - if(pre_duplicate(read_size, dir_ent->inode, read_buffer, &bl_hash)) 71 - return write_file_blocks_dup(status, dir_ent, read_buffer, dup, bl_hash); 72 - 73 - @@ -6169,6 +6181,7 @@ static void print_options(FILE *stream, char *name, int total_mem) 74 - fprintf(stream, "or metadata. This is\n\t\t\tequivalent to "); 75 - fprintf(stream, "specifying -noI -noD -noF and -noX\n"); 76 - fprintf(stream, "\nFilesystem build options:\n"); 77 - + fprintf(stream, "-4k-align\t\tenables 4k alignment of all files\n"); 78 - fprintf(stream, "-tar\t\t\tread uncompressed tar file from standard in (stdin)\n"); 79 - fprintf(stream, "-no-strip\t\tact like tar, and do not strip leading "); 80 - fprintf(stream, "directories\n\t\t\tfrom source files\n"); 81 - @@ -6690,6 +6703,7 @@ static void print_summary() 82 - "compressed", no_fragments ? "no" : noF ? "uncompressed" : 83 - "compressed", no_xattrs ? "no" : noX ? "uncompressed" : 84 - "compressed", noI || noId ? "uncompressed" : "compressed"); 85 - + printf("\t4k %saligned\n", do_4k_align ? "" : "un"); 86 - printf("\tduplicates are %sremoved\n", duplicate_checking ? "" : 87 - "not "); 88 - printf("Filesystem size %.2f Kbytes (%.2f Mbytes)\n", bytes / 1024.0, 89 - @@ -8417,6 +8431,8 @@ print_compressor_options: 90 - } else if(strcmp(argv[i], "-comp") == 0) { 91 - /* parsed previously */ 92 - i++; 93 - + } else if(strcmp(argv[i], "-4k-align") == 0) { 94 - + do_4k_align = TRUE; 95 - } else { 96 - ERROR("%s: invalid option\n\n", argv[0]); 97 - print_options(stderr, argv[0], total_mem); 98 - -- 99 - 2.39.2 100 -
+2 -8
pkgs/by-name/sq/squashfsTools/package.nix
··· 14 14 15 15 stdenv.mkDerivation rec { 16 16 pname = "squashfs"; 17 - version = "4.6.1"; 17 + version = "4.7.2"; 18 18 19 19 src = fetchFromGitHub { 20 20 owner = "plougher"; 21 21 repo = "squashfs-tools"; 22 22 rev = version; 23 - hash = "sha256-fJ+Ijg0cj92abGe80+1swVeZamarVpnPYM7+izcPJ+k="; 23 + hash = "sha256-iQ+pBt+jvqI6zgZRV2MZM3CeFqiXe8Z+SS+rLOB4DLw="; 24 24 }; 25 - 26 - patches = [ 27 - # This patch adds an option to pad filesystems (increasing size) in 28 - # exchange for better chunking / binary diff calculation. 29 - ./4k-align.patch 30 - ]; 31 25 32 26 strictDeps = true; 33 27 nativeBuildInputs = [