android_kernel_xiaomi_sm7250/arch/powerpc/boot
Masahiro Yamada 4b9dc73a0d powerpc/boot: add {get, put}_unaligned_be32 to xz_config.h
[ Upstream commit 9e005b761e7ad153dcf40a6cba1d681fe0830ac6 ]

The next commit will make the way of passing CONFIG options more robust.
Unfortunately, it would uncover another hidden issue; without this
commit, skiroot_defconfig would be broken like this:

|   WRAP    arch/powerpc/boot/zImage.pseries
| arch/powerpc/boot/wrapper.a(decompress.o): In function `bcj_powerpc.isra.10':
| decompress.c:(.text+0x720): undefined reference to `get_unaligned_be32'
| decompress.c:(.text+0x7a8): undefined reference to `put_unaligned_be32'
| make[1]: *** [arch/powerpc/boot/Makefile;383: arch/powerpc/boot/zImage.pseries] Error 1
| make: *** [arch/powerpc/Makefile;295: zImage] Error 2

skiroot_defconfig is the only defconfig that enables CONFIG_KERNEL_XZ
for ppc, which has never been correctly built before.

I figured out the root cause in lib/decompress_unxz.c:

| #ifdef CONFIG_PPC
| #      define XZ_DEC_POWERPC
| #endif

CONFIG_PPC is undefined here in the ppc bootwrapper because autoconf.h
is not included except by arch/powerpc/boot/serial.c

XZ_DEC_POWERPC is not defined, therefore, bcj_powerpc() is not compiled
for the bootwrapper.

With the next commit passing CONFIG_PPC correctly, we would realize that
{get,put}_unaligned_be32 was missing.

Unlike the other decompressors, the ppc bootwrapper duplicates all the
necessary helpers in arch/powerpc/boot/.

The other architectures define __KERNEL__ and pull in helpers for
building the decompressors.

If ppc bootwrapper had defined __KERNEL__, lib/xz/xz_private.h would
have included <asm/unaligned.h>:

| #ifdef __KERNEL__
| #       include <linux/xz.h>
| #       include <linux/kernel.h>
| #       include <asm/unaligned.h>

However, doing so would cause tons of definition conflicts since the
bootwrapper has duplicated everything.

I just added copies of {get,put}_unaligned_be32, following the
bootwrapper coding convention.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20190705100144.28785-1-yamada.masahiro@socionext.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-07-31 07:27:07 +02:00
..
dts powerpc updates for 4.19 2018-08-17 11:32:50 -07:00
.gitignore
4xx.c
4xx.h
44x.h
addnote.c powerpc/boot: Fix missing check of lseek() return value 2019-05-31 06:46:11 -07:00
bamboo.c
cpm-serial.c
crt0.S powerpc: Fix COFF zImage booting on old powermacs 2019-01-13 09:50:54 +01:00
crtsavres.S
cuboot-8xx.c
cuboot-52xx.c
cuboot-83xx.c
cuboot-85xx-cpm2.c
cuboot-85xx.c
cuboot-824x.c
cuboot-acadia.c
cuboot-amigaone.c
cuboot-bamboo.c
cuboot-ebony.c
cuboot-hotfoot.c
cuboot-katmai.c
cuboot-kilauea.c
cuboot-mpc7448hpc2.c
cuboot-pq2.c
cuboot-rainier.c
cuboot-sam440ep.c
cuboot-sequoia.c
cuboot-taishan.c
cuboot-warp.c
cuboot-yosemite.c
cuboot.c
cuboot.h
dcr.h
decompress.c
devtree.c
div64.S
dummy.c
ebony.c
elf_util.c
elf.h
ep88xc.c
ep405.c
ep8248e.c
epapr-wrapper.c
epapr.c
fixed-head.S
fixup-headers.sed
fsl-soc.c
fsl-soc.h
gamecube-head.S
gamecube.c
hack-coff.c
holly.c
install.sh
io.h
libfdt_env.h
libfdt-wrapper.c
main.c
Makefile powerpc/boot: Set target when cross-compiling for clang 2019-01-13 09:51:05 +01:00
mktree.c
motload-head.S
mpc8xx.c
mpc8xx.h
mpc52xx-psc.c
mvme5100.c
mvme7100.c
ns16550.c
of.c
of.h
ofconsole.c
oflib.c
opal-calls.S
opal.c
ops.h
page.h
planetcore.c
planetcore.h
ppc_asm.h
ppcboot-hotfoot.h
ppcboot.h
pq2.c
pq2.h
ps3-head.S
ps3-hvcall.S
ps3.c
pseries-head.S
README
redboot-8xx.c
redboot-83xx.c
redboot.h
reg.h
rs6000.h
serial.c
simple_alloc.c
simpleboot.c
stdbool.h
stdint.h
stdio.c
stdio.h
stdlib.c
stdlib.h
string.h
string.S
swab.h
treeboot-akebono.c
treeboot-bamboo.c
treeboot-currituck.c
treeboot-ebony.c
treeboot-iss4xx.c
treeboot-walnut.c
types.h
uartlite.c
ugecon.c
ugecon.h
util.S
virtex405-head.S
virtex.c
wii-head.S
wii.c
wrapper
xz_config.h powerpc/boot: add {get, put}_unaligned_be32 to xz_config.h 2019-07-31 07:27:07 +02:00
zImage.coff.lds.S
zImage.lds.S
zImage.ps3.lds.S

To extract the kernel vmlinux, System.map, .config or initrd from the zImage binary:

objcopy -j .kernel:vmlinux -O binary zImage vmlinux.gz
objcopy -j .kernel:System.map -O binary zImage System.map.gz
objcopy -j .kernel:.config -O binary zImage config.gz
objcopy -j .kernel:initrd -O binary zImage.initrd initrd.gz


	Peter