@@ -240,7 +240,7 @@ int decompress_xz(const uint8_t *src, size_t srcSize, uint8_t **dst, uint32_t *d
240240 enum xz_ret ret = xz_dec_run (s , & b );
241241
242242 if (ret != XZ_STREAM_END ) {
243- tools_loge ("[Error] XZ Decompression failed: %d\n" , ret );
243+ tools_loge ("XZ Decompression failed: %d\n" , ret );
244244 free (* dst );
245245 xz_dec_end (s );
246246 return -1 ;
@@ -275,7 +275,7 @@ int decompress_lzma(const uint8_t *src, size_t srcSize, uint8_t **dst, uint32_t
275275 enum xz_ret ret = xz_dec_run (s , & b );
276276
277277 if (ret != XZ_STREAM_END ) {
278- tools_loge ("[Error] Your xz-embedded version only supports XZ container (Method 6).\n" );
278+ tools_loge ("Your xz-embedded version only supports XZ container (Method 6).\n" );
279279 free (* dst );
280280 xz_dec_end (s );
281281 return -1 ;
@@ -294,19 +294,19 @@ int auto_depress(const uint8_t *data, size_t size, const char *out_path) {
294294
295295
296296 if (method == 1 ) { //Gzip
297- tools_logi ("[Info] Detected GZIP compressed kernel.\n" );
297+ tools_logi ("Detected GZIP compressed kernel.\n" );
298298 if (decompress_gzip (data , size , out_path ) == 0 ) {
299- tools_logi ("[Success] Decompressed to %s\n" , out_path );
299+ tools_logi (" Decompressed to %s\n" , out_path );
300300 return 0 ;
301301 } else {
302- tools_logi ("[Error] Gzip decompression failed.\n" );
302+ tools_logi (" Gzip decompression failed.\n" );
303303 return -1 ;
304304 }
305305 }
306306
307307
308308 if (method == 2 ) {
309- tools_logi ("[Info] Detected LZ4 Frame. Decompressing with lz4frame...\n" );
309+ tools_logi (" Detected LZ4 Frame. Decompressing with lz4frame...\n" );
310310 LZ4F_decompressionContext_t dctx ;
311311 LZ4F_createDecompressionContext (& dctx , LZ4F_VERSION );
312312
@@ -320,12 +320,12 @@ int auto_depress(const uint8_t *data, size_t size, const char *out_path) {
320320 size_t ret = LZ4F_decompress (dctx , dst , & producedSize , data , & consumedSize , NULL );
321321
322322 if (LZ4F_isError (ret )) {
323- tools_loge ("[Error] LZ4 Decompression failed: %s\n" , LZ4F_getErrorName (ret ));
323+ tools_loge ("LZ4 Decompression failed: %s\n" , LZ4F_getErrorName (ret ));
324324 free (dst );
325325 LZ4F_freeDecompressionContext (dctx );
326326 return -1 ;
327327 } else {
328- tools_logi ("[Success] Decompressed: %zu bytes\n" , producedSize );
328+ tools_logi ("Decompressed: %zu bytes\n" , producedSize );
329329 write_data_to_file (out_path , (uint8_t * )dst , (uint32_t )producedSize );
330330 free (dst );
331331 LZ4F_freeDecompressionContext (dctx );
@@ -334,7 +334,7 @@ int auto_depress(const uint8_t *data, size_t size, const char *out_path) {
334334 }
335335
336336 if (method == 3 ) {
337- tools_logi ("[Info] Detected LZ4 Legacy. Decompressing with LZ4 Block API...\n" );
337+ tools_logi ("Detected LZ4 Legacy. Decompressing with LZ4 Block API...\n" );
338338
339339 const char * compressed_ptr = (const char * )data + 4 ;
340340 int compressed_size = (int )size - 4 ;
@@ -346,11 +346,11 @@ int auto_depress(const uint8_t *data, size_t size, const char *out_path) {
346346 int ret = LZ4_decompress_safe (compressed_ptr , (char * )dst , compressed_size , (int )dstCapacity );
347347
348348 if (ret < 0 ) {
349- tools_loge ("[Error] LZ4 Legacy decompression failed.\n" );
349+ tools_loge ("LZ4 Legacy decompression failed.\n" );
350350 free (dst );
351351 return -1 ;
352352 } else {
353- tools_logi ("[Success] Decompressed: %d bytes\n" , ret );
353+ tools_logi ("Decompressed: %d bytes\n" , ret );
354354 write_data_to_file (out_path , (uint8_t * )dst , (uint32_t )ret );
355355 free (dst );
356356 return 0 ;
@@ -359,10 +359,10 @@ int auto_depress(const uint8_t *data, size_t size, const char *out_path) {
359359
360360 // till now no kernel use this
361361 // if (method == 4) {
362- // tools_logi("[Info] Detected ZSTD compressed kernel. Decompressing...\n");
362+ // tools_logi("Detected ZSTD compressed kernel. Decompressing...\n");
363363 // unsigned long long const rSize = ZSTD_getFrameContentSize(data, size);
364364 // if (rSize == ZSTD_CONTENTSIZE_ERROR || rSize == ZSTD_CONTENTSIZE_UNKNOWN) {
365- // tools_loge("[Error] Not a valid Zstd frame or size unknown.\n");
365+ // tools_loge("Not a valid Zstd frame or size unknown.\n");
366366 // return -1;
367367 // }
368368
@@ -372,25 +372,25 @@ int auto_depress(const uint8_t *data, size_t size, const char *out_path) {
372372 // size_t const dSize = ZSTD_decompress(dst, (size_t)rSize, data, size);
373373
374374 // if (ZSTD_isError(dSize)) {
375- // tools_loge("[Error] Zstd Decompression failed: %s\n", ZSTD_getErrorName(dSize));
375+ // tools_loge(" Zstd Decompression failed: %s\n", ZSTD_getErrorName(dSize));
376376 // free(dst);
377377 // return -1;
378378 // } else {
379- // tools_logi("[Success] Decompressed: %zu bytes\n", dSize);
379+ // tools_logi(" Decompressed: %zu bytes\n", dSize);
380380 // write_data_to_file(out_path, dst, (uint32_t)dSize);
381381 // free(dst);
382382 // return 0;
383383 // }
384384 // }
385385
386386 if (method == 5 ) { // BZIP2
387- tools_logi ("[Info] Detected BZIP2. Decompressing...\n" );
387+ tools_logi ("Detected BZIP2. Decompressing...\n" );
388388
389389
390390 unsigned int dstCapacity = 64 * 1024 * 1024 ;
391391 void * dst = malloc (dstCapacity );
392392 if (!dst ) {
393- tools_loge ("[Error] Failed to allocate memory for BZIP2 decompression.\n" );
393+ tools_loge ("Failed to allocate memory for BZIP2 decompression.\n" );
394394 return -1 ;
395395 }
396396
@@ -400,54 +400,54 @@ int auto_depress(const uint8_t *data, size_t size, const char *out_path) {
400400 int ret = BZ2_bzBuffToBuffDecompress ((char * )dst , & producedSize , (char * )data , consumedSize , 0 , 0 );
401401
402402 if (ret != BZ_OK ) {
403- tools_loge ("[Error] BZIP2 Decompression failed with error code: %d\n" , ret );
403+ tools_loge (" BZIP2 Decompression failed with error code: %d\n" , ret );
404404 free (dst );
405405 return -1 ;
406406 }
407407
408- tools_logi ("[Success] BZIP2 Decompressed: %u bytes\n" , producedSize );
408+ tools_logi (" BZIP2 Decompressed: %u bytes\n" , producedSize );
409409 write_data_to_file (out_path , (uint8_t * )dst , producedSize );
410410 free (dst );
411411 return 0 ;
412412 }
413413
414414 if (method == 6 ) { // XZ
415- tools_logi ("[Info] Detected XZ format. Decompressing...\n" );
415+ tools_logi (" Detected XZ format. Decompressing...\n" );
416416
417417 uint8_t * xz_dst = NULL ;
418418 uint32_t xz_size = 0 ;
419419
420420 if (decompress_xz (data , size , & xz_dst , & xz_size ) == 0 ) {
421- tools_logi ("[Success] XZ Decompressed: %u bytes\n" , xz_size );
421+ tools_logi ("XZ Decompressed: %u bytes\n" , xz_size );
422422 write_data_to_file (out_path , xz_dst , xz_size );
423423 free (xz_dst );
424424 return 0 ;
425425 } else {
426- tools_loge ("[Error] XZ Decompression failed.\n" );
426+ tools_loge (" XZ Decompression failed.\n" );
427427 return -1 ;
428428 }
429429 }
430430
431431 if (method == 7 ) { // LZMA Legacy
432- tools_logi ("[Info] Detected Legacy LZMA format. Decompressing...\n" );
432+ tools_logi ("Detected Legacy LZMA format. Decompressing...\n" );
433433
434434 uint8_t * lzma_dst = NULL ;
435435 uint32_t lzma_size = 0 ;
436436
437437 if (decompress_lzma (data , size , & lzma_dst , & lzma_size ) == 0 ) {
438- tools_logi ("[Success] LZMA Decompressed: %u bytes\n" , lzma_size );
438+ tools_logi (" LZMA Decompressed: %u bytes\n" , lzma_size );
439439 write_data_to_file (out_path , lzma_dst , lzma_size );
440440 free (lzma_dst );
441441 return 0 ;
442442 } else {
443- tools_loge ("[Error] LZMA Decompression failed.\n" );
443+ tools_loge (" LZMA Decompression failed.\n" );
444444 return -1 ;
445445 }
446446 }
447447
448- tools_logi ("[Info] Treating as Raw Kernel (or unknown format).\n" );
448+ tools_logi ("Treating as Raw Kernel (or unknown format).\n" );
449449 if (write_data_to_file (out_path , data , size ) == 0 ) {
450- tools_logi ("[Success] Saved raw kernel to %s\n" , out_path );
450+ tools_logi (" Saved raw kernel to %s\n" , out_path );
451451 return 0 ;
452452 }
453453
@@ -526,7 +526,7 @@ int detect_compress_method(compress_head data) {
526526int repack_bootimg (const char * orig_boot_path ,
527527 const char * new_kernel_path ,
528528 const char * out_boot_path ) {
529- tools_logi ("[Process] Starting automatic repack...\n" );
529+ tools_logi (" Starting automatic repack...\n" );
530530
531531 FILE * f_orig = fopen (orig_boot_path , "rb" );
532532 if (!f_orig ) return -1 ;
@@ -535,7 +535,7 @@ int repack_bootimg(const char *orig_boot_path,
535535 fread (& hdr , sizeof (hdr ), 1 , f_orig );
536536
537537 if (memcmp (hdr .magic , "ANDROID!" , 8 ) != 0 ) {
538- tools_logi ("[Error] Not a valid Android Boot Image.\n" );
538+ tools_logi ("Not a valid Android Boot Image.\n" );
539539 fclose (f_orig );
540540 return -2 ;
541541 }
@@ -550,7 +550,7 @@ int repack_bootimg(const char *orig_boot_path,
550550
551551 uint32_t header_ver = hdr .unused [0 ];
552552 uint32_t page_size = (header_ver >= 3 ) ? 4096 : hdr .page_size ;
553- tools_logi ("[Info] Header Version: %u, Page Size: %u\n" , header_ver , page_size );
553+ tools_logi ("Header Version: %u, Page Size: %u\n" , header_ver , page_size );
554554
555555 uint8_t * old_k_full = malloc (hdr .kernel_size );
556556 fseek (f_orig , page_size , SEEK_SET );
@@ -570,7 +570,7 @@ int repack_bootimg(const char *orig_boot_path,
570570 dtb_size = hdr .kernel_size - dtb_off ;
571571 extracted_dtb = malloc (dtb_size );
572572 memcpy (extracted_dtb , old_k_full + dtb_off , dtb_size );
573- tools_logi ("[Info] Detected DTB appended to kernel. Size: %u\n" , dtb_size );
573+ tools_logi ("Detected DTB appended to kernel. Size: %u\n" , dtb_size );
574574 }
575575 }
576576 free (old_k_full );
@@ -590,30 +590,30 @@ int repack_bootimg(const char *orig_boot_path,
590590 uint8_t * compressed_buf = NULL ;
591591
592592 if (method == 1 ) {
593- tools_logi ("[Info] Compressing new kernel with GZIP...\n" );
593+ tools_logi ("Compressing new kernel with GZIP...\n" );
594594 if (compress_gzip (raw_k_buf , raw_k_size , & compressed_buf , & final_k_size ) == 0 ) {
595595 final_k_buf = compressed_buf ;
596596 }
597597 }
598598 if (method == 2 ) {
599- tools_logi ("[Info] Compressing new kernel with LZ4...\n" );
599+ tools_logi ("Compressing new kernel with LZ4...\n" );
600600 if (compress_lz4 (raw_k_buf , raw_k_size , & compressed_buf , & final_k_size ) == 0 ) {
601601 final_k_buf = compressed_buf ;
602602 }
603603 }
604604 if (method == 3 ) {
605- tools_logi ("[Info] Compressing new kernel with LZ4 Legacy...\n" );
605+ tools_logi ("Compressing new kernel with LZ4 Legacy...\n" );
606606 if (compress_lz4_le (raw_k_buf , raw_k_size , & compressed_buf , & final_k_size ) == 0 ) {
607607 final_k_buf = compressed_buf ;
608608 }
609609 }
610610 if (method == 4 ) {
611- tools_logi ("[error] Kernel uses zstd, we have not supported it yet, please report to dev\n" );
611+ tools_logi (" Kernel uses zstd, we have not supported it yet, please report to dev\n" );
612612 return -1 ;
613613 }
614614
615615 if (method == 5 ) { // BZIP2
616- tools_logi ("[Info] Compressing new kernel with BZIP2 (Level 9)...\n" );
616+ tools_logi (" Compressing new kernel with BZIP2 (Level 9)...\n" );
617617
618618 unsigned int max_out_size = (unsigned int )(raw_k_size * 1.01 ) + 600 ;
619619 uint8_t * compressed_buf = (uint8_t * )malloc (max_out_size );
@@ -627,23 +627,23 @@ int repack_bootimg(const char *orig_boot_path,
627627 if (ret == BZ_OK ) {
628628 final_k_buf = compressed_buf ;
629629 final_k_size = final_size ;
630- tools_logi ("[Success] BZIP2 compression complete. Size: %u bytes\n" , final_k_size );
630+ tools_logi ("BZIP2 compression complete. Size: %u bytes\n" , final_k_size );
631631 } else {
632- tools_loge ("[Error] BZIP2 compression failed: %d\n" , ret );
632+ tools_loge ("BZIP2 compression failed: %d\n" , ret );
633633 free (compressed_buf );
634634 return -1 ;
635635 }
636636 }
637637 if (method == 6 || method == 7 ) {
638- tools_logi ("[Info] Original was XZ/LZMA. Repacking as GZIP for compatibility...\n" );
638+ tools_logi (" Original was XZ/LZMA. Repacking as GZIP for compatibility...\n" );
639639 uint8_t * compressed_buf = NULL ;
640640 uint32_t final_k_size = 0 ;
641641 if (compress_gzip (raw_k_buf , raw_k_size , & compressed_buf , & final_k_size ) == 0 ) {
642642 final_k_buf = compressed_buf ;
643643 method = 1 ;
644- tools_logi ("[Success] Repacked as GZIP. New Size: %u bytes\n" , final_k_size );
644+ tools_logi ("Repacked as GZIP. New Size: %u bytes\n" , final_k_size );
645645 } else {
646- tools_loge ("[Error] GZIP compression failed during XZ-to-GZIP conversion.\n" );
646+ tools_loge ("GZIP compression failed during XZ-to-GZIP conversion.\n" );
647647 return -1 ;
648648 }
649649 }
@@ -704,6 +704,6 @@ int repack_bootimg(const char *orig_boot_path,
704704 free (raw_k_buf );
705705 if (rest_buf ) free (rest_buf );
706706
707- tools_logi ("[Success] Repack completed: %s\n" , out_boot_path );
707+ tools_logi ("Repack completed: %s\n" , out_boot_path );
708708 return 0 ;
709709}
0 commit comments