Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
M
Magisk
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Magisk
Commits
6b41653a
Commit
6b41653a
authored
Sep 12, 2017
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add kernel decompression and appended dtb support
parent
59c1125e
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
164 additions
and
135 deletions
+164
-135
bootimg.c
jni/magiskboot/bootimg.c
+134
-123
bootimg.h
jni/magiskboot/bootimg.h
+29
-11
magiskboot.h
jni/magiskboot/magiskboot.h
+1
-1
No files found.
jni/magiskboot/bootimg.c
View file @
6b41653a
This diff is collapsed.
Click to expand it.
jni/magiskboot/bootimg.h
View file @
6b41653a
...
@@ -2,20 +2,21 @@
...
@@ -2,20 +2,21 @@
**
**
** Copyright 2007, The Android Open Source Project
** Copyright 2007, The Android Open Source Project
**
**
** Licensed under the Apache License, Version 2.0 (the "License");
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
** You may obtain a copy of the License at
**
**
** http://www.apache.org/licenses/LICENSE-2.0
** http://www.apache.org/licenses/LICENSE-2.0
**
**
** Unless required by applicable law or agreed to in writing, software
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** See the License for the specific language governing permissions and
** limitations under the License.
** limitations under the License.
*/
*/
#include <stdint.h>
#include <stdint.h>
#include "magic.h"
#ifndef _BOOT_IMAGE_H_
#ifndef _BOOT_IMAGE_H_
#define _BOOT_IMAGE_H_
#define _BOOT_IMAGE_H_
...
@@ -64,12 +65,12 @@ struct boot_img_hdr
...
@@ -64,12 +65,12 @@ struct boot_img_hdr
}
__attribute__
((
packed
));
}
__attribute__
((
packed
));
/*
/*
** +-----------------+
** +-----------------+
** | boot header | 1 page
** | boot header | 1 page
** +-----------------+
** +-----------------+
** | kernel | n pages
** | kernel | n pages
** +-----------------+
** +-----------------+
** | ramdisk | m pages
** | ramdisk | m pages
** +-----------------+
** +-----------------+
** | second stage | o pages
** | second stage | o pages
** +-----------------+
** +-----------------+
...
@@ -99,4 +100,21 @@ typedef struct mtk_hdr {
...
@@ -99,4 +100,21 @@ typedef struct mtk_hdr {
uint8_t
name
[
32
];
/* The type of the header */
uint8_t
name
[
32
];
/* The type of the header */
}
mtk_hdr
;
}
mtk_hdr
;
// Flags
#define MTK_KERNEL 0x1
#define MTK_RAMDISK 0x2
#define APPEND_DTB 0x4
typedef
struct
boot_img
{
boot_img_hdr
hdr
;
void
*
kernel
;
void
*
ramdisk
;
void
*
second
;
void
*
dtb
;
void
*
extra
;
int
flags
;
file_t
kernel_type
,
ramdisk_type
;
mtk_hdr
mtk_kernel_hdr
,
mtk_ramdisk_hdr
;
}
boot_img
;
#endif
#endif
jni/magiskboot/magiskboot.h
View file @
6b41653a
...
@@ -35,7 +35,7 @@ extern file_t SUP_TYPE_LIST[];
...
@@ -35,7 +35,7 @@ extern file_t SUP_TYPE_LIST[];
void
unpack
(
const
char
*
image
);
void
unpack
(
const
char
*
image
);
void
repack
(
const
char
*
orig_image
,
const
char
*
out_image
);
void
repack
(
const
char
*
orig_image
,
const
char
*
out_image
);
void
hexpatch
(
const
char
*
image
,
const
char
*
from
,
const
char
*
to
);
void
hexpatch
(
const
char
*
image
,
const
char
*
from
,
const
char
*
to
);
int
parse_img
(
void
*
orig
,
size_t
size
);
int
parse_img
(
void
*
orig
,
size_t
size
,
boot_img
*
boot
);
int
cpio_commands
(
const
char
*
command
,
int
argc
,
char
*
argv
[]);
int
cpio_commands
(
const
char
*
command
,
int
argc
,
char
*
argv
[]);
void
comp_file
(
const
char
*
method
,
const
char
*
from
,
const
char
*
to
);
void
comp_file
(
const
char
*
method
,
const
char
*
from
,
const
char
*
to
);
void
decomp_file
(
char
*
from
,
const
char
*
to
);
void
decomp_file
(
char
*
from
,
const
char
*
to
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment